Skip to content

Generate graphs of migration dependencies

Issue #3099079 on drupal.org by mikeryan.

For a large complex migration project (124 migrations with complex dependencies), I was trying to determine the optimal way to run migrations in parallel, and developed a migrate:dependency-graph command. This generates PlantUML files for input to Graphviz. I'm not sure when I'll have a little time to generalize it for a migrate_tools patch, but by opening an issue interested people can ping me here as a reminder if I don't do it in the next couple of weeks (might have to wait until January though).

The usage (assuming you have Graphviz installed) is:

drush migrate:dependency-graph >dependencies.dot
dot dependencies.dot -T pdf >dependencies.pdf

Creating something like this:

Sample dependency graph

Oh, did I mention that because we're trying to figure out process parallelization, I made the heights proportional to the source counts (as a rough proxy of migration time)?

Two features that should be added for the patch to be submitted here:

  1. Using source counts for height should be an option (and not the default) - most people probably just want to see the relationships.
  2. A means (perhaps tag-based?) of excluding certain migrations. You can see in our example how unwieldy it can get - and that's including a little hack to exclude our many small "lookup" migrations (basically vocabularies).

Attached is what I have now.