1

RQ provides a .work(burst=True) method for its workers that are well-suited for integration tests, when you have code that enqueue's a task and then wants that task to be run synchronously.

I cannot find any functionality on Celery that works like that. Please help!

fiatjaf
  • 11,479
  • 5
  • 56
  • 72

1 Answers1

0

There is no burst mode in celery, but there is a CELERY_ALWAYS_EAGER option for testing:

CELERY_ALWAYS_EAGER

If this is True, all tasks will be executed locally by blocking until the task returns. apply_async() and Task.delay() will return an EagerResult instance, which emulates the API and behavior of AsyncResult, except the result is already evaluated.

That is, tasks will be executed locally instead of being sent to the queue.

http://docs.celeryproject.org/en/3.1/configuration.html#celery-always-eager

Community
  • 1
  • 1
gushitong
  • 1,898
  • 16
  • 24