# Schedulers

## Disable Workload Scheduler

<mark style="color:green;">`POST`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/workloads/<workload_id>/pause`

Disables the scheduler of a given Workload

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Workload scheduler is disabled" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 11:52:56 GMT
Content-Type: application/json
Content-Length: 0
Connection: keep-alive
X-Compute-Request-Id: req-99f51825-9b47-41ea-814f-8f8141157fc7
```

{% endtab %}
{% endtabs %}

## Enable Workload Scheduler

<mark style="color:green;">`POST`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/workloads/<workload_id>/resume`

Enables the scheduler of a given Workload

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Workload Scheduler is enabled" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 12:06:01 GMT
Content-Type: application/json
Content-Length: 0
Connection: keep-alive
X-Compute-Request-Id: req-4eb1863e-3afa-4a2c-b8e6-91a41fe37f78
```

{% endtab %}
{% endtabs %}

## Scheduler Trust Status

<mark style="color:blue;">`GET`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/trusts/validate/<workload_id>`

Validates the Scheduler trust for a given Workload

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Scheduler trust status is returned" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 12:31:49 GMT
Content-Type: application/json
Content-Length: 1223
Connection: keep-alive
X-Compute-Request-Id: req-c6f826a9-fff7-442b-8886-0770bb97c491

{
   "scheduler_enabled":true,
   "trust":{
      "created_at":"2020-10-23T14:35:11.000000",
      "updated_at":null,
      "deleted_at":null,
      "deleted":false,
      "version":"4.0.115",
      "name":"trust-002bcbaf-c16b-44e6-a9ef-9c1efbfa2e2c",
      "project_id":"c76b3355a164498aa95ddbc960adc238",
      "user_id":"ccddc7e7a015487fa02920f4d4979779",
      "value":"871ca24f38454b14b867338cb0e9b46c",
      "description":"token id for user ccddc7e7a015487fa02920f4d4979779 project c76b3355a164498aa95ddbc960adc238",
      "category":"identity",
      "type":"trust_id",
      "public":false,
      "hidden":true,
      "status":"available",
      "metadata":[
         {
            "created_at":"2020-10-23T14:35:11.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"a3cc9a01-3d49-4ff8-ad8e-b12a7b3c68b0",
            "settings_name":"trust-002bcbaf-c16b-44e6-a9ef-9c1efbfa2e2c",
            "settings_project_id":"c76b3355a164498aa95ddbc960adc238",
            "key":"role_name",
            "value":"member"
         }
      ]
   },
   "is_valid":true,
   "scheduler_obj":{
      "workload_id":"4bafaa03-f69a-45d5-a6fc-ae0119c77974",
      "user_id":"ccddc7e7a015487fa02920f4d4979779",
      "project_id":"c76b3355a164498aa95ddbc960adc238",
      "user_domain_id":"default",
      "user":"ccddc7e7a015487fa02920f4d4979779",
      "tenant":"c76b3355a164498aa95ddbc960adc238"
   }
}
```

{% endtab %}
{% endtabs %}

{% hint style="danger" %}
All following API commands require an Authentication token against a user with admin-role in the authentication project.
{% endhint %}

## Global Job Scheduler status

<mark style="color:blue;">`GET`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/global_job_scheduler`

Requests the status of the Global Job Scheduler

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Returns status of the Global Job Scheduler" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 12:45:27 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
X-Compute-Request-Id: req-cd447ce0-7bd3-4a60-aa92-35fc43b4729b

{"global_job_scheduler": true}
```

{% endtab %}
{% endtabs %}

## Disable Global Job Scheduler

<mark style="color:green;">`POST`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/global_job_scheduler/disable`

Requests disabling the Global Job Scheduler

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Global Job Scheduler has been disabled" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 12:49:29 GMT
Content-Type: application/json
Content-Length: 31
Connection: keep-alive
X-Compute-Request-Id: req-6f49179a-737a-48ab-91b7-7e7c460f5af0

{"global_job_scheduler": false}
```

{% endtab %}
{% endtabs %}

## Enable Global Job Scheduler

<mark style="color:green;">`POST`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/global_job_scheduler/enable`

Requests enabling the Global Job Scheduler

#### Path Parameters

| Name         | Type   | Description                                     |
| ------------ | ------ | ----------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                    |
| tenant\_id   | string | ID of Tenant/Project the Workload is located in |
| workload\_id | string | ID of the Workload to disable the Scheduler in  |

#### Headers

| Name              | Type   | Description                     |
| ----------------- | ------ | ------------------------------- |
| X-Auth-Project-Id | string | Project to authenticate against |
| X-Auth-Token      | string | Authentication token to use     |
| Accept            | string | application/json                |
| User-Agent        | string | python-workloadmgrclient        |

{% tabs %}
{% tab title="200 Global Job scheduler has been enabled" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Fri, 13 Nov 2020 12:50:11 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
X-Compute-Request-Id: req-ed279acc-9805-4443-af91-44a4420559bc

{"global_job_scheduler": true}
```

{% endtab %}
{% endtabs %}
