Skip to content

Commit

Permalink
Fix slurm job status queries.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Mar 28, 2023
1 parent 2174818 commit 22ced6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions law/contrib/slurm/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ def submit(self, job_file, partition=None, retries=0, retry_delay=3, silent=Fals
for line in out.strip().split("\n"):
m = self.submission_cre.match(line.strip())
if m:
job_ids = [int(m.group(1))]
job_id = int(m.group(1))
break
else:
code = 1
err = "cannot parse slurm job id(s) from output:\n{}".format(out)

# retry or done?
if code == 0:
return job_ids
return job_id

logger.debug("submission of slurm job '{}' failed with code {}:\n{}".format(
job_file, code, err))
Expand Down
9 changes: 4 additions & 5 deletions law/workflow/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ def poll(self):
continue

# mark as active or unknown
data = data.copy()
if data["job_id"] in (None, self.job_data.dummy_job_id):
data["job_id"] = self.job_data.dummy_job_id
data["status"] = self.job_manager.RETRY
Expand Down Expand Up @@ -964,10 +963,6 @@ def poll(self):
# no errors occured, reset the fail counter
n_poll_fails = 0

# from here on, consider unknown jobs again as active
active_jobs += unknown_jobs
del unknown_jobs

# handle active jobs
for job_num in active_jobs:
# update job data with status info
Expand All @@ -988,6 +983,10 @@ def poll(self):
data["error"] = "initially missing task outputs"
del states_by_id

# from here on, consider unknown jobs again as active
active_jobs += unknown_jobs
del unknown_jobs

# get settings from the task for triggering post-finished status checks
check_completeness = self._get_task_attribute("check_job_completeness")()
check_completeness_delay = self._get_task_attribute("check_job_completeness_delay")()
Expand Down

0 comments on commit 22ced6c

Please sign in to comment.