Commit 8a8ba4fb authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add display of outputs in addition to commands on component failed + display...

Add display of outputs in addition to commands on component failed + display commands failed with their outputs on workflow failed
parent 98a85464
......@@ -516,6 +516,27 @@ class Workflow(threading.Thread):
def config_parser(arg_lines):
for arg in arg_lines:
yield arg
@staticmethod
def get_components_errors_under_text_format(workflow):
components_status = workflow.get_components_status()
components_errors = ""
for i, component in enumerate(workflow.get_components_nameid()):
status_info = components_status[component]
if len(status_info["failed_commands"]) > 0:
components_errors = \
Workflow.get_component_errors_under_text_format(component, components_status[component],
components_errors)
return components_errors
@staticmethod
def get_component_errors_under_text_format(component, status_info, components_errors=""):
if components_errors == "":
components_errors = "Failed Commands :\n"
components_errors += " - " + component + " :\n"
for command, output in zip(status_info["failed_commands"], status_info["failed_outputs"]):
components_errors += " ".join([" ", command, "\n (outputs:", output, ")\n"])
return components_errors
@staticmethod
def get_status_under_text_format(workflow, detailed=False, display_errors=False, html=False):
......@@ -576,12 +597,11 @@ class Workflow(threading.Thread):
else: completed = "completed:" + str(status_info["completed"])
if display_errors and len(status_info["failed_commands"]) > 0:
if components_errors == "":
components_errors = "Failed Commands :\n"
components_errors += " - " + component + " :\n " + "\n ".join(status_info["failed_commands"]) + "\n"
status += " - " + component + ", time elapsed " + time_format(status_info["time"]) + \
" (total:" + str(status_info["tasks"]) + ", " + waiting + ", " + running + ", " + failed + \
", " + aborted + ", " + completed + ")"
components_errors = \
Workflow.get_component_errors_under_text_format(component, status_info, components_errors)
status += " ".join([" - ", component, ", time elapsed ", time_format(status_info["time"]),
" (total:" + str(status_info["tasks"]), ", " + waiting, ", ", running, ", ", failed,
", ", aborted, ", ", completed, ")"])
if i<len(workflow.get_components_nameid())-1: status += "\n"
# Format str
pretty_str = title
......@@ -1035,6 +1055,8 @@ class Workflow(threading.Thread):
self._log(str(e), traceback=traceback.format_exc(chain=False))
if self.jflow_config_reader.get_debug():
print(traceback.format_exc(chain=True), file=sys.stderr)
print("")
print(self.get_components_errors_under_text_format(self))
utils.display_error_message(str(e))
finally:
......@@ -1094,7 +1116,8 @@ class Workflow(threading.Thread):
"failed": 0,
"aborted": 0,
"completed": 0,
"failed_commands": list() }
"failed_commands": list(),
"failed_outputs": list()}
if cmpt_nameid not in self.reseted_components:
if self.component_nameids[cmpt_nameid] not in makeflows_logs:
makeflows_logs.append(self.component_nameids[cmpt_nameid])
......@@ -1116,7 +1139,10 @@ class Workflow(threading.Thread):
status[cmpt_nameid]["running"] += 1
elif n.state == Node.FAILED:
status[cmpt_nameid]["failed"] += 1
status[cmpt_nameid]["failed_commands"].append( n.command )
status[cmpt_nameid]["failed_commands"].append(n.command)
src_dir = os.path.sep.join(n.command.split(" ")[0].split(os.path.sep)[:-5])
status[cmpt_nameid]["failed_outputs"].append(os.path.join(src_dir, "makeflow.failed." +
str(n.id)))
elif n.state == Node.ABORTED:
status[cmpt_nameid]["aborted"] += 1
elif n.state == Node.COMPLETED:
......
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