github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/operator/scheduler.mdx (about)

     1  ---
     2  layout: api
     3  page_title: Scheduler - Operator - HTTP API
     4  description: |-
     5    The /operator/scheduler endpoints provide tools for management of Nomad server scheduler settings.
     6  ---
     7  
     8  # Scheduler Operator HTTP API
     9  
    10  The `/operator/scheduler` endpoints provide tools for management of Nomad server scheduler settings.
    11  
    12  ## Read Scheduler Configuration
    13  
    14  This endpoint retrieves the latest Scheduler configuration. More options may be added in
    15  the future.
    16  
    17  | Method | Path                                   | Produces           |
    18  | ------ | -------------------------------------- | ------------------ |
    19  | `GET`  | `/v1/operator/scheduler/configuration` | `application/json` |
    20  
    21  The table below shows this endpoint's support for
    22  [blocking queries](/api-docs#blocking-queries) and
    23  [required ACLs](/api-docs#acls).
    24  
    25  | Blocking Queries | ACL Required    |
    26  | ---------------- | --------------- |
    27  | `NO`             | `operator:read` |
    28  
    29  ### Sample Request
    30  
    31  ```shell-session
    32  $ curl \
    33      https://localhost:4646/v1/operator/scheduler/configuration
    34  ```
    35  
    36  ### Sample Response
    37  
    38  ```json
    39  {
    40    "Index": 5,
    41    "KnownLeader": true,
    42    "LastContact": 0,
    43    "NextToken": "",
    44    "SchedulerConfig": {
    45      "CreateIndex": 5,
    46      "MemoryOversubscriptionEnabled": false,
    47      "ModifyIndex": 5,
    48      "PauseEvalBroker": false,
    49      "PreemptionConfig": {
    50        "BatchSchedulerEnabled": false,
    51        "ServiceSchedulerEnabled": false,
    52        "SysBatchSchedulerEnabled": false,
    53        "SystemSchedulerEnabled": true
    54      },
    55      "RejectJobRegistration": false,
    56      "SchedulerAlgorithm": "binpack"
    57    }
    58  }
    59  ```
    60  
    61  #### Field Reference
    62  
    63  - `Index` `(int)` - The `Index` value is the Raft index corresponding to this
    64    configuration.
    65  
    66  - `SchedulerConfig` `(SchedulerConfig)` - The returned `SchedulerConfig` object has configuration
    67    settings mentioned below.
    68  
    69    - `SchedulerAlgorithm` `(string: "binpack")` - Specifies whether scheduler
    70      binpacks or spreads allocations on available nodes.
    71  
    72    - `MemoryOversubscriptionEnabled` `(bool: false)` <sup>1.1 Beta</sup> - When
    73      `true`, tasks may exceed their reserved memory limit, if the client has excess
    74      memory capacity. Tasks must specify [`memory_max`](/docs/job-specification/resources#memory_max)
    75      to take advantage of memory oversubscription.
    76  
    77    - `RejectJobRegistration` `(bool: false)` - When `true`, the server will return
    78      permission denied errors for job registration, job dispatch, and job scale APIs,
    79      unless the ACL token for the request is a management token. If ACLs are disabled,
    80      no user will be able to register jobs. This allows operators to shed load from
    81      automated processes during incident response.
    82  
    83    - `PauseEvalBroker` `(bool: false)` - When set to `true`, the eval broker which
    84      usually runs on the leader will be disabled. This will prevent the scheduler
    85      workers from receiving new work.
    86  
    87    - `PreemptionConfig` `(PreemptionConfig)` - Options to enable preemption for various schedulers.
    88  
    89      - `SystemSchedulerEnabled` `(bool: true)` - Specifies whether preemption for system jobs is enabled. Note that
    90        this defaults to true.
    91  
    92      - `SysBatchSchedulerEnabled` `(bool: false)` - Specifies whether preemption for system batch jobs is enabled. Note that
    93        this defaults to false.
    94  
    95      - `BatchSchedulerEnabled` `(bool: false)` - Specifies whether preemption for batch jobs is enabled. Note that
    96        this defaults to false and must be explicitly enabled.
    97  
    98      - `ServiceSchedulerEnabled` `(bool: false)` - Specifies whether preemption for service jobs is enabled. Note that
    99        this defaults to false and must be explicitly enabled.
   100  
   101    - `CreateIndex` - The Raft index at which the config was created.
   102    - `ModifyIndex` - The Raft index at which the config was modified.
   103  
   104  ## Update Scheduler Configuration
   105  
   106  This endpoint updates the scheduler configuration of the cluster.
   107  
   108  | Method        | Path                                   | Produces           |
   109  | ------------- | -------------------------------------- | ------------------ |
   110  | `PUT`, `POST` | `/v1/operator/scheduler/configuration` | `application/json` |
   111  
   112  The table below shows this endpoint's support for
   113  [blocking queries](/api-docs#blocking-queries) and
   114  [required ACLs](/api-docs#acls).
   115  
   116  | Blocking Queries | ACL Required     |
   117  | ---------------- | ---------------- |
   118  | `NO`             | `operator:write` |
   119  
   120  ### Bootstrap Configuration Element
   121  
   122  The [`default_scheduler_config`][] attribute of the server stanza will provide a
   123  starting value for this configuration. Once bootstrapped, the value in the
   124  server state is authoritative.
   125  
   126  ### Parameters
   127  
   128  - `cas` `(int: 0)` - Specifies to use a Check-And-Set operation. The update will
   129    only happen if the given index matches the `ModifyIndex` of the configuration
   130    at the time of writing.
   131  
   132  ### Sample Payload
   133  
   134  ```json
   135  {
   136    "SchedulerAlgorithm": "spread",
   137    "MemoryOversubscriptionEnabled": false,
   138    "RejectJobRegistration": false,
   139    "PauseEvalBroker": false,
   140    "PreemptionConfig": {
   141      "SystemSchedulerEnabled": true,
   142      "SysBatchSchedulerEnabled": false,
   143      "BatchSchedulerEnabled": false,
   144      "ServiceSchedulerEnabled": true
   145    }
   146  }
   147  ```
   148  
   149  - `SchedulerAlgorithm` `(string: "binpack")` - Specifies whether scheduler
   150    binpacks or spreads allocations on available nodes. Possible values are
   151    `"binpack"` and `"spread"`
   152  
   153  - `MemoryOversubscriptionEnabled` `(bool: false)` <sup>1.1 Beta</sup> - When
   154    `true`, tasks may exceed their reserved memory limit, if the client has excess
   155    memory capacity. Tasks must specify [`memory_max`](/docs/job-specification/resources#memory_max)
   156    to take advantage of memory oversubscription.
   157  
   158  - `RejectJobRegistration` `(bool: false)` - When `true`, the server will return
   159    permission denied errors for job registration, job dispatch, and job scale APIs,
   160    unless the ACL token for the request is a management token. If ACLs are disabled,
   161    no user will be able to register jobs. This allows operators to shed load from
   162    automated processes during incident response.
   163  
   164  - `PauseEvalBroker` `(bool: false)` - When set to `true`, the eval broker which
   165    usually runs on the leader will be disabled. This will prevent the scheduler
   166    workers from receiving new work.
   167  
   168  - `PreemptionConfig` `(PreemptionConfig)` - Options to enable preemption for
   169    various schedulers.
   170  
   171    - `SystemSchedulerEnabled` `(bool: true)` - Specifies whether preemption for
   172      system jobs is enabled. Note that if this is set to true, then system jobs
   173      can preempt any other jobs.
   174  
   175    - `SysBatchSchedulerEnabled` `(bool: false)` <sup>1.2</sup> - Specifies
   176      whether preemption for system batch jobs is enabled. Note that if this is
   177      set to true, then system batch jobs can preempt any other jobs.
   178  
   179    - `BatchSchedulerEnabled` `(bool: false)` - Specifies
   180      whether preemption for batch jobs is enabled. Note that if this is set to
   181      true, then batch jobs can preempt any other jobs.
   182  
   183    - `ServiceSchedulerEnabled` `(bool: false)` - Specifies
   184      whether preemption for service jobs is enabled. Note that if this is set to
   185      true, then service jobs can preempt any other jobs.
   186  
   187  ### Sample Response
   188  
   189  ```json
   190  {
   191    "Updated": false,
   192    "Index": 15
   193  }
   194  ```
   195  
   196  - `Updated` - Indicates that the configuration was updated when a `cas` value is
   197    provided. For non-CAS requests, this field will be false even though the
   198    update is applied.
   199  
   200  - `Index` - Current Raft index when the request was received.
   201  
   202  [`default_scheduler_config`]: /docs/configuration/server#default_scheduler_config