github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/api-docs/operator/scheduler.mdx (about)

     1  ---
     2  layout: api
     3  page_title: Scheduler - Operator - HTTP API
     4  sidebar_title: Scheduler
     5  description: |-
     6    The /operator/scheduler endpoints provide tools for management of Nomad server scheduler settings.
     7  ---
     8  
     9  # Scheduler Operator HTTP API
    10  
    11  The `/operator/scheduler` endpoints provide tools for management of Nomad server scheduler settings.
    12  
    13  ## Read Scheduler Configuration
    14  
    15  This endpoint retrieves the latest Scheduler configuration. This API was introduced in
    16  Nomad 0.9 and currently supports enabling/disabling preemption. More options may be added in
    17  the future.
    18  
    19  | Method | Path                                   | Produces           |
    20  | ------ | -------------------------------------- | ------------------ |
    21  | `GET`  | `/v1/operator/scheduler/configuration` | `application/json` |
    22  
    23  The table below shows this endpoint's support for
    24  [blocking queries](/api-docs#blocking-queries) and
    25  [required ACLs](/api-docs#acls).
    26  
    27  | Blocking Queries | ACL Required    |
    28  | ---------------- | --------------- |
    29  | `NO`             | `operator:read` |
    30  
    31  ### Sample Request
    32  
    33  ```shell-session
    34  $ curl \
    35      https://localhost:4646/v1/operator/scheduler/configuration
    36  ```
    37  
    38  ### Sample Response
    39  
    40  ```json
    41  {
    42    "Index": 5,
    43    "KnownLeader": true,
    44    "LastContact": 0,
    45    "SchedulerConfig": {
    46      "CreateIndex": 5,
    47      "ModifyIndex": 5,
    48      "SchedulerAlgorithm": "spread",
    49      "PreemptionConfig": {
    50        "SystemSchedulerEnabled": true,
    51        "BatchSchedulerEnabled": false,
    52        "ServiceSchedulerEnabled": false
    53      }
    54    }
    55  }
    56  ```
    57  
    58  #### Field Reference
    59  
    60  - `Index` `(int)` - The `Index` value is the Raft index corresponding to this
    61    configuration.
    62  
    63  - `SchedulerConfig` `(SchedulerConfig)` - The returned `SchedulerConfig` object has configuration
    64    settings mentioned below.
    65  
    66    - `SchedulerAlgorithm` `(string: "binpack")` - Specifies whether scheduler binpacks or spreads allocations on available nodes.
    67  
    68    - `PreemptionConfig` `(PreemptionConfig)` - Options to enable preemption for various schedulers.
    69  
    70      - `SystemSchedulerEnabled` `(bool: true)` - Specifies whether preemption for system jobs is enabled. Note that
    71        this defaults to true.
    72  
    73      - `BatchSchedulerEnabled` `(bool: false)` - Specifies whether preemption for batch jobs is enabled. Note that
    74        this defaults to false and must be explicitly enabled.
    75  
    76      - `ServiceSchedulerEnabled` `(bool: false)` - Specifies whether preemption for service jobs is enabled. Note that
    77        this defaults to false and must be explicitly enabled.
    78  
    79    - `CreateIndex` - The Raft index at which the config was created.
    80    - `ModifyIndex` - The Raft index at which the config was modified.
    81  
    82  ## Update Scheduler Configuration
    83  
    84  This endpoint updates the scheduler configuration of the cluster.
    85  
    86  | Method        | Path                                   | Produces           |
    87  | ------------- | -------------------------------------- | ------------------ |
    88  | `PUT`, `POST` | `/v1/operator/scheduler/configuration` | `application/json` |
    89  
    90  The table below shows this endpoint's support for
    91  [blocking queries](/api-docs#blocking-queries) and
    92  [required ACLs](/api-docs#acls).
    93  
    94  | Blocking Queries | ACL Required     |
    95  | ---------------- | ---------------- |
    96  | `NO`             | `operator:write` |
    97  
    98  ### Bootstrap Configuration Element
    99  
   100  The [`default_scheduler_config`][] attribute of the server stanza will provide a
   101  starting value for this configuration. Once bootstrapped, the value in the
   102  server state is authoritative.
   103  
   104  ### Parameters
   105  
   106  - `cas` `(int: 0)` - Specifies to use a Check-And-Set operation. The update will
   107    only happen if the given index matches the `ModifyIndex` of the configuration
   108    at the time of writing.
   109  
   110  ### Sample Payload
   111  
   112  ```json
   113  {
   114    "SchedulerAlgorithm": "spread",
   115    "PreemptionConfig": {
   116      "SystemSchedulerEnabled": true,
   117      "BatchSchedulerEnabled": false,
   118      "ServiceSchedulerEnabled": true
   119    }
   120  }
   121  ```
   122  
   123  - `SchedulerAlgorithm` `(string: "binpack")` - Specifies whether scheduler
   124    binpacks or spreads allocations on available nodes. Possible values are
   125    `"binpack"` and `"spread"`
   126  
   127  - `PreemptionConfig` `(PreemptionConfig)` - Options to enable preemption for
   128    various schedulers.
   129  
   130    - `SystemSchedulerEnabled` `(bool: true)` - Specifies whether preemption for
   131      system jobs is enabled. Note that if this is set to true, then system jobs
   132      can preempt any other jobs.
   133  
   134    - `BatchSchedulerEnabled` `(bool: false)` - Specifies
   135      whether preemption for batch jobs is enabled. Note that if this is set to
   136      true, then batch jobs can preempt any other jobs.
   137  
   138    - `ServiceSchedulerEnabled` `(bool: false)` - Specifies
   139      whether preemption for service jobs is enabled. Note that if this is set to
   140      true, then service jobs can preempt any other jobs.
   141  
   142  ### Sample Response
   143  
   144  ```json
   145  {
   146    "Updated": false,
   147    "Index": 15
   148  }
   149  ```
   150  
   151  - `Updated` - Indicates that the configuration was updated when a `cas` value is
   152    provided. For non-CAS requests, this field will be false even though the
   153    update is applied.
   154  
   155  - `Index` - Current Raft index when the request was received.
   156  
   157  [`default_scheduler_config`]: /docs/configuration/server#default_scheduler_config