'Django + Celery: How to run a task after subtasks from different scheduled Tasks are finished
I'm currently building a webapp with Django and Celery. I have one task (sometask) that adds an unknown number of other tasks(othertask) in a for loop to the queue. Now I don't understand how I can run another Task(task3) after sometask with all the subtasks are done.
I understand that you can chain tasks for example, but if I chain othertask to sometask it will run before the subtasks are done. Could someone please give me some input on how to get it done the way I described?
Example of my tasks.py
@shared_task(bind = True)
def sometask(self):
for whatever:
othertask.delay()
return "done"
@shared_task(bind = True)
def othertask(self):
pass
@shared_task(bind = True)
def task3(self):
pass
Celery.py:
app.conf.beat_schedule = {
'weekly':{
'task': 'webapp.tasks.sometask',
'schedule': crontab(minute=0, hour=23, day_of_week='sat'),
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
