mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
+7
-1
@@ -564,11 +564,17 @@ def parse_args(argv=None):
|
||||
'show',
|
||||
parents=[parent_parser],
|
||||
help='Show pipeline')
|
||||
pipeline_show_parser.add_argument('-c',
|
||||
pipeline_show_parser_group = pipeline_show_parser.add_mutually_exclusive_group()
|
||||
pipeline_show_parser_group.add_argument('-c',
|
||||
'--commands',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Print commands instead of paths to DVC files.')
|
||||
pipeline_show_parser_group.add_argument('-o',
|
||||
'--outs',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Print output files instead of paths to DVC files.')
|
||||
pipeline_show_parser.add_argument(
|
||||
'targets',
|
||||
nargs='+',
|
||||
|
||||
@@ -7,7 +7,7 @@ from dvc.project import NotDvcFileError
|
||||
|
||||
|
||||
class CmdPipelineShow(CmdBase):
|
||||
def _show(self, target, commands):
|
||||
def _show(self, target, commands, outs):
|
||||
G = self.project.graph()[0]
|
||||
stages = networkx.get_node_attributes(G, 'stage')
|
||||
node = os.path.relpath(os.path.abspath(target), self.project.root_dir)
|
||||
@@ -15,15 +15,18 @@ class CmdPipelineShow(CmdBase):
|
||||
raise NotDvcFileError(node)
|
||||
|
||||
for n in networkx.dfs_postorder_nodes(G, node):
|
||||
line = n
|
||||
if commands:
|
||||
line = stages[n].cmd
|
||||
self.project.logger.info(line)
|
||||
self.project.logger.info(stages[n].cmd)
|
||||
elif outs:
|
||||
for out in stages[n].outs:
|
||||
self.project.logger.info(out.rel_path)
|
||||
else:
|
||||
self.project.logger.info(n)
|
||||
|
||||
def run(self, unlock=False):
|
||||
for target in self.args.targets:
|
||||
try:
|
||||
self._show(target, self.args.commands)
|
||||
self._show(target, self.args.commands, self.args.outs)
|
||||
except DvcException as ex:
|
||||
msg = 'Failed to show pipeline for \'{}\''.format(target)
|
||||
self.project.logger.error(msg, ex)
|
||||
|
||||
@@ -360,6 +360,11 @@ class Project(object):
|
||||
stages = self.active_stages()
|
||||
|
||||
for stage in stages:
|
||||
if not stage.locked:
|
||||
msg = 'DVC file \'{}\' is locked. Its dependecies are not ' \
|
||||
'going to be shown in status output.'
|
||||
self.logger.warn(msg.format(stage.relpath))
|
||||
|
||||
status.update(stage.status())
|
||||
|
||||
return status
|
||||
|
||||
Reference in New Issue
Block a user