Allocations HTTP API
The /allocation
endpoints are used to query for and interact with allocations.
List Allocations
This endpoint lists all allocations.
Method | Path | Produces |
---|---|---|
GET | /v1/allocations | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:read-job |
Parameters
prefix
(string: "")
- Specifies a string to filter allocations based on an ID prefix. Because the value is decoded to bytes, the prefix must have an even number of hexadecimal characters (0-9a-f). This is specified as a query string parameter.
Sample Request
Sample Response
Read Allocation
This endpoint reads information about a specific allocation.
Method | Path | Produces |
---|---|---|
GET | /v1/allocation/:alloc_id | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
YES | namespace:read-job |
Parameters
:alloc_id
(string: <required>)
- Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one. This is specified as part of the path.
Sample Request
Sample Response
Field Reference
TaskStates
- A map of tasks to their current state and the latest events that have effected the state.TaskState
objects contain the following fields:State
: The task's current state. It can have one of the following values:TaskStatePending
- The task is waiting to be run, either for the first time or due to a restart.TaskStateRunning
- The task is currently running.TaskStateDead
- The task is dead and will not run again.
StartedAt
: The time the task was last started at. Can be updated through restarts.FinishedAt
: The time the task was finished at.LastRestart
: The last time the task was restarted.Restarts
: The number of times the task has restarted.Events
- An event contains metadata about the event. The latest 10 events are stored per task. Each event is timestamped (Unix nanoseconds) and has one of the following types:Setup Failure
- The task could not be started because there was a failure setting up the task prior to it running.Driver Failure
- The task could not be started due to a failure in the driver.Started
- The task was started; either for the first time or due to a restart.Terminated
- The task was started and exited.Killing
- The task has been sent the kill signal.Killed
- The task was killed by a user.Received
- The task has been pulled by the client at the given timestamp.Failed Validation
- The task was invalid and as such it didn't run.Restarting
- The task terminated and is being restarted.Not Restarting
- the task has failed and is not being restarted because it has exceeded its restart policy.Downloading Artifacts
- The task is downloading the artifact(s)specified in the task.
Failed Artifact Download
- Artifact(s) specified in the task failed to download.Restart Signaled
- The task was singled to be restarted.Signaling
- The task was is being sent a signal.Sibling Task Failed
- A task in the same task group failed.Leader Task Dead
- The group's leader task is dead.Driver
- A message from the driver.Task Setup
- Task setup messages.Building Task Directory
- Task is building its file system.
Depending on the type the event will have applicable annotations.
Stop Allocation
This endpoint stops and reschedules a specific allocation.
Method | Path | Produces |
---|---|---|
POST / PUT | /v1/allocation/:alloc_id/stop | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:alloc-lifecycle |
Parameters
:alloc_id
(string: <required>)
- Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one. This is specified as part of the path.
Sample Request
Sample Response
Signal Allocation
This endpoint sends a signal to an allocation or task.
Method | Path | Produces |
---|---|---|
POST / PUT | /v1/client/allocation/:alloc_id/signal | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:alloc-lifecycle |
Parameters
:alloc_id
(string: <required>)
- Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one. This is specified as part of the path.
Sample Payload
Sample Request
Sample Response
Restart Allocation
This endpoint restarts an allocation or task in-place.
Method | Path | Produces |
---|---|---|
POST / PUT | /v1/client/allocation/:alloc_id/restart | application/json |
The table below shows this endpoint's support for blocking queries and required ACLs.
Blocking Queries | ACL Required |
---|---|
NO | namespace:alloc-lifecycle |
Parameters
:alloc_id
(string: <required>)
- Specifies the UUID of the allocation. This must be the full UUID, not the short 8-character one. This is specified as part of the path.
Sample Payload
Sample Request
Sample Response