Skip to content

Commit

Permalink
back out PreKill changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Dec 2, 2021
1 parent 25fbf9f commit 0996798
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion client/allocrunner/alloc_runner_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ func (ar *allocRunner) preKillHooks() {
ar.logger.Trace("running alloc pre shutdown hook", "name", name, "start", start)
}

pre.PreKill(ar.alloc)
pre.PreKill()

if ar.logger.IsTrace() {
end := time.Now()
Expand Down
8 changes: 4 additions & 4 deletions client/allocrunner/groupservice_hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,18 @@ func (h *groupServiceHook) PreTaskRestart() error {
h.mu.Unlock()
}()

h.preKillLocked(nil)
h.preKillLocked()
return h.prerunLocked()
}

func (h *groupServiceHook) PreKill(alloc *structs.Allocation) {
func (h *groupServiceHook) PreKill() {
h.mu.Lock()
defer h.mu.Unlock()
h.preKillLocked(alloc)
h.preKillLocked()
}

// implements the PreKill hook but requires the caller hold the lock
func (h *groupServiceHook) preKillLocked(alloc *structs.Allocation) {
func (h *groupServiceHook) preKillLocked() {
// If we have a shutdown delay deregister group services and then wait
// before continuing to kill tasks.
h.deregister()
Expand Down
2 changes: 1 addition & 1 deletion client/allocrunner/interfaces/runner_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type RunnerPrerunHook interface {
type RunnerPreKillHook interface {
RunnerHook

PreKill(*structs.Allocation)
PreKill()
}

// RunnerPostrunHooks are executed after calling TaskRunner.Run, even for
Expand Down
4 changes: 1 addition & 3 deletions command/alloc_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ Stop Specific Options:
Ignore the the group and task shutdown_delay configuration so there is no
delay between service deregistration and task shutdown. Note that using
this flag will result in failed network connections to the allocation
being stopped. Also note that an allocation that is already waiting for
the shutdown_delay will not be interrupted by running alloc stop again with
this flag.
being stopped.
-verbose
Show full information.
Expand Down
6 changes: 2 additions & 4 deletions command/job_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ Stop Options:
-no-shutdown-delay
Ignore the the group and task shutdown_delay configuration so there is no
delay between service deregistration and task shutdown. Note that using
this flag will result in failed network connections to the allocation
being stopped. Also note that an allocation that is already waiting for
the shutdown_delay will not be interrupted by running job stop again with
this flag.
this flag will result in failed network connections to the allocations
being stopped.
-purge
Purge is used to stop the job and purge it from the system. If not set, the
Expand Down
4 changes: 1 addition & 3 deletions website/content/docs/commands/alloc/stop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ allocation's namespace.
Ignore the the group and task [`shutdown_delay`] configuration so
there is no delay between service deregistration and task
shutdown. Note that using this flag will result in failed network
connections to the allocation being stopped. Also note that an
allocation that is already waiting for the `shutdown_delay` will not
be interrupted by running `alloc stop` again with this flag.
connections to the allocation being stopped.

## Examples

Expand Down
4 changes: 1 addition & 3 deletions website/content/docs/commands/job/stop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ When ACLs are enabled, this command requires a token with the `submit-job`,
Ignore the the group and task [`shutdown_delay`] configuration so
there is no delay between service deregistration and task
shutdown. Note that using this flag will result in failed network
connections to the allocation being stopped. Also note that an
allocation that is already waiting for the `shutdown_delay` will not
be interrupted by running `job stop` again with this flag.
connections to the allocations being stopped.

## Examples

Expand Down

0 comments on commit 0996798

Please sign in to comment.