Skip to content

Commit

Permalink
added an explicit example of task-specific restart policy
Browse files Browse the repository at this point in the history
  • Loading branch information
cgbaker committed Apr 13, 2020
1 parent c564811 commit 1b8a540
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions website/pages/docs/job-specification/restart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ description: The "restart" stanza configures a group's behavior on task failure.
/>

The `restart` stanza configures a tasks's behavior on task failure. Restarts
happen on the client that is running the task. If specified at the group level,
the configuration will apply to all tasks within the group.
happen on the client that is running the task.

```hcl
job "docs" {
Expand All @@ -29,6 +28,35 @@ job "docs" {
}
```

If specified at the group level, the configuration is inherited by all
tasks in the group. If present on the task, the policy is merged with
the restart policy from the encapsulating task group.

For example, assuming that the task group restart policy is:
```hcl
restart {
interval = "30m"
attempts = 2
delay = "15s"
mode = "fail"
}
```
and the individual task restart policy is:
```hcl
restart {
attempts = 5
}
```
then the effective restart policy for the task will be:
```
restart {
interval = "30m"
attempts = 5
delay = "15s"
mode = "fail"
}
```

## `restart` Parameters

- `attempts` `(int: <varies>)` - Specifies the number of restarts allowed in the
Expand Down

0 comments on commit 1b8a540

Please sign in to comment.