mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
dvc: reuse collected stages
Fixes #710 Fixes #711 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
@@ -135,13 +135,6 @@ class Dependency(object):
|
||||
def loads_from(cls, project, s_list, cwd=os.curdir):
|
||||
return [cls.loads(project, x, cwd=cwd) for x in s_list]
|
||||
|
||||
def stage(self):
|
||||
for stage in self.project.stages():
|
||||
for out in stage.outs:
|
||||
if self.path == out.path:
|
||||
return stage
|
||||
return None
|
||||
|
||||
|
||||
class Output(Dependency):
|
||||
PARAM_CACHE = 'cache'
|
||||
|
||||
+9
-3
@@ -239,7 +239,7 @@ class Project(object):
|
||||
else:
|
||||
stages = self.stages()
|
||||
|
||||
for stage in self.stages():
|
||||
for stage in stages:
|
||||
status.update(stage.status())
|
||||
|
||||
return status
|
||||
@@ -326,12 +326,18 @@ class Project(object):
|
||||
|
||||
def graph(self):
|
||||
G = nx.DiGraph()
|
||||
stages = self.stages()
|
||||
|
||||
for stage in self.stages():
|
||||
outs_map = {}
|
||||
for stage in stages:
|
||||
for o in stage.outs:
|
||||
outs_map[o.path] = stage
|
||||
|
||||
for stage in stages:
|
||||
node = os.path.relpath(stage.path, self.root_dir)
|
||||
G.add_node(node, stage=stage)
|
||||
for dep in stage.deps:
|
||||
dep_stage = dep.stage()
|
||||
dep_stage = outs_map.get(dep.path, None)
|
||||
if not dep_stage:
|
||||
continue
|
||||
dep_node = os.path.relpath(dep_stage.path, self.root_dir)
|
||||
|
||||
Reference in New Issue
Block a user