wait for jobs to complete when stopping the runner
When receiving a signal (INT or TERM) wait for running jobs to complete instead of terminating them right away. The new shutdown_timeout configuration setting can be used to force the termination after a grace delay. If not specified or zero it will shutdown immediately, for backward compatibility. It will be the case with existing configuration files or when a configuration file is not specified. The config.yml created with the generate-config subcommand will however default shutdown_timeout to 3h (same as timeout) because it is likely what a new admin would expect: shutting down waits for jobs to complete and not abort them.
This commit is contained in:
parent
a7ff3bb917
commit
e02e0fc5f5
7 changed files with 373 additions and 32 deletions
|
@ -41,6 +41,10 @@ type Runner struct {
|
|||
runningTasks sync.Map
|
||||
}
|
||||
|
||||
type RunnerInterface interface {
|
||||
Run(ctx context.Context, task *runnerv1.Task) error
|
||||
}
|
||||
|
||||
func NewRunner(cfg *config.Config, reg *config.Registration, cli client.Client) *Runner {
|
||||
ls := labels.Labels{}
|
||||
for _, v := range reg.Labels {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue