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

Should we replace Celery with Heroku scheduler? #326

Closed
bfirsh opened this issue Jan 21, 2019 · 5 comments · Fixed by #365
Closed

Should we replace Celery with Heroku scheduler? #326

bfirsh opened this issue Jan 21, 2019 · 5 comments · Fixed by #365

Comments

@bfirsh
Copy link
Member

bfirsh commented Jan 21, 2019

Celery is only used to run scheduled tasks (sending emails, etc) and is not used to run any background tasks.

Now we are moving to Heroku, we could use the Heroku Scheduler to run these tasks instead of Celery.

Advantages:

  • Cheaper (permanent celery dyno is $25/mo, scheduler will cost pennies)
  • We don't have to upgrade Celery to 4.x (currently uses Celery 3 which doesn't work with Django 1.11)
  • Less complexity (Celery has a lot of moving parts and breaks)

Disadvantages:

  • Means we would have to add back Celery in the future if we want to use it for anything (but it's not even working at the moment so that doesn't seem like much extra work...)
  • A little bit of work to migrate the Celery tasks to management commands
  • Ties us to Heroku?
  • Scheduler commands are configured in the web UI instead of being committed to repo, which is annoying
@jonathan-s
Copy link
Collaborator

I think I'd vote for using the heroku scheduler. Right now the advantages seem to weigh over.

@jessykate
Copy link
Member

Since the tasks themselves would still be in code, i don't mind too much that the schedule is defined outside the repo, and makes it easier to move to a different scheduler in the future if we want.

We could also choose to document the scheduling in the repo in a config directory of some kind, but it might get stale if it's not actually used programmatically.

@jonathan-s
Copy link
Collaborator

jonathan-s commented Feb 4, 2019

@bfirsh @jessykate, I looked up the heroku scheduler. It's very coarse; every 10 minutes, every hour, daily. That's it. Perhaps it'd be better to use this method instead -> https://devcenter.heroku.com/articles/clock-processes-python

Though that still requires one worker... so it's not saving any money (or perhaps it's saving some? Right now it looks like there is one worker for celeryd). But it would reduce any complexity as it would be more like a normal cronjob.

@jessykate
Copy link
Member

We actually have pretty light weight scheduling needs. I haven't looked at the various options but the heroku scheduler seems like it would save us a good $25 or $50/mo 😮 ! I'm kind of keen on that since MN doesn't make very much and i'd rather spend it on humans doing dev work if we have the option?? :)

@bfirsh
Copy link
Member Author

bfirsh commented Feb 5, 2019

Yeah we don't need fine grained scheduing. The only thing that is run is sending out emails in the morning, and a weekly one too (which can be done with if day == sunday in the daily one).

The clock process they describe is effectively what Celery is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants