github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/website/source/docs/job-specification/reschedule.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "reschedule Stanza - Job Specification"
     4  sidebar_current: "docs-job-specification-reschedule"
     5  description: |-
     6    The "reschedule" stanza specifies the group's rescheduling strategy upon
     7    allocation failures. The reschedule strategy can be configured with number
     8    of attempts and a time interval. Nomad will only attempt to reschedule
     9    failed allocations on to another node only after any local [restarts](docs/job-specification/restart.html)
    10    have been exceeded.
    11  ---
    12  
    13  # `reschedule` Stanza
    14  
    15  <table class="table table-bordered table-striped">
    16    <tr>
    17      <th width="120">Placement</th>
    18      <td>
    19        <code>job -> **reschedule**</code>
    20      </td>
    21      <td>
    22        <code>job -> group -> **reschedule**</code>
    23      </td>
    24    </tr>
    25  </table>
    26  
    27  The `reschedule` stanza specifies the group's rescheduling strategy. It can be
    28  configured with number of attempts and a time interval. If specified at the job
    29  level, the configuration will apply to all groups within the job. If the
    30  reschedule stanza is present on both the job and the group, they are merged with
    31  the group stanza taking the highest precedence and then the job.
    32  
    33  Nomad will attempt to schedule the task on another node if any of its allocation
    34  statuses become "failed". It prefers to create a replacement allocation on a node
    35  that hasn't previously been used.
    36  
    37  ```hcl
    38  job "docs" {
    39    group "example" {
    40      reschedule {
    41        attempts = 3
    42        interval = "15m"
    43      }
    44    }
    45  }
    46  ```
    47  
    48  ~> The reschedule stanza does not apply to `system` jobs because they run on
    49     every node.
    50  
    51  ## `reschedule` Parameters
    52  
    53  - `attempts` `(int: <varies>)` - Specifies the number of reschedule attempts
    54     allowed in the configured interval. Defaults vary by job type, see below
    55     for more information.
    56  
    57  - `interval` `(string: <varies>)` - Specifies the sliding window which begins
    58     when the first reschedule attempt starts and ensures that only `attempts`
    59     number of reschedule happen within it. If more than `attempts` number of
    60     failures happen with this interval, Nomad will not reschedule any more.
    61  
    62  Information about reschedule attempts are displayed in the CLI and API for
    63  allocations. Rescheduling is enabled by default for service and batch jobs
    64  with the options shown below.
    65  
    66  ### `reschedule` Parameter Defaults
    67  
    68  The values for the `reschedule` parameters vary by job type. Below are the
    69  defaults by job type:
    70  
    71  - The Default Batch Reschedule Policy is:
    72  
    73      ```hcl
    74      reschedule {
    75        attempts = 1
    76        interval = "24h"
    77      }
    78      ```
    79  
    80  - The Default Service Reschedule Policy is:
    81  
    82      ```hcl
    83      reschedule {
    84        interval = "1h"
    85        attempts = 2
    86      }
    87      ```
    88  
    89  ### Rescheduling during deployments
    90  
    91  The [update stanza](docs/job-specification/update.html) controls rolling updates and canary deployments. A task
    92  group's reschedule stanza does not take affect during a deployment. For example, if a new version of the job
    93  is rolled out and the deployment failed due to a failing allocation, Nomad will not reschedule it.
    94  
    95  ### Disabling rescheduling ###
    96  
    97  To disable rescheduling, set the `attempts` parameter to zero.
    98  
    99  ```hcl
   100  job "docs" {
   101    group "example" {
   102      reschedule {
   103        attempts = 0
   104      }
   105    }
   106  }
   107  ```