Skip to content

Commit

Permalink
fix: handle sacct failures
Browse files Browse the repository at this point in the history
Some Slurm installations have accounting disabled and you can only get information about the job using scontrol show job <slurm-job-id>
For now, we just handle the failed call here.
  • Loading branch information
183amir authored Jul 17, 2024
1 parent e9198f6 commit 731380b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/gridtk/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@
def update_job_statuses(grid_ids: Iterable[int]) -> dict[int, dict]:
"""Retrieve the status of the jobs in the database."""
status = dict()
output = subprocess.check_output(
["sacct", "-j", ",".join([str(x) for x in grid_ids]), "--json"],
text=True,
)
try:
output = subprocess.check_output(
["sacct", "-j", ",".join([str(x) for x in grid_ids]), "--json"],
text=True,
)
except subprocess.CalledProcessError:
return status
for job in json.loads(output)["jobs"]:
status[job["job_id"]] = job
return status
Expand Down

0 comments on commit 731380b

Please sign in to comment.