Critical task, delay all another tasks
mmmcorpsvit opened this issue · 2 comments
mmmcorpsvit commented
I have very important task when all another must tasks must delay (after him finish) run critical task and resume normal thread loop.
How this can be implemented?
P.S. sorry my English
azhard4int commented
@mmmcorpsvit You can use sorted tasks and set the priority for the critical tasks higher. This way, your critical tasks will be processed first and other tasks later on.
sylvinus commented
You can also pass multiple queues to a worker:
$ mrq-worker highpriority lowpriority
This will start a single-process, single-greenlet worker with 2 queues.
If instead you want to have multiple workers/processes with strict priorities, meaning a single task interrupting many low priority ones you will have to implement a lock in your task code!