Skip to content

Commit

Permalink
client: run alloc pre-kill hooks on last pass despite no live tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
shoenig committed Jan 23, 2023
1 parent 43fa28a commit 27e6363
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions client/allocrunner/alloc_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,9 @@ func (ar *allocRunner) handleTaskStateUpdates() {
}
}

// kill remaining live tasks
if len(liveRunners) > 0 {

// if all live runners are sidecars - kill alloc
onlySidecarsRemaining := hasSidecars && !hasNonSidecarTasks(liveRunners)
if killEvent == nil && onlySidecarsRemaining {
Expand Down Expand Up @@ -586,6 +588,14 @@ func (ar *allocRunner) handleTaskStateUpdates() {
}
}
} else {
// there are no live runners left

// run AR pre-kill hooks if this alloc is terminal; any post-stop
// tasks would regularly run in this state anyway (?)
if done {
ar.preKillHooks()
}

// If there are no live runners left kill all non-poststop task
// runners to unblock them from the alloc restart loop.
for _, tr := range ar.tasks {
Expand Down

0 comments on commit 27e6363

Please sign in to comment.