Build DAG with downstream steps from a list of steps. Args: steps: The list of steps. Returns: The DAG with downstream steps.
(steps: Dict[str, List[str]])
| 168 | |
| 169 | |
| 170 | def build_dag(steps: Dict[str, List[str]]) -> Dict[str, Set[str]]: |
| 171 | """Build DAG with downstream steps from a list of steps. |
| 172 | |
| 173 | Args: |
| 174 | steps: The list of steps. |
| 175 | |
| 176 | Returns: |
| 177 | The DAG with downstream steps. |
| 178 | """ |
| 179 | dag: Dict[str, Set[str]] = {step: set() for step in steps} |
| 180 | |
| 181 | for step_name, upstream_steps in steps.items(): |
| 182 | for upstream_step in upstream_steps: |
| 183 | dag[upstream_step].add(step_name) |
| 184 | |
| 185 | return dag |
| 186 | |
| 187 | |
| 188 | def find_all_downstream_steps( |