Skip to content
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

Merged
merged 9 commits into from
Jul 17, 2019
Merged

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Jun 12, 2019

Issue Summary

Using the standard Docker development setup, it seems that code changes are not picked up by redash-worker.

Steps to Reproduce

  1. Start docker-compose up
  2. Wreak havoc on some Python file.
  3. Everything works!

Any other info e.g. Why do you consider this to be a bug? What did you expect to happen instead?

Technical details:

  • Redash Version:
  • Browser/OS:
  • How did you install Redash:

@arikfr
Copy link
Member

arikfr commented Jun 12, 2019

Worth adding a link to the Celery issue you mentioned on Slack.

@rauchy
Copy link
Contributor Author

rauchy commented Jun 12, 2019

Yeah, it seems that native autoreload in Celery was dropped in 3.1.

@rauchy rauchy requested a review from arikfr June 12, 2019 08:56
Copy link
Member

@arikfr arikfr left a 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? :)

docker-compose.yml Show resolved Hide resolved
@@ -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 --"
Copy link
Member

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?

Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See efef063 and df2eb1d.

@rauchy
Copy link
Contributor Author

rauchy commented Jun 13, 2019

did you check that Flask still reloads after adding watchdog? :)

Of course :) It does.

@rauchy rauchy requested a review from arikfr June 13, 2019 10:01
@cypress
Copy link

cypress bot commented Jun 13, 2019



Test summary

63 0 0 0


Run details

Commit df2eb1d
Started Jun 13, 2019 10:08 AM
Ended Jun 13, 2019 10:15 AM
Duration 07:03 💡
OS linux Debian - 8.10
Browser Electron 61.0.3163.100

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 Show resolved Hide resolved
bin/docker-entrypoint Outdated Show resolved Hide resolved
bin/docker-entrypoint Outdated Show resolved Hide resolved
@@ -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"
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -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}
Copy link
Member

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arikfr arikfr merged commit c83e40b into master Jul 17, 2019
@arikfr arikfr deleted the auto-reload-worker-in-dev branch July 17, 2019 07:39
rauchy pushed a commit to getredash/website that referenced this pull request Sep 8, 2019
Restarting Celery workers manually is no longer a thing after getredash/redash#3898
arikfr pushed a commit to getredash/website that referenced this pull request Sep 8, 2019
Restarting Celery workers manually is no longer a thing after getredash/redash#3898
harveyrendell pushed a commit to pushpay/redash that referenced this pull request Nov 14, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants