Commit d551e7fe authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Print outputs at the end of the workflow

parent 449ed83b
......@@ -55,27 +55,6 @@ class JflowArgumentParser (argparse.ArgumentParser):
return new_arg_strings
def print_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
......@@ -181,7 +160,7 @@ if __name__ == '__main__':
elif args["cmd_object"] == "outputs":
try:
my_workflow = wfmanager.get_workflow(args["workflow_id"])
print_workflow_outputs(my_workflow, args["logs"])
my_workflow.print_workflow_outputs(args["logs"])
except Exception as e:
utils.display_error_message(str(e))
elif args["cmd_object"] == "execution_graph":
......
......@@ -588,6 +588,27 @@ class Workflow(threading.Thread):
else:
return None
def print_workflow_outputs(self, logs):
outputs = self.get_outputs_per_components()
descriptions = self.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
def get_description_per_components(self):
dag = self.get_execution_graph()
descriptions = {}
......@@ -910,6 +931,12 @@ class Workflow(threading.Thread):
self.post_process()
self._postprocess_status = self.STATUS_COMPLETED
self._status = self.STATUS_COMPLETED
print("")
print("###########")
print("# Results #")
print("###########")
print("")
self.print_workflow_outputs(False)
except:
self._postprocess_status = self.STATUS_FAILED
raise
......
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