Skip to content

Commit

Permalink
add_job_records: improve error handling
Browse files Browse the repository at this point in the history
Problem: The add_job_records() function does not handle the case where
a ResourceSet object cannot be created out of the R fetched for each
job.

Add a try-except block for this, and just skip adding the record in the
case where the creation of the ResourceSet object does not work since
it will not contribute to an association's job usage or fair-share
value.
  • Loading branch information
cmoussa1 committed Jun 28, 2024
1 parent f140aa2 commit 8549d4c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bindings/python/fluxacct/accounting/job_archive_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ def add_job_records(rows):
job_records = []

for row in rows:
rset = ResourceSet(row[6]) # fetch R
try:
# attempt to create a ResourceSet from R
rset = ResourceSet(row[6])
nnodes = rset.nnodes
except (ValueError, TypeError):
# can't convert R to a ResourceSet object; skip it
continue

job_record = JobRecord(
row[0], # userid
Expand All @@ -132,7 +138,7 @@ def add_job_records(rows):
row[2], # t_submit
row[3], # t_run
row[4], # t_inactive
rset.nnodes, # nnodes
nnodes, # nnodes
row[6], # resources
)
job_records.append(job_record)
Expand Down

0 comments on commit 8549d4c

Please sign in to comment.