Skip to content

Commit bea9052

Browse files
authored
update restart documentation (#7603)
* update `restart` documentation #7288 added support for task-specific `restart` policy. this PR updates the docs to reflect that. * added an explicit example of task-specific restart policy * Update website/pages/docs/job-specification/restart.mdx
1 parent aab5233 commit bea9052

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

website/pages/docs/job-specification/restart.mdx

+37-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ description: The "restart" stanza configures a group's behavior on task failure.
77

88
# `restart` Stanza
99

10-
<Placement groups={['job', 'group', 'restart']} />
11-
12-
The `restart` stanza configures a group's behavior on task failure. Restarts
10+
<Placement
11+
groups={[
12+
['job', 'group', 'restart'],
13+
['job', 'group', 'task', 'restart']
14+
]}
15+
/>
16+
17+
The `restart` stanza configures a tasks's behavior on task failure. Restarts
1318
happen on the client that is running the task.
1419

1520
```hcl
@@ -23,6 +28,35 @@ job "docs" {
2328
}
2429
```
2530

31+
If specified at the group level, the configuration is inherited by all
32+
tasks in the group. If present on the task, the policy is merged with
33+
the restart policy from the encapsulating task group.
34+
35+
For example, assuming that the task group restart policy is:
36+
```hcl
37+
restart {
38+
interval = "30m"
39+
attempts = 2
40+
delay = "15s"
41+
mode = "fail"
42+
}
43+
```
44+
and the individual task restart policy is:
45+
```hcl
46+
restart {
47+
attempts = 5
48+
}
49+
```
50+
then the effective restart policy for the task will be:
51+
```hcl
52+
restart {
53+
interval = "30m"
54+
attempts = 5
55+
delay = "15s"
56+
mode = "fail"
57+
}
58+
```
59+
2660
## `restart` Parameters
2761

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

0 commit comments

Comments
 (0)