Skip to content

Commit

Permalink
Improve handling of --show option
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-slac committed Jan 16, 2019
1 parent 75c2d21 commit 073ce59
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions python/lsst/ctrl/mpexec/cmdLineFwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ def showInfo(self, showOpts, pipeline, graph):
for what in showOpts:
showCommand, _, showArgs = what.partition("=")

if showCommand in ["pipeline", "config", "history", "tasks"]:
if not pipeline:
_LOG.warn("Pipeline is required for --show=%s", showCommand)
continue

if showCommand == "pipeline":
for taskDef in pipeline:
print(taskDef)
Expand Down Expand Up @@ -490,11 +495,15 @@ def _showConfigHistory(self, pipeline, showArgs):
Defines what to show
"""

matHistory = re.search(r"^(?:(\w+)::)(?:config.)?(.+)?", showArgs)
taskName = matHistory.group(1)
pattern = matHistory.group(2)
taskName = None
pattern = None
matHistory = re.search(r"^(?:(\w+)::)(?:config[.])?(.+)", showArgs)
if matHistory:
taskName = matHistory.group(1)
pattern = matHistory.group(2)
print(showArgs, taskName, pattern)
if not pattern:
print("Please provide a value with --show history (e.g. history=XXX)", file=sys.stderr)
print("Please provide a value with --show history (e.g. history=Task::param)", file=sys.stderr)
sys.exit(1)

tasks = util.filterTasks(pipeline, taskName)
Expand Down

0 comments on commit 073ce59

Please sign in to comment.