feat(worker): detect stuck RUNNING jobs via progress heartbeat#790
Merged
bencap merged 1 commit intoJul 9, 2026
Merged
Conversation
11 tasks
Replace the pure wall-clock RUNNING-stall check with a progress heartbeat, so a healthy long-running job (e.g. large VEP fan-out) is no longer killed while a genuinely wedged one is still caught. Make the DB-driven sweeper authoritative over termination and keep ARQ's timeout only as a last resort. - Add JobRun.progress_updated_at (onupdate=now()) as a zero-code liveness heartbeat, bumped on every committing progress checkpoint; index (status, progress_updated_at) for the sweeper query - Detect stalled RUNNING jobs on stale heartbeat (PROGRESS_STALL_MINUTES = 20) OR a wall-clock backstop (RUNNING_TIMEOUT_MINUTES = 450), and recover them abort-first: abort the current attempt and only re-drive once it is confirmed dead or absent, eliminating the double-run where a retry ran alongside the still-live original - Handle asyncio.CancelledError in with_job_management: mark the row FAILED/TIMEOUT then re-raise, so an ARQ timeout or a stall-recovery abort no longer orphans the row as RUNNING and Job.abort() can confirm - Raise ARQ job_timeout to 8h and enable allow_abort_jobs; tighten the cleanup cron to every 10 minutes - Cover new behavior with unit and integration tests
2f511bf to
9f10350
Compare
Coverage Report for CI Build 29040562747Warning No base build found for commit Coverage: 89.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the pure wall-clock RUNNING-stall check with a progress heartbeat, so a healthy long-running job (e.g. large VEP fan-out) is no longer killed while a genuinely wedged one is still caught. Make the DB-driven sweeper authoritative over termination and keep ARQ's timeout only as a last resort.