runner.pool-drain
Drain every alive runner instance in a warm-pool group (PENDING/IDLE/BUSY → DRAINING). BUSY instances finish their current job first. Org-scoped. Reason is recorded on each instance's transition event for audit.
Drain every warm-pool instance in a group.
IDLE and PENDING instances go straight to DRAINING. BUSY instances enter DRAINING immediately too; their currently-running job completes, then the workflow_job:completed handler skips the IDLE transition (Phase 4 logic) and the next sweep terminates them.
Replacement runners are NOT provisioned by this workflow — call runner.pool-rotate if you need drain + immediate top-up.
Overview
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-runners |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
runner_group_uuid | uuid | Yes | — | UUID of the RunnerGroup to drain, picked from the organization's list of runner groups. |
reason | string | No | — | — |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
runner_group_uuid | uuid | No | — | UUID of the RunnerGroup that was drained, echoed from input on output. |
drained_count | integer | No | — | — |
drain_errors | list | No | — | — |
outcome | string | No | — | — |
status | string | No | — | — |
completed_at | string | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
reason | string | No | — | — |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | drain | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
pending | drain | completed | — |
* (any state) | fail | failed | — |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "runner.pool-drain",
"initial_data": {
"runner_group_uuid": "value"
}
}