Skip to content

Instantly share code, notes, and snippets.

@nthomas-mozilla
Last active August 7, 2019 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nthomas-mozilla/33e9fc5c0683d0b1cd090c3fc42fd1ac to your computer and use it in GitHub Desktop.
Save nthomas-mozilla/33e9fc5c0683d0b1cd090c3fc42fd1ac to your computer and use it in GitHub Desktop.
kind dependecy graphs

Setup

$ pip2 install graphviz   # has no extra deps so it's not going to add a zillion packages

and have graphviz installed (homebrew, yum, etc, which will pull in a few packages).

Patch gecko

diff --git a/taskcluster/taskgraph/generator.py b/taskcluster/taskgraph/generator.py
--- a/taskcluster/taskgraph/generator.py
+++ b/taskcluster/taskgraph/generator.py
@@ -253,6 +253,15 @@ class TaskGraphGenerator(object):
                 "Limiting kinds to {target_kind} and dependencies".format(
                     target_kind=self._target_kind))
             kind_graph = kind_graph.transitive_closure({self._target_kind, 'docker-image'})
+        # dump out a pdf of the graph
+        import graphviz
+        dot = graphviz.Digraph(comment='The Graph')
+        for kind, kind_deps in kind_graph.links_dict().items():
+            dot.node(kind)
+            for kind_dep in kind_deps:
+                dot.edge(kind, kind_dep)
+        dot.render('test-graph.gv')
+

         logger.info("Generating full task set")
         all_tasks = {}

Generate graph

# a full graph
./mach taskgraph target-graph -F -p /path/to/braindump/taskcluster/taskgraph-diff/params/mc-desktop-nightly.yml --json > tasks.json

# limit to a particular kind to see its deps
./mach taskgraph target-graph -F -p /path/to/braindump/taskcluster/taskgraph-diff/params/mc-desktop-nightly.yml --target-kind=release-notify-promote --json > tasks.json

A pdf of the graph will be generated at test-graph.gv.pdf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment