Lets say we have a python web app using fastapi and celery(5.4). After the user request comes I want to execute celery task in this order
` a_si = get_dataA.si(…..)
b_si = get_dataB.si(…..)
c_si = get_dataC.si(…..)
b_r_si = build_relationship_B.si(...)
c_r_si = build_relationship_C.si(...)
chain_1 = chain(group(a_si, b_si), b_r_si) # if a_si, b_si already ran use the result otherwise execute it
chain_2 = chain(group(a_si, b_si, c_si), c_r_si) # if a_si, b_si already ran use the result otherwise execute it
group(chain_1, chain_2).apply_async()`
Here issue is a_si and b_si are getting called multiple time per API request. how can I make it run only once then use its result in chains
During Debug I came to know that its running multiple times, hot to make it run once
Abhinav Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.