Add persistent pause/resume queue - #1595
Open
art321ur wants to merge 2 commits into
Open
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (20)
📝 WalkthroughWalkthroughChangesQueue pause and resume
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant JobManager
participant QueuePauseStore
participant QueueResumedTrigger
participant Worker
JobManager->>QueuePauseStore: Resume queue and delete pause key
QueuePauseStore->>QueueResumedTrigger: Emit queue_resumed event
QueueResumedTrigger->>Worker: Notify queue resumed
Worker->>JobManager: Fetch newly available job
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Author
|
Let me know if I should change or improve anything - PR description, docs etc- first time trying to contribute to OSS ;) |
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.
Why
When we are using procrastinate, we found that sometimes a queue needs to stop temporarily (to allow other non-procrastinate services do some maintenance or allow them to use limited resources that procrastinate queue would consume).
Today the only options are to stop the worker (which also stops every other queue) or to let the jobs run and fail. This PR adds a way to pause one queue and leave the rest of the queues working.
I have tried to work around it (in simplified setup) in our codebase but the only way to solve this was to have some hacky
fetch_jobinterception.How
a worker restart
procrastinate_fetch_job_v3is a copy of_v2with one extra predicate that skips jobs whose queue has arow
"default"if not given). A queue stays paused until every key is released, so two independent processes (for example a deploy script and a maintenance task) can pause the same queue without one resuming the other by mistakepaused_atcolumn could be used for thatMigrations
03.10.00_01_pre_add_queue_pause.sql03.10.00_50_post_add_queue_pause.sqlSuccessful PR Checklist:
docs/howto/advanced/pause_queue.md.PR label(s):
Summary by CodeRabbit
New Features
Documentation