Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/test' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-badretdin committed May 17, 2023
2 parents 6c6a86b + 511e56c commit 2388d68
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions scripts/pgap.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ def quiet_remove(filename):
with contextlib.suppress(FileNotFoundError):
os.remove(filename)

def find_failed_step(filename, output_file_name):

def find_failed_step(filename):
r = "^\[(?P<time>[^\]]+)\] (?P<level>[^ ]+) \[(?P<source>[^ ]*) (?P<name>[^\]]*)\] (?P<status>.*)"
search = re.compile(r)
ofh = open(output_file_name, "w");
lines = open(filename, "r").readlines()
nameStarts = {}
start = -1
Expand All @@ -148,11 +146,11 @@ def find_failed_step(filename, output_file_name):
start = nameStarts[name]
break
if start > -1:
print("Printing log starting from failed job:\n", file=ofh)
print("Printing log starting from failed job:\n")
for i in range(start, len(lines)):
print(lines[i], end="", file=ofh)
print(lines[i], end="")
else:
print("Unable to find error in log file.", file=ofh)
print("Unable to find error in log file.")

def get_cpus(self):
if 'SLURM_CPUS_PER_TASK' in os.environ:
Expand Down Expand Up @@ -494,25 +492,20 @@ def launch(self):
proc = subprocess.Popen(self.cmd, stdout=f, stderr=subprocess.STDOUT)
proc.wait()
finally:
failed_step_generated = False
if proc.returncode == None:
print('\nAbnormal termination, stopping all processes.')
proc.terminate()
elif proc.returncode == 0:
print(f'{self.pipename} completed successfully.')
else:
print(f'{self.pipename} failed, docker exited with rc =', proc.returncode)
failed_step_log = self.params.args.output + '/cwltool.failed_step.log'
find_failed_step(cwllog, failed_step_log)
failed_step_generated = True
find_failed_step(cwllog)
output_files = [
{"file": "final_asndisc_diag.xml", "remove": True},
{"file": "final_asnval_diag.xml", "remove": True},
{"file": "initial_asndisc_diag.xml", "remove": True},
{"file": "initial_asnval_diag.xml", "remove": True}
]
if failed_step_generated:
output_files.append( {"file": "cwltool.failed_step.log", "remove": False})
self.report_output_files(self.params.args.output, output_files)
return proc.returncode

Expand Down

0 comments on commit 2388d68

Please sign in to comment.