Skip to content

getJobs: refuse new dispatch to a worker that has already ended - #844

Merged
tmaeno merged 1 commit into
PanDAWMS:masterfrom
wenaus:refuse-dispatch-to-terminal-worker
Oct 30, 2026
Merged

tmaeno merged 1 commit into
PanDAWMS:masterfrom
wenaus:refuse-dispatch-to-terminal-worker

Conversation

@wenaus

@wenaus wenaus commented Oct 30, 2026

Copy link
Copy Markdown
Member

getJobs attaches a selected job to the requesting worker through updateWorkers, which keeps a recent terminal worker state. A job can therefore be dispatched to a worker already recorded as finished, failed, cancelled or missed, and stay attached to a parent that never runs it. After an HTCondor schedd outage on an OSG queue, 348 active jobs were found attached to cancelled workers.

The worker row is now locked in the dispatch transaction (SELECT ... FOR UPDATE) before any candidate job is changed, and new work is refused when the worker is terminal. Jobs already returned in the response are kept. Requests without a Harvester worker, and workers not yet registered, are unchanged.

Running on the ePIC PanDA server at BNL since 2026-10-25.

🤖 Generated with Claude Code

getJobs attaches a selected job to the requesting worker through
updateWorkers, which keeps a recent terminal worker state. A job could
therefore be dispatched to a worker already recorded as finished,
failed, cancelled or missed, and stay attached to a parent that never
runs it. On an OSG queue, 348 active jobs were found attached to
cancelled workers after an HTCondor schedd outage.

Lock the worker row in the dispatch transaction before any candidate
job is changed, and refuse new work when the worker is terminal. Jobs
already returned in the response are kept. Requests without a
Harvester worker, and workers not yet registered, are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 30, 2026 10:37
@tmaeno
tmaeno merged commit 3d407f2 into PanDAWMS:master Oct 30, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The worker lock can block dispatch past its request deadline, allowing a job to be marked sent after the budget expires.

1 open issue
What changed in this PR

This PR updates getJobs to prevent new jobs from being attached to Harvester workers already recorded as terminal, reducing the risk of jobs remaining assigned to workers that cannot run them.

Changes:

  • Locks the worker row before modifying a candidate job.
  • Rejects dispatch to finished, failed, cancelled, or missed workers while preserving jobs already collected.
  • Adds an explicit type annotation to the returned job list.
File Description
pandaserver/​taskbuffer/​db_proxy_mods/​job_complex_module.py Adds the transactional worker-status guard and types the accumulated job list.

Review effort: Balanced

if harvester_id is not None and worker_id is not None:
self.cur.execute(
"SELECT status FROM ATLAS_PANDA.Harvester_Workers "
"WHERE harvesterID=:harvesterID AND workerID=:workerID FOR UPDATE" + comment,
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.

3 participants