github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/website/pages/docs/job-specification/reschedule.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: reschedule Stanza - Job Specification
     4  sidebar_title: reschedule
     5  description: >-
     6    The "reschedule" stanza specifies the group's rescheduling strategy upon
     7  
     8    allocation failures. Nomad will only attempt to reschedule failed allocations
     9    on
    10  
    11    to another node only after any local
    12    [restarts](docs/job-specification/restart)
    13  
    14    have been exceeded.
    15  ---
    16  
    17  # `reschedule` Stanza
    18  
    19  <Placement
    20    groups={[
    21      ['job', 'reschedule'],
    22      ['job', 'group', 'reschedule']
    23    ]}
    24  />
    25  
    26  The `reschedule` stanza specifies the group's rescheduling strategy. If specified at the job
    27  level, the configuration will apply to all groups within the job. If the
    28  reschedule stanza is present on both the job and the group, they are merged with
    29  the group stanza taking the highest precedence and then the job.
    30  
    31  Nomad will attempt to schedule the task on another node if any of its allocation
    32  statuses become "failed". It prefers to create a replacement allocation on a node
    33  that hasn't previously been used.
    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` jobs because they run on
    51  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  
    67  - `delay_function` `(string: <varies>)` - Specifies the function that is used to
    68    calculate subsequent reschedule delays. The initial delay is specified by the delay parameter.
    69    `delay_function` has three possible values which are described below.
    70  
    71    - `constant` - The delay between reschedule attempts stays constant at the `delay` value.
    72    - `exponential` - The delay between reschedule attempts doubles.
    73    - `fibonacci` - The delay between reschedule attempts is calculated by adding the two most recent
    74      delays applied. For example if `delay` is set to 5 seconds, the next five reschedule attempts will be
    75      delayed by 5 seconds, 5 seconds, 10 seconds, 15 seconds, and 25 seconds respectively.
    76  
    77  - `max_delay` `(string: <varies>)` - is an upper bound on the delay beyond which it will not increase. This parameter
    78    is used when `delay_function` is `exponential` or `fibonacci`, and is ignored when `constant` delay is used.
    79  
    80  - `unlimited` `(boolean:<varies>)` - `unlimited` enables unlimited reschedule attempts. If this is set to true
    81    the `attempts` and `interval` fields are not used.
    82  
    83  Information about reschedule attempts are displayed in the CLI and API for
    84  allocations. Rescheduling is enabled by default for service and batch jobs
    85  with the options shown below.
    86  
    87  ### `reschedule` Parameter Defaults
    88  
    89  The values for the `reschedule` parameters vary by job type. Below are the
    90  defaults by job type:
    91  
    92  - The Default Batch Reschedule Policy is:
    93  
    94    ```hcl
    95    reschedule {
    96      attempts       = 1
    97      interval       = "24h"
    98      unlimited      = false
    99      delay          = "5s"
   100      delay_function = "constant"
   101    }
   102    ```
   103  
   104  - The Default Service Reschedule Policy is:
   105  
   106    ```hcl
   107    reschedule {
   108     delay          = "30s"
   109     delay_function = "exponential"
   110     max_delay      = "1h"
   111     unlimited      = true
   112    }
   113    ```
   114  
   115  ### Rescheduling during deployments
   116  
   117  The [update stanza](/docs/job-specification/update) controls rolling updates and canary deployments. A task
   118  group's reschedule stanza does not take affect during a deployment. For example, if a new version of the job
   119  is rolled out and the deployment failed due to a failing allocation, Nomad will not reschedule it.
   120  
   121  ### Disabling rescheduling
   122  
   123  To disable rescheduling, set the `attempts` parameter to zero and `unlimited` to false.
   124  
   125  ```hcl
   126  job "docs" {
   127    group "example" {
   128      reschedule {
   129        attempts  = 0
   130        unlimited = false
   131      }
   132    }
   133  }
   134  ```