Closed toti1212 closed 3 years ago
I would make sure the task is only enqueued once. Try to use the RMQ management plugin to see the contents of the queue and maybe make sure the task isn't failing and is being retried. If you can come up with a s mall example that reproduces the issue, I can take a look. By design, though, RMQ will not lease the same message to multiple workers.
Thanks for answer!
The problem was resolved and was not related to dramatiq
nor django_dramatiq
.
It seemed that the instance of django-apscheduler
was executed more than once with the initiated programmer (9 times, 8 in the Dramatiq
container, and 1 in another service, which is correct) by a .resume()
hidden, what made it start the processes at the Dramatiq container. Then, when the date arrived, the 9 workers woke up (not the only one who would want) and the workers of Dramatiq
tried to take those tasks to execute them, which caused repeated ones.
First of all thanks for this implementation!
I'm currently running on
docker-compose
on an 8 core instance (docker_serivce, dramatiq_service, rabbitmq_service, postgres_service, etc):django_apscheduler==0.5.2
dramatiq [rabbitmq, watch]==1.8.1
RabbitMQ (rabbitmq: 3.8-management-alpine image)
By default, I run the command
runramatiq
without specifying the number of threads or processes. I understand that it will take 8 by default (depending on the implementation)The bug is that I see is that many processes are executing the same task. The task is created only once, but several processes try to execute it, and some threads are the same between different processes.
Do you know why this could be happening? Does it have something to do with the number of threads and processes?
Here is an example. The job is in the queue once but when it's executed, many processes take it.
139698903181056
is the thread and21
the process