简体   繁体   中英

is there a way of running celery worker in debug mode; much like flask debug?

  • I find myself having to manually restart celery worker whenever I make a change to the task source code
  • Is there a faster way of coding/debugging celery tasks?
  • Something similar to how flask can be run in DEBUG=1 mode; where changes in the HTML and routes are automatically reloaded
  • I am currently running celery worker in a docker container with the following command:

celery worker -l info -A celery_tasks.app -n celery_worker -B

There is nothing built in but you can use the watchmedo utility from watchdog which monitors a directory for file changes and allows you to restart your worker.

You just need to install it with pip :

pip install watchdog[watchmedo]

And run:

watchmedo auto-restart --directory=./ --pattern="*.py" --recursive -- celery worker -l info -A celery_tasks.app -n celery_worker -B

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