You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GitHub issues are for bugs. If you have questions, please ask them on the discussion board.
Checklist
Does your title concisely summarize the problem?
Did you include a minimal, reproducible example?
What OS are you using?
What version of Dramatiq are you using?
What did you do?
What did you expect would happen?
What happened?
What OS are you using?
macOS 11.6
What version of Dramatiq are you using?
1.11.0
What did you do?
I tried to send a prioritized message in this way:
import dramatiq
import time
import random
@dramatiq.actor(priority=0)
def high_priority_task(n: int):
print(f"Starting order {n}")
time.sleep(5)
print(f"Ending order {n}")
@dramatiq.actor(priority=10)
def low_priority_task(n: int):
print(f"Starting order {n}")
time.sleep(5)
print(f"Ending order {n}")
if __name__ == "__main__":
for n in range(20):
if n == 10:
high_priority_task.send(n)
else:
low_priority_task.send(n)
Broker: RabbitMQ
To ensure a bottleneck, I started a worker with 1 process and 1 thread.
What did you expect would happen?
I expected that order 10 would be prioritized and processed earlier.
What happened?
All orders get processed sequentially.
The text was updated successfully, but these errors were encountered:
I ran into this problem with the Redis broker, as the priorities only apply to pre-fetched tasks pulled down on an individual worker. There might be a way to get this to work with RabbitMQ - #412.
If anybody were to make a "global" priority work with Redis I'd love to know about it! Our current solution is to have separate queues, "default" and "high_priority" configured per-actor.
Looks like Celery provides this with a redis backend by splitting multiple queues: see a SO question and the redis docs. There's also an implementation using sorted sets which could possibly be used.
I unfortunately don't think I have time to set up a "global" priority queue, but would you welcome a doc change that says priority is only implemented in the rabbitmq broker right now?
@kastman - Yes, a doc change would be quite helpful (perhaps pointing to separate queues as a Redis workaround), as I spent a bit of time determining that Redis backend didn't actually support global priority (and I'm sure others have/will too).
I understand developer time is limited, and am grateful for this project!
Issues
GitHub issues are for bugs. If you have questions, please ask them on the discussion board.
Checklist
What OS are you using?
macOS 11.6
What version of Dramatiq are you using?
1.11.0
What did you do?
I tried to send a prioritized message in this way:
Broker: RabbitMQ
To ensure a bottleneck, I started a worker with 1 process and 1 thread.
What did you expect would happen?
I expected that order
10
would be prioritized and processed earlier.What happened?
All orders get processed sequentially.
The text was updated successfully, but these errors were encountered: