I have tasks A and B in Celery. B is an antagonist for A. So, when this tasks run in parallel with same parameters, system becomes inconsistent. There is two questions:
Can I run tasks A and B always successively based on params? I want to run A with param 1 and B with param 1 successively, but A(1) and B(2) may run in parallel.
Is there a way to collapse repetitive sequences of tasks, that not yet running? Say, I have ABABAB tasks in broker (Redis in my case), can I just execute AB?
I tend to think that both of questions can be solved with advanced broker, but I would like to avoid RabbitMQ deploying.
Thanks in advance.
I decided to maintain separate queue for tasks in Redis. When I send new task to Celery, I also add it to Redis list. When task is running, it determines what it must do: A or B depends on current system state.
Solution does not look great, but I hope that will not cause problems.