Open tashimi opened 6 years ago
Additionally, when the Supervisor shuts down, it should pass the exit code from its child as it's own exit code.
Just to clarify, do we mean running a "supervisor service" that has an intentionally terminating run hook? Or would this specifically start its own supervisor to run a new "job" primitive?
@mwrock This would probably be a "run this package until it exits successfully, and then stop".
Right now, the Supervisor will continually restart a service if it exits successfully.
This also would mean that the things the Supervisor can run now are not necessarily "services" (i.e., long running daemon-like processes), but also "jobs".
ok that makes sense. I love the idea. I have had a couple times where I thought a hab pkg exec
could get a job done and then I remember "oh no handlebars or binds." Foe example a one off DB migration job.
👍
Perhaps there should be a flag that user can sethab start —run_once some/pkg
? Or allow the the pkg owner to set a flag that tells the supervisor that the process is finished doing work.
@bdangit Agreed; we can probably take some inspiration from Erlang supervisor restart strategies:
restart defines when a terminated child process is to be restarted.
A permanent child process is always restarted.
A temporary child process is never restarted (not even when the supervisor restart strategy is rest_for_one or one_for_all and a sibling death causes the temporary process to be terminated).
A transient child process is restarted only if it terminates abnormally, that is, with an exit reason other than normal, shutdown, or {shutdown,Term}.
The restart key is optional. If it is not given, the default value permanent will be used.
Confirmed valid in v0.57
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.
We should add the ability for the Habitat Supervisor to start up, run a job, and then exit and shut down.
This has come up in a couple different scenarios, including build jobs in a Jenkins/Concourse pipeline and running as a test scenario in a High Performance Computing (HPC) cluster with Singularity.