Repository navigation
refactor: draw a compiled workflow after compiling, and draw the wic: graphviz: keys again - #516
Conversation
30bc959 to
76a82ba
Compare
9d3587d to
1dd9108
Compare
darkclad
left a comment
There was a problem hiding this comment.
The projection reads well: compiling no longer carries drawing state, and the sidecar keys follow Resolve's addressing, so a (index, name) key and a bare id behave the same as under wic: steps:. One finding is inline: two calls to the same subworkflow share a cluster name, which lets one call's graphviz: label and style overwrite the other's.
I ran tests/core at cb12fb1 and at its base, 8317619. The same 77 tests fail on both, all environmental (Docker or cwltool runs on Windows), and the head passes 15 more.
Nit: the description ends with "Stacked on #515.", but #515 is merged; this PR is stacked on #531 only.
| workflow it calls as a cluster of its own, down to `--graph_inline_depth`.""" | ||
| sidecar = sidecars[graph.namespace] | ||
| look = graphviz_entry(sidecar) | ||
| cluster = graphviz.Digraph(name=f'cluster_{graph.name}') |
There was a problem hiding this comment.
Two calls to the same subworkflow draw two clusters with the same DOT name. With - id: sub.wic twice, both are subgraph cluster_sub_f2e0504b. Graphviz treats a repeated subgraph name as the same subgraph, so both calls' steps land in one cluster and the last call's label and style win. If the wic: steps: entry for (2, sub.wic) sets graphviz: {style: invis}, the first call's steps are hidden too, and the label on (1, sub.wic) is lost.
The shared name predates this PR, but it did no harm until clusters carried a label and style for each call. Naming a child cluster after the step that calls it, the way nodes are named (docs/dev/algorithms.md), would keep them apart. For example, cluster_{names.qualified(<calling step id>)}. The _cluster(drawn, f'cluster_{_SUB}') assertions in test_graph_features.py would need to follow. A test that calls sub.wic twice with different labels would pin the fix.
There was a problem hiding this comment.
You're right. Two calls to one subworkflow shared a DOT cluster name, so Graphviz merged them and the last call's label and style won. Each called workflow's cluster is now named after the step that calls it, using the same qualified id as the nodes (cluster_w__step__2__sub.wic). Two calls therefore stay two clusters. I added a test that calls sub.wic twice with different labels and an invis style on one call. It checks that each cluster keeps its own look and that the other call's steps stay visible. The cluster assertions in test_graph_features.py follow the new names.
Fixed in 325d80c.
|
Thanks for running tests/core at both commits. The shared cluster name is fixed: a called subworkflow's cluster is now named after the step that calls it, so one call's graphviz label and style can no longer overwrite another's. I covered it with a two-call test. On the nit: I'll correct the "Stacked on #515" line in the description, since #515 is merged and this PR sits on #531 only. Fixed in 325d80c. |
The compiler built a graphviz drawing, a networkx graph and a GraphData tree on every compile, threaded graph settings and a graph_target through compile_source, and kept the result on every artifact, though only --graphviz ever read it. Drawing is now sophios.drawing.draw(result, bundle, settings, name), a projection of the compiled graph that main calls only with --graphviz. compile_source takes the bundle and the compiler options, and default_compilation_settings() returns those options alone. CompilationArtifact.graph_view, GraphReps, GraphData and utils_graphs are gone. The DOT --graphviz writes and the emitted CWL are unchanged.
… again Since the compiler was rewritten, --graphviz ignored every wic: graphviz: key but the root's label: a step's label and style, a subworkflow's title and style, and ranksame were parsed and dropped. The drawing reads each document's wic: block as Resolve reads it, with the calling step's entry merged into the subworkflow's. A step's label replaces its id, unless --graph_label_stepname asks for the generated names. A step's style is appended to rounded, filled. A subworkflow's label titles its cluster, which is otherwise titled with the id it is called by, and its style styles the cluster; invis hides the call's box too. A workflow's ranksame steps share one rank=same group in its own cluster, the root's included. A ranksame entry that addresses no step is named on stderr, like a stale wic: steps: key. The --graph_label_stepname help said it prepends the step name, and docs/dev/algorithms.md that --graph_inline_depth collapses a deeper subworkflow to one node; both now say what they do.
Drawing no longer builds a networkx graph, so nothing under src imports it.
The parser has already checked the entry's shape, so the reader does not check it again, and a call box is found from the step's own child graph.
Two calls to one subworkflow drew two clusters with the same DOT name, and Graphviz merges subgraphs of one name: both calls' steps landed in one cluster and the last call's label and style won. Since a call's `wic: steps:` entry can now set a cluster's label and style, that was visible. I name each child cluster with the qualified id of its calling step, the way nodes are named.
325d80c to
a24468e
Compare
What
sophios.drawing.draw(compiled, bundle, settings, name)builds the DOT, andcompile_sourceno longer takes graph settings or a drawing target.GraphReps,GraphData,graph_view,utils_graphs.pyand_project_graphare gone, andnetworkxis a test dependency only.wic: graphviz:keys are drawn again.label: replaces a step's label and titles a subworkflow's cluster; a cluster with no label is titled with the call's name.style: appended to a step's style and applied to a cluster;invison a subworkflow also hides its call box.ranksame: groups the named steps, at any depth.wic: steps:key.--graph_label_stepnamewins over a sidecar label.--graph_label_stepnamehelp and the--graph_inline_depthdescription say what the code does.Why
Drawing was threaded through compilation, and the refactors that removed its helpers silently stopped drawing the sidecar keys that mm-workflows uses in about 50 files. Emitted CWL is unchanged.
Stacked on #515.