5

I have a group object. I wan't to wait until all of the tasks finish and print their results. This is my code:

tasks = [my_task.s(some_val=val).set(queue='different_q') for val in val_list]
job = group(tasks)
job_result = job.apply_async()
results = job_result.get()

If everything goes as expected then in results i get

[val1, val2, val3]

But if one of the tasks throws an exception, the job_result.get() throws an exception. I know in chord i can propagate the exception but i can't find the proper way to do so in group.
This is the wanted result:

[val1, Exception('some exception'), val3]

and that the job_result.get() won't throw an exception.

Mr T.
  • 4,278
  • 9
  • 44
  • 61

0 Answers0