OAPI: add operation to delete workers

This will remove a worker by soft-deletion. Any task still assigned to
the worker will be requeued.

Note that this removal should only happen when the worker is offline, or
it will cause errors on the worker as its credentials will not be
accepted any more.
This commit is contained in:
Sybren A. Stüvel 2022-08-11 16:50:05 -07:00
parent 9d5c269398
commit 99bf0a67a7

View File

@ -461,6 +461,27 @@ paths:
content: content:
application/json: application/json:
schema: { $ref: "#/components/schemas/Worker" } schema: { $ref: "#/components/schemas/Worker" }
delete:
operationId: deleteWorker
summary: >
Remove the given worker. It is recommended to only call this function
when the worker is in `offline` state. If the worker is still running,
stop it first. Any task still assigned to the worker will be requeued.
tags: [worker-mgt]
parameters:
- name: worker_id
in: path
required: true
schema: { type: string, format: uuid }
responses:
"204":
description: Normal response, worker has been deleted
default:
description: Unexpected error.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v3/worker-mgt/workers/{worker_id}/setstatus: /api/v3/worker-mgt/workers/{worker_id}/setstatus:
summary: Request a status change for the given worker. summary: Request a status change for the given worker.
@ -1936,6 +1957,10 @@ components:
"status_change": "status_change":
$ref: "#/components/schemas/WorkerStatusChangeRequest" $ref: "#/components/schemas/WorkerStatusChangeRequest"
"version": { type: string } "version": { type: string }
"deleted_at":
type: string
format: date-time
description: This is only set when the worker was deleted.
required: [id, name, updated, status, version] required: [id, name, updated, status, version]
SocketIOSubscription: SocketIOSubscription: