Reputation: 621
How do I set it so that the dependent tasks are run in parallel (instead of sequentially) to reduce the overall execution time
The problem is that both these independent tasks talk to different API systems to get it's input (sometimes taking several seconds to execute)
What I am noticing is that the order of the celery task in the group statement matters:
.
@celery.task(name='master_task')
def process_chain(symbol):
# g = group(get_latest_close_price.s(symbol), option_chain.s(symbol))
g = group(option_chain.s(symbol), get_latest_close_price.s(symbol))
results = g()
with result.allow_join_result():
data = results.get()
data = util_transform_option_chain(data[1], data[0])
return({'result':data})
Upvotes: 0
Views: 1138