Skip to content

Commit

Permalink
Merge branch 'master' into f-ui/alloc-fs
Browse files Browse the repository at this point in the history
* master:
  make purge parameter lowercase (#5895)
  tr: Fetch Wait channel before killTask in restart
  • Loading branch information
DingoEatingFuzz committed Jul 2, 2019
2 parents ee07bab + 65fe89f commit c2e782b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions client/allocrunner/taskrunner/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ func (tr *TaskRunner) Restart(ctx context.Context, event *structs.TaskEvent, fai
// Tell the restart tracker that a restart triggered the exit
tr.restartTracker.SetRestartTriggered(failure)

// Grab a handle to the wait channel that will timeout with context cancelation
// _before_ killing the task.
waitCh, err := handle.WaitCh(ctx)
if err != nil {
return err
}

// Kill the task using an exponential backoff in-case of failures.
if err := tr.killTask(handle); err != nil {
// We couldn't successfully destroy the resource created.
tr.logger.Error("failed to kill task. Resources may have been leaked", "error", err)
}

// Drain the wait channel or wait for the request context to be canceled
waitCh, err := handle.WaitCh(ctx)
if err != nil {
return err
}

select {
case <-waitCh:
case <-ctx.Done():
Expand Down
2 changes: 1 addition & 1 deletion website/source/api/jobs.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ The table below shows this endpoint's support for
- `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
the job file during submission). This is specified as part of the path.

- `Purge` `(bool: false)` - Specifies that the job should stopped and purged
- `purge` `(bool: false)` - Specifies that the job should stopped and purged
immediately. This means the job will not be queryable after being stopped. If
not set, the job will be purged by the garbage collector.

Expand Down

0 comments on commit c2e782b

Please sign in to comment.