I have a parent task that will spawn an arbitrary and potentially quite large number of subtasks. Once the parent and all the subtasks are complete, I need to set a flag in my database to indicate that it is ready. How am I best to do this?
For instance:
@task()
def master_task(foo):
foo_obj = Foo.objects.get(id=foo)
for bar in foo_obj.bar_set.all():
more_work.delay(bar.id)
@task()
def more_work(bar):
bar_obj = Bar.objects.get(id=bar)
do_work()
I need to determine when master_task and all the subtasks that it has completed are complete, so that I can set a flag in the corresponding model to indicate that everything is ready
source
share