In Celery, I want to start a task only when all the other tasks have completed. I found some resources like this one : Celery Starting a Task when Other Tasks have Completed and Running a task after all tasks have been completed But I am quite new to celery and could not really understand the above (or many other resources for that matter).
So I have defined a task as so in a tasks.py:
@celapp.task()
def sampleFun(arg1, arg2, arg3):
# do something here
and I call it as this :
for x in xrange(4):
tasks.sampleFun.delay(val1, val2, val3)
And I assume that there would be 4 different tasks created. This actually happens as I can see the same on the web interface of Celery Flower.
Now what I would like to do is, have another task added. Say finalTask that should start only once all the above 4 tasks have completed their execution.
I also read some doc on groups and chords in Celery but it says that if I want to do it I need to group my tasks together so they get executed in parallel. I don't want to do that. (Might be a good idea, but right now my goal is to be able to understand things. So am not really focussed on performance etc. at this point in time)
How to do this? Another more basic question which might sound rather stupid is : When we say
tasks.sampleFun.delay
does it create asynchronous tasks or not ?