Skip to content

Commit e7380aa

Browse files
authored
Merge pull request #109 from common-workflow-language/force-outputs-bottom
Force outputs to the bottom of graphs using invis edge
2 parents 7e4adbb + ad4f173 commit e7380aa

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/org/commonwl/view/graphviz/DotWriter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ private void writeSteps(Workflow workflow) throws IOException {
193193
}
194194
}
195195
}
196+
197+
// Workaround to force outputs to lowest ranking, see #104
198+
writeLine("");
199+
writeLine(" // Invisible links to force outputs to be at lowest rank");
200+
for (Map.Entry<String, CWLStep> step : workflow.getSteps().entrySet()) {
201+
writeLine(" \"" + step.getKey() + "\" -> \"" +
202+
workflow.getOutputs().keySet().iterator().next() +
203+
"\" [style=invis];");
204+
}
205+
196206
}
197207

198208
/**

src/test/resources/graphviz/testWorkflow.dot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,9 @@ digraph workflow {
4949
"input2" -> "step1";
5050
"default1" [label="examplefile.jar", fillcolor="#D5AEFC"]
5151
"default1" -> "step1";
52+
53+
// Invisible links to force outputs to be at lowest rank
54+
"default1" -> "output" [style=invis];
55+
"step2" -> "output" [style=invis];
56+
"step1" -> "output" [style=invis];
5257
}

0 commit comments

Comments
 (0)