github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/reschedule.mdx (about) 1 --- 2 layout: docs 3 page_title: reschedule Stanza - Job Specification 4 description: >- 5 The "reschedule" stanza specifies the group's rescheduling strategy upon 6 7 allocation failures. Nomad will only attempt to reschedule failed allocations 8 on 9 10 to another node only after any local 11 [restarts](docs/job-specification/restart) 12 13 have been exceeded. 14 --- 15 16 # `reschedule` Stanza 17 18 <Placement 19 groups={[ 20 ['job', 'reschedule'], 21 ['job', 'group', 'reschedule'], 22 ]} 23 /> 24 25 The `reschedule` stanza specifies the group's rescheduling strategy. If specified at the job 26 level, the configuration will apply to all groups within the job. If the 27 reschedule stanza is present on both the job and the group, they are merged with 28 the group stanza taking the highest precedence and then the job. 29 30 Nomad will attempt to schedule the allocation on another node if any of its 31 task statuses become `failed`. The scheduler prefers to create a replacement 32 allocation on a node that was not used by a previous allocation. 33 34 35 ```hcl 36 job "docs" { 37 group "example" { 38 reschedule { 39 attempts = 15 40 interval = "1h" 41 delay = "30s" 42 delay_function = "exponential" 43 max_delay = "120s" 44 unlimited = false 45 } 46 } 47 } 48 ``` 49 50 ~> The reschedule stanza does not apply to `system` or `sysbatch` jobs because 51 they run on every node. 52 53 ## `reschedule` Parameters 54 55 - `attempts` `(int: <varies>)` - Specifies the number of reschedule attempts 56 allowed in the configured interval. Defaults vary by job type, see below 57 for more information. 58 59 - `interval` `(string: <varies>)` - Specifies the sliding window which begins 60 when the first reschedule attempt starts and ensures that only `attempts` 61 number of reschedule happen within it. If more than `attempts` number of 62 failures happen with this interval, Nomad will not reschedule any more. 63 64 - `delay` `(string: <varies>)` - Specifies the duration to wait before attempting 65 to reschedule a failed task. This is specified using a label suffix like "30s" or "1h". 66 Delay cannot be less than 5 seconds. 67 68 - `delay_function` `(string: <varies>)` - Specifies the function that is used to 69 calculate subsequent reschedule delays. The initial delay is specified by the delay parameter. 70 `delay_function` has three possible values which are described below. 71 72 - `constant` - The delay between reschedule attempts stays constant at the `delay` value. 73 - `exponential` - The delay between reschedule attempts doubles. 74 - `fibonacci` - The delay between reschedule attempts is calculated by adding the two most recent 75 delays applied. For example if `delay` is set to 5 seconds, the next five reschedule attempts will be 76 delayed by 5 seconds, 5 seconds, 10 seconds, 15 seconds, and 25 seconds respectively. 77 78 - `max_delay` `(string: <varies>)` - is an upper bound on the delay beyond which it will not increase. This parameter 79 is used when `delay_function` is `exponential` or `fibonacci`, and is ignored when `constant` delay is used. 80 81 - `unlimited` `(boolean:<varies>)` - `unlimited` enables unlimited reschedule attempts. If this is set to true 82 the `attempts` and `interval` fields are not used. 83 84 Information about reschedule attempts are displayed in the CLI and API for 85 allocations. Rescheduling is enabled by default for service and batch jobs 86 with the options shown below. 87 88 ### `reschedule` Parameter Defaults 89 90 The values for the `reschedule` parameters vary by job type. Below are the 91 defaults by job type: 92 93 - The default batch reschedule policy is: 94 95 ```hcl 96 reschedule { 97 attempts = 1 98 interval = "24h" 99 unlimited = false 100 delay = "5s" 101 delay_function = "constant" 102 } 103 ``` 104 105 - The default service reschedule policy is: 106 107 ```hcl 108 reschedule { 109 delay = "30s" 110 delay_function = "exponential" 111 max_delay = "1h" 112 unlimited = true 113 } 114 ``` 115 116 ### Disabling rescheduling 117 118 To disable rescheduling, set the `attempts` parameter to zero and `unlimited` to false. 119 120 ```hcl 121 job "docs" { 122 group "example" { 123 reschedule { 124 attempts = 0 125 unlimited = false 126 } 127 } 128 } 129 ```