How can a fully stop a Heroku dyno using the Heroku API so it doesn't restart?
I have Heroku set up to run a Python script that always loops and never exits to check sensors. This main.py script is run as a Dyno worker via my Procfile. Right now, it always runs as anticipated. It even restarts upon a crash, which is also helpful for this app.
Using the Heroku API, I would like to be able to completely stop this process. This won't be reoccurring often, just a failsafe kill-switch. I can stop the dyno worker by logging in to Heroku and clicking the edit button in the Resources tab and turn off the worker. But, I would like to turn off the worker via the API.
I have tried the following API calls (via Postman), which both stop the current process, but after a few seconds, Heroku starts the worker back up again.
Stop the current Dyno
POST https://api.heroku.com/apps/<app_id>/dynos/worker.1/actions/stop
Deletes / restarts all dynos in the app
DELETE https://api.heroku.com/apps/<app_id>/dynos
Also, I can put the app in to maintenance mode, but that only stops HTTP traffic, not the Dynos
PATCH https://api.heroku.com/apps/<app_id>
with payload of {"maintenance":true}
One option is completely deleting the app, but that's a bit too much for me as it will also remove all log files, and be a pain to set it back up again.
DELETE https://api.heroku.com/apps/<app_id>
Is there any way to completely stop a Dyno or app via the API until I manually start it back up again?