简体   繁体   中英

How should celery pick tasks from database

I have python django web application. When user submits the request then i have to insert 10 rows in database , basically which are tasks that has to completed.

I can have function which gets those tasks and then celery can run those functions.

@shared_task
def provision(tasks):
    for tasks in tasks:
       pass

My problem is

  1. Some tasks i want o happen in sequqnce after other
  2. some tasks i want to happen in parallel
  3. IN case some tasks failed then i should be able to restart them

I am not sure how will celery help me on this

The Celery framework provides some workflow primitives that allows you run tasks in sequence ( chain ) or in parallel ( group ).

Celery also comes with a built-in retry mechanism .

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