Skip to content

Commit

Permalink
[cms] Improve crab job status parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jan 12, 2025
1 parent 058d5cf commit 9c02f95
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions law/contrib/cms/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,24 +466,36 @@ def extra(
extra["tracking_url"] = monitoring_url
return extra

# in case scheduler status or the json line is missing, the submission could be too new
# in case scheduler status or the json line is missing, the submission could be too new or
# it failed entirely
if not scheduler_status or not json_line:
accepted_server_states = [
pending_server_states = {
"HOLDING on command SUBMIT",
"NEW on command SUBMIT",
"QUEUED on command SUBMIT",
"WAITING on command SUBMIT",
"SUBMITTED",
]
if server_status not in accepted_server_states:
s = ",".join(map("'{}'".format, accepted_server_states))
}
failed_server_states = {"SUBMITFAILED"}
error = None
if server_status in pending_server_states:
status = cls.PENDING
elif server_status in failed_server_states:
status = cls.FAILED
error = "submission failed"
else:
s = ",".join(map("'{}'".format, pending_server_states | failed_server_states))
raise Exception(
"no per-job information available (yet?), which is only accepted if the crab "
f"server status is any of {s}, but got '{server_status}'",
)
# interpret all jobs as pending
return {
job_id: cls.job_status_dict(job_id=job_id, status=cls.PENDING, extra=extra(job_id))
job_id: cls.job_status_dict(
job_id=job_id,
status=status,
error=error,
extra=extra(job_id),
)
for job_id in job_ids
}

Expand Down

0 comments on commit 9c02f95

Please sign in to comment.