简体   繁体   中英

celery chain is not triggering second task

I have two celery Tasks which should be run in strict order.

def celery_run_tasks():
    chain(task_one.s(arg1, arg2), task_two.s(arg1, arg2)).apply_async()

So, first task taking 2 Arguments and in the end Populating some data to PostgreSQL table. After that second task should Start, get data from FIRST table , generate new calculations and post them to SECOND PostgreSQL table.

The problem what I see with my code that its populating all data to first table, but second one is empty. I tried different variations with Chord and Groups and its still does not work.

Let me know what you think and Please be specific. Thank you.

PS I did check Celery documentation!, please don't just post link to it.

So issue was that first task was sending result of it to second task as first argument. So my second task receive 3 arguments instead of two and give error. To avoid it make second task as si which mean not accept any arguments from previous tasks and it will work:

def celery_run_tasks():
    chain(task_one(arg1, arg2), task_two.si(arg1, arg2)).apply_async()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM