Commit ef9d2e23 authored by Zdralovic Edim's avatar Zdralovic Edim

fixed error status in database

parent a28e2f6c
......@@ -417,13 +417,13 @@ class WorkflowWrapper(threading.Thread):
if not self.stopped:
wesParser.parse_log(self.logFilePath, wesDAO, self.workflowDBID)
def killToilRunner(self):
def killToilRunner(self, status="CANCELED"):
"""
This method stops the currently running workflow on the spot.
"""
self.stopped = True
self.toilProcess.terminate()
wesDAO.update_Workflow(self.workflowDBID, state="CANCELED")
wesDAO.update_Workflow(self.workflowDBID, state = status)
def callToilRunner(self):
"""
......@@ -446,6 +446,8 @@ class WorkflowWrapper(threading.Thread):
logfile.write(l.decode('utf-8'))
if not self.stopped:
wesParser.parse_log(self.logFilePath, wesDAO, self.workflowDBID)
if wesDAO.get_workflow_status(self.workflowDBID) == "EXECUTOR_ERROR" and wesDAO.get_workflow_status(self.workflowDBID) == "SYSTEM_ERROR":
self.killToilRunner(status=wesDAO.get_workflow_status(self.workflowDBID))
def retrieveDetailedInfoWorkflow(self):
"""
......
......@@ -54,24 +54,23 @@ class ToilLogParser():
is_job_errormsg = False
job_errormsg = ""
run_arg = ""
line_counter = 0
for line in log_file:
job_errormsg_start_match = re.match(job_errormsg_start_pattern, line)
if job_errormsg_start_match is not None:
is_job_errormsg = True
if is_job_errormsg:
line_counter+=1
job_errormsg_end_match = re.match(job_errormsg_end_pattern, line)
if job_errormsg_end_match is not None:
is_job_errormsg = False
taskid = wes_dao.get_taskid(workflowid, run_arg)
wes_dao.update_Task(taskid, stderr=job_errormsg)
else:
job_errormsg+=line+"\n"
elif line_counter > 1:
job_errormsg+=line
else:
workflow_id_match = re.match(workflow_id_pattern, line)
......@@ -82,6 +81,7 @@ class ToilLogParser():
workflow_output_location_match = re.match(workflow_output_location_pattern, line)
workflow_output_size_match = re.match(workflow_output_size_pattern, line)
workflow_output_end_match = re.match(workflow_output_end_pattern, line)
workflow_output_match = None
for workflow_output_pattern in workflow_output_patterns:
......
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