Deploy python worker to heroku without running immediatly

Question:

I have a simply python script that I deploy on Heroku as worker:

Procfile:

worker: python main.py

The script is scheduled to run every day at a specific time with the Heroku Scheduler. I don’t want it to run to other times.

Every time I push new changes to heroku (git push heroku master) the script is run automatically which I want to avoid.

How can I do that?

I looked into using another scheduler, that is set up from within the script like the APScheduler. Would this be a solution? Do I need to change my script?

Thanks!

Asked By: smaica

||

Answers:

You can scale the worker dyno formation down to zero:

If you want to stop running a particular process type entirely, simply scale it to 0

So:

heroku ps:scale worker=0

Jobs scheduled via Heroku Scheduler should still run as configured.

Answered By: Chris