Commit 95a1ed07 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add option to show list of outputs from command line

parent 0efbe439
......@@ -55,6 +55,27 @@ class JflowArgumentParser (argparse.ArgumentParser):
return new_arg_strings
def show_workflow_outputs(m_workflow, logs):
outputs = m_workflow.get_outputs_per_components()
descriptions = m_workflow.get_description_per_components()
idx = 1
for output in outputs:
name = output[:output.index(".")]
component = str(idx) + ". "
if output in descriptions and descriptions[output] is not None:
component += descriptions[output]
else:
component += name
component += ":\n"
has_outputs = False
for output_file in outputs[output]:
if logs or (not output_file.endswith(".stdout") and not output_file.endswith(".stderr")):
has_outputs = True
component += " * " + outputs[output][output_file] + "\n"
if has_outputs:
print(component)
idx += 1
if __name__ == '__main__':
# Create a workflow manager to get access to our workflows
......@@ -84,6 +105,15 @@ if __name__ == '__main__':
required=True, dest="workflow_id")
sub_parser.set_defaults(cmd_object="delete")
# Add outputs workflow availability
sub_parser = subparsers.add_parser("outputs", help="Get workflow outputs")
sub_parser.add_argument("--workflow-id", type=str, help="Workflow for which show outputs",
required=True, dest="workflow_id")
sub_parser.add_argument("--logs", help="Show logs files", dest="logs", action="store_true")
sub_parser.add_argument("--no-logs", help="Don't show logs files", dest="logs", action="store_false")
sub_parser.set_defaults(logs=False)
sub_parser.set_defaults(cmd_object="outputs")
# Add rerun workflow availability
sub_parser = subparsers.add_parser("execution-graph", help="Display the workflow execution graph")
sub_parser.add_argument("--workflow-id", type=str, help="Which workflow should be considered",
......@@ -148,6 +178,12 @@ if __name__ == '__main__':
wfmanager.delete_workflow(args["workflow_id"])
except Exception as e:
utils.display_error_message(str(e))
elif args["cmd_object"] == "outputs":
try:
my_workflow = wfmanager.get_workflow(args["workflow_id"])
show_workflow_outputs(my_workflow, args["logs"])
except Exception as e:
utils.display_error_message(str(e))
elif args["cmd_object"] == "execution_graph":
try:
workflow = wfmanager.get_workflow(args["workflow_id"])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment