mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 15:28:27 +01:00
project: Refactor pipeline
What's a pipeline if not the weekly connected component subgraphs of a directed acyclic graph?
This commit is contained in:
+1
-19
@@ -1180,25 +1180,7 @@ class Project(object):
|
||||
|
||||
G, G_active = self.graph()
|
||||
|
||||
if len(G.nodes()) == 0:
|
||||
return []
|
||||
|
||||
# find pipeline ends aka "output stages"
|
||||
ends = [node for node, in_degree in G.in_degree() if in_degree == 0]
|
||||
|
||||
# filter out subgraphs that didn't exist in original G
|
||||
pipelines = []
|
||||
for c in nx.weakly_connected_components(G_active):
|
||||
H = G_active.subgraph(c)
|
||||
found = False
|
||||
for node in ends:
|
||||
if node in H:
|
||||
found = True
|
||||
break
|
||||
if found:
|
||||
pipelines.append(H)
|
||||
|
||||
return pipelines
|
||||
return list(nx.weakly_connected_component_subgraphs(G_active))
|
||||
|
||||
def stages(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user