open-nomad/website/source/docs/http/alloc.html.md

260 lines
6.5 KiB
Markdown
Raw Normal View History

2015-09-21 00:59:57 +00:00
---
layout: "http"
page_title: "HTTP API: /v1/allocation"
sidebar_current: "docs-http-alloc-"
description: |-
The '/1/allocation' endpoint is used to query a specific allocation.
---
# /v1/allocation
The `allocation` endpoint is used to query the a specific allocation.
By default, the agent's local region is used; another region can
be specified using the `?region=` query parameter.
## GET
<dl>
<dt>Description</dt>
<dd>
Query a specific allocation.
</dd>
<dt>Method</dt>
<dd>GET</dd>
<dt>URL</dt>
<dd>`/v1/allocation/<ID>`</dd>
<dt>Parameters</dt>
<dd>
None
</dd>
<dt>Blocking Queries</dt>
<dd>
[Supported](/docs/http/index.html#blocking-queries)
</dd>
2015-09-21 00:59:57 +00:00
<dt>Returns</dt>
<dd>
```javascript
{
2015-11-18 03:12:19 +00:00
"ID": "203266e5-e0d6-9486-5e05-397ed2b184af",
"EvalID": "e68125ed-3fba-fb46-46cc-291addbc4455",
"Name": "example.cache[0]",
"NodeID": "e02b6169-83bd-9df6-69bd-832765f333eb",
"JobID": "example",
"ModifyIndex": 9,
"Resources": {
"Networks": [
{
"DynamicPorts": [
{
"Value": 20802,
"Label": "db"
}
],
"ReservedPorts": null,
"MBits": 10,
"IP": "",
"CIDR": "",
"Device": ""
}
2015-09-21 00:59:57 +00:00
],
2015-11-18 03:12:19 +00:00
"IOPS": 0,
"DiskMB": 0,
"MemoryMB": 256,
"CPU": 500
},
"TaskGroup": "cache",
"Job": {
"ModifyIndex": 5,
"CreateIndex": 5,
"StatusDescription": "",
"Status": "",
"Meta": null,
"Update": {
"MaxParallel": 1,
"Stagger": 1e+10
},
2015-09-21 00:59:57 +00:00
"TaskGroups": [
2015-11-18 03:12:19 +00:00
{
"Meta": null,
"Tasks": [
{
"Meta": null,
"Resources": {
"Networks": [
2015-09-21 00:59:57 +00:00
{
2015-11-18 03:12:19 +00:00
"DynamicPorts": [
{
"Value": 20802,
"Label": "db"
}
],
"ReservedPorts": null,
"MBits": 0,
"IP": "127.0.0.1",
"CIDR": "",
"Device": "lo"
2015-09-21 00:59:57 +00:00
}
2015-11-18 03:12:19 +00:00
],
"IOPS": 0,
"DiskMB": 0,
"MemoryMB": 256,
"CPU": 500
},
"Constraints": null,
"Services": [
{
"Checks": [
{
"Timeout": 2e+09,
"Interval": 1e+10,
"Protocol": "",
"Http": "",
"Script": "",
"Type": "tcp",
"Name": "alive",
"Id": ""
}
],
"PortLabel": "db",
"Tags": [
"global",
"cache"
],
"Name": "example-cache-redis",
"Id": ""
}
2015-09-21 00:59:57 +00:00
],
2015-11-18 03:12:19 +00:00
"Env": null,
"Config": {
"port_map": [
2015-09-21 00:59:57 +00:00
{
2015-11-18 03:12:19 +00:00
"db": 6379
2015-09-21 00:59:57 +00:00
}
2015-11-18 03:12:19 +00:00
],
"image": "redis:latest"
},
"Driver": "docker",
"Name": "redis"
}
],
"RestartPolicy": {
"Delay": 2.5e+10,
"Interval": 3e+11,
"Attempts": 10
},
"Constraints": null,
"Count": 1,
"Name": "cache"
}
2015-09-21 00:59:57 +00:00
],
2015-11-18 03:12:19 +00:00
"Region": "global",
"ID": "example",
"Name": "example",
"Type": "service",
"Priority": 50,
"AllAtOnce": false,
"Datacenters": [
"dc1"
],
"Constraints": [
{
"Operand": "=",
"RTarget": "linux",
"LTarget": "$attr.kernel.name"
}
]
},
"TaskResources": {
"redis": {
"Networks": [
2015-09-21 00:59:57 +00:00
{
2015-11-18 03:12:19 +00:00
"DynamicPorts": [
{
"Value": 20802,
"Label": "db"
}
],
"ReservedPorts": null,
"MBits": 0,
"IP": "127.0.0.1",
"CIDR": "",
"Device": "lo"
2015-09-21 00:59:57 +00:00
}
2015-11-18 03:12:19 +00:00
],
"IOPS": 0,
"DiskMB": 0,
"MemoryMB": 256,
"CPU": 500
}
},
"Metrics": {
"CoalescedFailures": 0,
"AllocationTime": 1590406,
"NodesEvaluated": 1,
2015-09-21 00:59:57 +00:00
"NodesFiltered": 0,
"ClassFiltered": null,
"ConstraintFiltered": null,
"NodesExhausted": 0,
"ClassExhausted": null,
2015-09-23 00:37:33 +00:00
"DimensionExhausted": null,
2015-11-18 03:12:19 +00:00
"Scores": {
"e02b6169-83bd-9df6-69bd-832765f333eb.binpack": 6.133651487695705
}
},
"DesiredStatus": "run",
"DesiredDescription": "",
"ClientStatus": "running",
"ClientDescription": "",
"TaskStates": {
"redis": {
"Events": [
{
"KillError": "",
"Message": "",
"Signal": 0,
"ExitCode": 0,
"DriverError": "",
"Time": 1447806038427841000,
"Type": "Started"
}
],
"State": "running"
}
},
"CreateIndex": 7
2015-09-21 00:59:57 +00:00
}
```
</dd>
</dl>
2016-01-22 00:03:48 +00:00
### Field Reference
* `TaskStates` - `TaskStates` is a map of tasks to their current state and the
latest events that have effected the state.
A task can be in the following states:
* `TaskStatePending` - The task is waiting to be run, either for the first
time or do to a restart.
* `TaskStateRunning` - The task is currently running.
* `TaskStateDead` - The task is dead and will not run again.
<p>The latest 10 events are stored per task. Each event is timestamped (unix seconds)
and has one of the following types:</p>
* `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 do to a
restart.
* `Terminated` - The task terminated.
* `Killed` - The task was killed by the user.
Depending on the type the event will have applicable annotations.