Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dagvis #303

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Open

Dagvis #303

wants to merge 11 commits into from

Conversation

jwhite242
Copy link
Collaborator

Add visualization option for the workflow's dag, including multiple output formats (matplotlib, dot file, graphml) and two layout options (spring layout and dot hierarchical).

@jwhite242 jwhite242 requested review from jsemler and FrankD412 August 17, 2020 06:17
setup.py Outdated
@@ -44,7 +44,9 @@ def load_readme():
"coloredlogs",
"chainmap ; python_version<'3'",
],
extras_require={},
extras_require={"networkx": ["networkx"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding, this is extra_key that maps to a list of [extra_requirement1, ...]. Would it make sense to make this something like:

extras_require={"vis": ["networkx", "matplotlib", "pygrapyviz"],
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. Also be good if i fix it so pygraphviz is spelled correctly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to document in the installation information how to install the vis aspects too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to test this and ended up having to install the requirements manually. Might be worth adding them to the requirements.txt file as pip doesn't seem to allow optional specification when installing from a repository locally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, and graphviz has to be manual no matter what for now, which is kind of annoying; definitely needs some docs for that.

So, I'd thought the extras provisions in the setup.py would have taken care of that, preventing the need for multiple requirements files.. That's disappointing to hear it doesn't work out that way..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant was that during testing, since I had to install it via pip install . it didn't allow me to use the optional flags. I couldn't figure out how to get it to work, and noticed they weren't in the requirements.txt -- so those should be there for developers to use. Otherwise, I think it's just compiling a wheel and add that path using -f to test is the optionals work I think?

@@ -334,6 +336,11 @@ def setup_argparser():
run.add_argument("--dry", action="store_true", default=False,
help="Generate the directory structure and scripts for a "
"study but do not launch it. [Default: %(default)s]")
run.add_argument("--draw", type=str, action="append", default=[],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any thoughts on enabling this feature to be used without having to submit a Maestro run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that already works

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i need to clarify: it works with dry run, so it doesn't run anything, but it does do all the workspace creation and currently saves the dag_vis outputs into that workspace. will look into a -no-workspace option

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would the --no-workspace option be added. It wouldn't make sense to have that be standalone. It'd have to be explicitly paired with --dry and/or --draw?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, that's a good question. While that thought/idea hadn't been really fleshed out at the time, I think it'd have to be tied to --draw. Does it really make any sense to have it tied to --dry? That would seem to defeat the purpose of dry runs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh -- good call. I went too far with the logic on that one. I think there is a way to pair CLI paramters, but I'm not sure how that displays in help.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another suggestion for the command line option in particular -- look at the choices=[] optional field for add_argument. That lets you enforce specific choices for command line flags.

@FrankD412
Copy link
Member

I tested the matplotlib code with the LULESH sample specification and the visualization got messy. I've not tested with the dot format yet, primarily because I need to figure out how to render it. But the image below was the result of my initial run.

dag_lulesh_sample1_

@jwhite242
Copy link
Collaborator Author

I tested the matplotlib code with the LULESH sample specification and the visualization got messy. I've not tested with the dot format yet, primarily because I need to figure out how to render it. But the image below was the result of my initial run.

dag_lulesh_sample1_

Hmm, the autosizing doesn't work so well on that one with those interior nodes. For the dot format, if you have pygraphviz/graphviz installed you can use --draw mpl-dot which will render it for you with graphviz's much nicer dot layout for the tree like structures. Anyway, I'll take another pass at some more clever sizing (or maybe pull the cleverness out since it looks terrible when it doesn't work).

@FrankD412
Copy link
Member

I tested the matplotlib code with the LULESH sample specification and the visualization got messy. I've not tested with the dot format yet, primarily because I need to figure out how to render it. But the image below was the result of my initial run.
dag_lulesh_sample1_

Hmm, the autosizing doesn't work so well on that one with those interior nodes. For the dot format, if you have pygraphviz/graphviz installed you can use --draw mpl-dot which will render it for you with graphviz's much nicer dot layout for the tree like structures. Anyway, I'll take another pass at some more clever sizing (or maybe pull the cleverness out since it looks terrible when it doesn't work).

Sounds good -- I ran a rendering in mpl-dot and got the following. It's better, but the downstream nodes seem to bundle up.

dag_lulesh_sample1_

@jwhite242
Copy link
Collaborator Author

Yeah, the layout algorithm doesn't currently take node text size into account. That's sort of a pain point currently, but i've got a few ideas for dealing with that that I'm working on. I think graphviz can deal with that better, and is something i still need to port from my old prototype

@FrankD412 FrankD412 removed this from the Release 1.1.9 milestone May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants