Build a dependency graph (which jobs need which other jobs)
Execute jobs in topological order (respecting dependencies)
For what it’s worth, Python has graphlib.TopologicalSorter in the standard library that can do this, including grouping tasks that can be run in parallel:
Comments
For what it’s worth, Python has graphlib.TopologicalSorter in the standard library that can do this, including grouping tasks that can be run in parallel:
https://docs.python.org/3/library/graphlib.html
One of the best real "batteries" added in recent years.