From bea905264b24014ccac6134b6ffd2b8a3d3a1b85 Mon Sep 17 00:00:00 2001 From: Chris Baker <1675087+cgbaker@users.noreply.github.com> Date: Mon, 13 Apr 2020 16:29:43 -0500 Subject: [PATCH] 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 --- .../pages/docs/job-specification/restart.mdx | 40 +++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/website/pages/docs/job-specification/restart.mdx b/website/pages/docs/job-specification/restart.mdx index 5fc6a2b65f00..4f28f40b6a5d 100644 --- a/website/pages/docs/job-specification/restart.mdx +++ b/website/pages/docs/job-specification/restart.mdx @@ -7,9 +7,14 @@ description: The "restart" stanza configures a group's behavior on task failure. # `restart` Stanza - - -The `restart` stanza configures a group's behavior on task failure. Restarts + + +The `restart` stanza configures a tasks's behavior on task failure. Restarts happen on the client that is running the task. ```hcl @@ -23,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: +```hcl +restart { + interval = "30m" + attempts = 5 + delay = "15s" + mode = "fail" +} +``` + ## `restart` Parameters - `attempts` `(int: )` - Specifies the number of restarts allowed in the