Skip to content

fix (WMS): reserve the post-processing margin before advertising the slot - #8746

Draft
aldbr wants to merge 1 commit into
DIRACGrid:integrationfrom
aldbr:wms-allocated-time-v3
Draft

fix (WMS): reserve the post-processing margin before advertising the slot#8746
aldbr wants to merge 1 commit into
DIRACGrid:integrationfrom
aldbr:wms-allocated-time-v3

Conversation

@aldbr

@aldbr aldbr commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Closes #8745
Should be tested with #8528

BEGINRELEASENOTES

*WorkloadManagement
FIX: the JobAgent reserves the JobWrapper's StopMargin before advertising the slot to the matcher and publishing it in /LocalSite/CPUTimeLeft, so that jobs are neither matched nor sized against time the post-processing will need. The Watchdog no longer deducts it a second time.
NEW: the Watchdog can again signal a payload to wind down before its budget runs out (StopSigRegex, StopSigNumber, StopSigStartWork, StopSigFinishWork), now configurable in Systems/WorkloadManagement//JobWrapper as well as per job in the JDL. CHANGE: StopSigStartSeconds and StopSigFinishSeconds are replaced by StopSigStartWork and StopSigFinishWork, expressed in CPU work.
CHANGE: new "Allocated time management" page in the Administrator Guide.

ENDRELEASENOTES

…slot

The JobAgent advertised the whole of the remaining slot to the matcher and published it
in /LocalSite/CPUTimeLeft, but the payload never got all of it: the JobWrapper still has
to upload the outputs and the logs once the payload stops, and the Watchdog was quietly
holding StopMargin back at the far end for that. Nothing upstream knew. A job whose
declared CPUTime just fits the slot is matched into it and then killed before it
finishes, and an elastic payload sizing itself against /LocalSite/CPUTimeLeft
over-commits by the same margin. Either way the work done so far is lost, never having
been uploaded.

Take the margin off once, in JobAgent.initialize(), where the slot enters the agent.
Every later use of it -- the filling-mode check, the CPU work advertised to the matcher,
/LocalSite/CPUTimeLeft and so the payload itself -- then works from what a payload may
actually consume, without any of them knowing a reserve exists. The Watchdog no longer
deducts it, the budget it reads being already net, and stops the payload when that
budget is spent. PushJobAgent is left alone: it post-processes on the server, so its
remote allocation runs the payload and nothing else.

Restore the graceful stop, on that same budget. A payload killed at the end of its
budget loses whatever it had produced but not written; an event generator stopped
mid-event loses the whole file. The JDL options for this are still parsed, but the code
behind them went with MJF in 1968c85 and nothing has sent the signal since. The slot
budget is a better clock than MJF was: it is the one __checkTimeLeft already counts down,
so the warning and the hard stop cannot disagree. StopSigRegex also matches the command
line again, as it did before 0e67f78, so the application is signalled rather than the
shells and wrappers sharing its process tree -- and only within this JobWrapper's own
descendants, so other jobs on the node are untouched however well they match.

Both thresholds are now in CPU work rather than seconds: StopSigStartWork and
StopSigFinishWork replace StopSigStartSeconds and StopSigFinishSeconds. How much work a
payload has done, and how much it needs to stop, are questions about computation, and the
same computation costs more wall clock on a slower node -- so one figure means the same
thing across a heterogeneous fleet where a figure in seconds does not. StopSigFinishWork
has no default, leaving the graceful stop off until a value is given; StopSigStartWork
defaults to it, so a payload is never stopped having done less work than stopping it
costs. All the options may now be set in the CS as well as per job, since a JDL is fixed
at submission and cannot reach work already in the system.

Unchanged for any job that does not ask: the signal is sent only where StopSigRegex and
StopSigFinishWork are both set, and only once. Deleted along the way are
wallClockCheckSeconds and wallClockCheckCount, which throttled reading MJF's files from
disk and have nothing left to throttle.

Documented in a new Allocated time management page: where the budget comes from and in
which units, who may spend which part of it, and how to measure the values rather than
guess them.

BEGINRELEASENOTES

*WorkloadManagement
FIX: the JobAgent reserves the JobWrapper's StopMargin before advertising the slot to the
matcher and publishing it in /LocalSite/CPUTimeLeft, so that jobs are neither matched nor
sized against time the post-processing will need. The Watchdog no longer deducts it a
second time.
NEW: the Watchdog can again signal a payload to wind down before its budget runs out
(StopSigRegex, StopSigNumber, StopSigStartWork, StopSigFinishWork), now configurable in
Systems/WorkloadManagement/<INSTANCE>/JobWrapper as well as per job in the JDL.
CHANGE: StopSigStartSeconds and StopSigFinishSeconds are replaced by StopSigStartWork and
StopSigFinishWork, expressed in CPU work.
CHANGE: new "Allocated time management" page in the Administrator Guide.

ENDRELEASENOTES

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MXoFjUCdmqT3oP6FEwc8K7
@aldbr
aldbr marked this pull request as draft August 25, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Follow up] Time management after #8416

1 participant