Skip to content

Commit f0d77a3

Browse files
author
zhaoyu
committed
Corrected UNREADY before more statistics are provided
1 parent a739f23 commit f0d77a3

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

python/lsst/ctrl/bps/panda/panda_service.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def report(
251251
# Sort tasks by workload_id or fallback
252252
try:
253253
tasks.sort(key=lambda x: x["transform_workload_id"])
254-
except Exception:
254+
except (KeyError, TypeError):
255255
tasks.sort(key=lambda x: x["transform_id"])
256256

257257
exit_codes_all = {}
@@ -314,9 +314,17 @@ def report(
314314
njobs = val
315315
if state == WmsStates.RUNNING:
316316
njobs += task.get("output_new_files", 0) - task.get("input_new_files", 0)
317-
wms_report.job_state_counts[state] += njobs
317+
if state != WmsStates.UNREADY:
318+
wms_report.job_state_counts[state] += njobs
318319
taskstatus[state] = njobs
319320

321+
# Count UNREADY
322+
unready = WmsStates.UNREADY
323+
taskstatus[unready] = totaljobs - sum(
324+
taskstatus[state] for state in WmsStates if state != unready
325+
)
326+
wms_report.job_state_counts[unready] += taskstatus[unready]
327+
320328
# Store task summary
321329
wms_report.job_summary[tasklabel] = taskstatus
322330
summary_part = f"{tasklabel}:{totaljobs}"

python/lsst/ctrl/bps/panda/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def extract_taskname(s: str) -> str:
111111

112112

113113
def aggregate_by_basename(job_summary, exit_code_summary, run_summary):
114-
"""
115-
Aggregate job exit code and run summaries by their base label (basename).
114+
"""Aggregate job exit code and run summaries by
115+
their base label (basename).
116116
117117
Parameters
118118
----------

0 commit comments

Comments
 (0)