How do i generate a Directed Acyclic Graph (DAG) based on a given priority of different objects?

Viewed 16

This is for a dependency related program. Each project has multiple dependencies which needs to build in a certain sequence, and only if all the build pipelines pass, would the project build be a success. I am currently receiving a list of dependencies, which has a certain priority in which it should be built. For example, lets say for a certain project, there are the following dependencies.

Dependency - Priority

P1 - 1

P2 - 2

P3 - 2

P4 - 3

Dependencies with the same priority can be built in parallel to speed up the process. I cannot use airflow for this task. I am trying to create a DAG and run a topological sort to achieve this but i am not sure where exactly to begin. The graphlib library does have a method, but it does require a dict of nodes and its predecessors. Is there a way i can dynamically generate this dict?

0 Answers
Related