I am using Django in Heroku, and in my site I send batch emails every month through Celery. Since I only use this worker once a month, I don’t want to pay for it all the time. I can stop the worker using a heroku scale workers=0 and scale it back up with heroku scale workers=1 manually before and after I send my emails.
However since other non-techinical staff will sending email from django as well, they can not run these commands. Can I stop a worker by executing a command from Python in my Heroku web process? I could execute any commands before sending email.
There is a bug with heroku.py see issues: https://github.com/heroku/heroku.py/issues/10 and https://github.com/heroku/heroku.py/issues/4
I made a quick work around, which uses the http resource directly: