Is it possible to destroy a job after it has been executed. For example when using the job to run migrations for the service. This job will be executed before the deployment so after the deployment this job will do nothing. Can I configure something that this job will be destroyed after it’s been executed to reduce the costs of hosting?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
When you create a job to run migrations or any other task, the job will run to completion and then automatically stop.
I believe that you won’t be billed for the time the job is not running, as the billing is based on the actual usage of resources during the job execution.
You don’t need to manually destroy the job after it has been executed, as the platform will take care of stopping the job once it’s completed.
If you prefer not to have the job at all, what I personally have been doing is adding my migrations command right before my run command separated with a
;
, here is an example of how to do that with Laravel but it should be similar for other frameworks as well:https://github.com/thedevdojo/wave/blob/main/.do/deploy.template.yaml#L9
Hope that this helps!
Best,
Bobby