-
Notifications
You must be signed in to change notification settings - Fork 634
Description
When I run snakemake --dag | dot or snakemake --rulegraph | dot multiple times on the same workflow, I get diagrams with identical layout but different colors for the various nodes. I'm investigating how feasible it would be to make the output from snakemake --dag and snakemake --rulegraph deterministic.
Unless I've missed or misunderstood something, the code for coloring nodes in the DAG._dot method is deterministic.
Lines 1976 to 1981 in cc6c998
| # color rules | |
| huefactor = 2 / (3 * len(self.rules)) | |
| rulecolor = { | |
| rule: "{:.2f} 0.6 0.85".format(i * huefactor) | |
| for i, rule in enumerate(self.rules) | |
| } |
Being unfamiliar with Snakemake internals, if I had to guess, I'd assume that the non-deterministic behavior comes when iterating over self.jobs, which happens both for --dag and --rulegraph modes.
Line 1962 in cc6c998
| dag = {job: self.dependencies[job] for job in self.jobs} |
Lines 1937 to 1938 in cc6c998
| for job in self.jobs: | |
| graph[job.rule].update(dep.rule for dep in self.dependencies[job]) |
Am I on the right track here? Would it be possible with a reasonable amount of effort to generate DOT output deterministically for these modes?