mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
repo: make repo.active_stages collect active stages only
This commit is contained in:
+15
-5
@@ -353,15 +353,25 @@ class Repo(object):
|
||||
|
||||
return G, G_active
|
||||
|
||||
def pipelines(self, from_directory=None):
|
||||
@staticmethod
|
||||
def _pipelines(graph):
|
||||
import networkx as nx
|
||||
|
||||
G, G_active = self.graph(from_directory=from_directory)
|
||||
|
||||
return [
|
||||
G.subgraph(c).copy() for c in nx.weakly_connected_components(G)
|
||||
graph.subgraph(c).copy()
|
||||
for c in nx.weakly_connected_components(graph)
|
||||
]
|
||||
|
||||
def pipelines(self, from_directory=None):
|
||||
G, _ = self.graph(from_directory=from_directory)
|
||||
|
||||
return self._pipelines(G)
|
||||
|
||||
def pipelines_for_active_nodes(self, from_directory=None):
|
||||
_, G_active = self.graph(from_directory=from_directory)
|
||||
|
||||
return self._pipelines(G_active)
|
||||
|
||||
@staticmethod
|
||||
def _filter_out_dirs(dirs, outs, root_dir):
|
||||
def filter_dirs(dname):
|
||||
@@ -417,7 +427,7 @@ class Repo(object):
|
||||
import networkx as nx
|
||||
|
||||
stages = []
|
||||
for G in self.pipelines(from_directory):
|
||||
for G in self.pipelines_for_active_nodes(from_directory):
|
||||
stages.extend(list(nx.get_node_attributes(G, "stage").values()))
|
||||
return stages
|
||||
|
||||
|
||||
Reference in New Issue
Block a user