-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Celery doesn't auto reload in development #3898
Conversation
Worth adding a link to the Celery issue you mentioned on Slack. |
Yeah, it seems that native autoreload in Celery was dropped in 3.1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments and... did you check that Flask still reloads after adding watchdog
? :)
bin/docker-entrypoint
Outdated
@@ -14,10 +14,14 @@ scheduler() { | |||
WORKERS_COUNT=${WORKERS_COUNT:-1} | |||
QUEUES=${QUEUES:-celery} | |||
SCHEDULE_DB=${SCHEDULE_DB:-celerybeat-schedule} | |||
if [[ -n "$AUTO_RELOAD" ]]; then | |||
WATCHER="watchmedo auto-restart --directory=./ --pattern=*.py --recursive --" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe only watch the code library (redash/
) so it doesn't reload on tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add a new entrypoint for dev-celery to avoid any confusion or issues that might result here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course :) It does. |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of your project's GitHub integration settings. You can manage this integration in your project's settings in the Cypress Dashboard |
bin/docker-entrypoint
Outdated
@@ -41,6 +51,7 @@ help() { | |||
echo "server -- start Redash server (with gunicorn)" | |||
echo "worker -- start Celery worker" | |||
echo "scheduler -- start Celery worker with a beat (scheduler) process" | |||
echo "dev_scheduler -- start Celery worker with a beat (scheduler) process which picks up code changes and reloads" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's name this dev_worker
as it better describes what it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bin/docker-entrypoint
Outdated
@@ -20,6 +20,16 @@ scheduler() { | |||
exec /usr/local/bin/celery worker --app=redash.worker --beat -s$SCHEDULE_DB -c$WORKERS_COUNT -Q$QUEUES -linfo --max-tasks-per-child=10 -Ofair | |||
} | |||
|
|||
dev_scheduler() { | |||
WORKERS_COUNT=${WORKERS_COUNT:-1} | |||
QUEUES=${QUEUES:-celery} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have a dedicated dev worker entrypoint, we can have defaults that are inline with it:
WORKERS_COUNT = 2
QUEUES = "queries,scheduled_queries,celery,schemas"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restarting Celery workers manually is no longer a thing after getredash/redash#3898
Restarting Celery workers manually is no longer a thing after getredash/redash#3898
* pick up *.py file changes and restart scheduler * only watch /redash in order to avoid reloading on other file changes (e.g. tests) * add dev_scheduler entrypoint * use exec * Update bin/docker-entrypoint * rename dev_scheduler to dev_worker * use same defaults as worker
Issue Summary
Using the standard Docker development setup, it seems that code changes are not picked up by
redash-worker
.Steps to Reproduce
docker-compose up
Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?
Technical details: