0
@celery.tasks
def a():
   time.sleep(2)
   print 'aaa'

@celery.tasks
def b():
   time.sleep(2)
   print 'bbb'

Now I want when celery take task-a and task-b at the same time, task-a execute first, and then the task-b should execute after task-a. DOes celery allow this happend?

no13bus
  • 347
  • 1
  • 4
  • 15
  • 1
    See this: http://stackoverflow.com/a/12034239/89435 – mavroprovato Nov 19 '14 at 15:29
  • possible duplicate of [Running "unique" tasks with celery](http://stackoverflow.com/questions/4095940/running-unique-tasks-with-celery) – Chillar Anand Nov 20 '14 at 05:01
  • @mavroprovato thanks a lot. I use `chain` like this: `@celery_app.task def c(): ret = chain(a.s(), b.s()).apply_async() print 'ccccc'` but there is error:`raised unexpected: TypeError('b() takes no arguments (1 given)',)`. If task a and b does not have arguments, how to handle this situation? – no13bus Nov 26 '14 at 16:24
  • @ChillarAnand thanks very much. Now I have another question, maybe it have some relation to your answer. http://stackoverflow.com/questions/26352863/i-use-celery-to-simultaneously-execute-my-tasks-but-it-maybe-happened-race-cond – no13bus Nov 28 '14 at 05:00

0 Answers0