A Celery task queue to calculate result of (2 + 2) - 3.
@app.task()
def add(**kwargs):
time.sleep(5)
x, y = kwargs['add'][0], kwargs['add'][1]
return x + y
@app.task()
def sub(**kwargs):
time.sleep(5)
x = args[0]
y = kwargs['sub'][0]
return x - y
Sample task data = kwargs = {'add' : (2, 2), 'sub' : (3)}
Chaining the tasks: result = (add.s() | sub.s()).apply_async(kwargs = kwargs)
As per design, apply_async only applies the kwargs to the first task in the chain. What do I need to change to achieve the desired outcome?