Ho un'attività genitore che genera un numero arbitrario e potenzialmente più grande di attività secondarie. Una volta completati sia il genitore che tutti i sottoattività, ho bisogno di impostare un flag nel mio database per indicare che è pronto. Come farei meglio a farlo?Rilevamento quando un'attività celery e tutte le attività secondarie sono state completate
Ad esempio:
@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()
ho bisogno di rilevare quando il master_task e tutte le attività secondarie che ha spawn hanno completato in modo da poter impostare un flag su un modello relativo per indicare che tutto è pronto
Si noti che "TaskSet è stato rimosso, in quanto è stato sostituito dal costrutto di gruppo in Celery 3.0." – np8