github.com/dkerwin/nomad@v0.3.3-0.20160525181927-74554135514b/website/source/docs/http/alloc.html.md (about) 1 --- 2 layout: "http" 3 page_title: "HTTP API: /v1/allocation" 4 sidebar_current: "docs-http-alloc-" 5 description: |- 6 The '/1/allocation' endpoint is used to query a specific allocation. 7 --- 8 9 # /v1/allocation 10 11 The `allocation` endpoint is used to query the a specific allocation. 12 By default, the agent's local region is used; another region can 13 be specified using the `?region=` query parameter. 14 15 ## GET 16 17 <dl> 18 <dt>Description</dt> 19 <dd> 20 Query a specific allocation. 21 </dd> 22 23 <dt>Method</dt> 24 <dd>GET</dd> 25 26 <dt>URL</dt> 27 <dd>`/v1/allocation/<ID>`</dd> 28 29 <dt>Parameters</dt> 30 <dd> 31 None 32 </dd> 33 34 <dt>Blocking Queries</dt> 35 <dd> 36 [Supported](/docs/http/index.html#blocking-queries) 37 </dd> 38 39 <dt>Returns</dt> 40 <dd> 41 42 ```javascript 43 { 44 "ID": "203266e5-e0d6-9486-5e05-397ed2b184af", 45 "EvalID": "e68125ed-3fba-fb46-46cc-291addbc4455", 46 "Name": "example.cache[0]", 47 "NodeID": "e02b6169-83bd-9df6-69bd-832765f333eb", 48 "JobID": "example", 49 "ModifyIndex": 9, 50 "Resources": { 51 "Networks": [ 52 { 53 "DynamicPorts": [ 54 { 55 "Value": 20802, 56 "Label": "db" 57 } 58 ], 59 "ReservedPorts": null, 60 "MBits": 10, 61 "IP": "", 62 "CIDR": "", 63 "Device": "" 64 } 65 ], 66 "IOPS": 0, 67 "DiskMB": 0, 68 "MemoryMB": 256, 69 "CPU": 500 70 }, 71 "TaskGroup": "cache", 72 "Job": { 73 "ModifyIndex": 5, 74 "CreateIndex": 5, 75 "StatusDescription": "", 76 "Status": "", 77 "Meta": null, 78 "Update": { 79 "MaxParallel": 1, 80 "Stagger": 1e+10 81 }, 82 "TaskGroups": [ 83 { 84 "Meta": null, 85 "Tasks": [ 86 { 87 "Meta": null, 88 "Resources": { 89 "Networks": [ 90 { 91 "DynamicPorts": [ 92 { 93 "Value": 20802, 94 "Label": "db" 95 } 96 ], 97 "ReservedPorts": null, 98 "MBits": 0, 99 "IP": "127.0.0.1", 100 "CIDR": "", 101 "Device": "lo" 102 } 103 ], 104 "IOPS": 0, 105 "DiskMB": 0, 106 "MemoryMB": 256, 107 "CPU": 500 108 }, 109 "Constraints": null, 110 "Services": [ 111 { 112 "Checks": [ 113 { 114 "Timeout": 2e+09, 115 "Interval": 1e+10, 116 "Protocol": "", 117 "Http": "", 118 "Script": "", 119 "Type": "tcp", 120 "Name": "alive", 121 "Id": "" 122 } 123 ], 124 "PortLabel": "db", 125 "Tags": [ 126 "global", 127 "cache" 128 ], 129 "Name": "example-cache-redis", 130 "Id": "" 131 } 132 ], 133 "Env": null, 134 "Config": { 135 "port_map": [ 136 { 137 "db": 6379 138 } 139 ], 140 "image": "redis:latest" 141 }, 142 "Driver": "docker", 143 "Name": "redis" 144 } 145 ], 146 "RestartPolicy": { 147 "Delay": 2.5e+10, 148 "Interval": 3e+11, 149 "Attempts": 10 150 }, 151 "Constraints": null, 152 "Count": 1, 153 "Name": "cache" 154 } 155 ], 156 "Region": "global", 157 "ID": "example", 158 "Name": "example", 159 "Type": "service", 160 "Priority": 50, 161 "AllAtOnce": false, 162 "Datacenters": [ 163 "dc1" 164 ], 165 "Constraints": [ 166 { 167 "Operand": "=", 168 "RTarget": "linux", 169 "LTarget": "${attr.kernel.name}" 170 } 171 ] 172 }, 173 "TaskResources": { 174 "redis": { 175 "Networks": [ 176 { 177 "DynamicPorts": [ 178 { 179 "Value": 20802, 180 "Label": "db" 181 } 182 ], 183 "ReservedPorts": null, 184 "MBits": 0, 185 "IP": "127.0.0.1", 186 "CIDR": "", 187 "Device": "lo" 188 } 189 ], 190 "IOPS": 0, 191 "DiskMB": 0, 192 "MemoryMB": 256, 193 "CPU": 500 194 } 195 }, 196 "Metrics": { 197 "CoalescedFailures": 0, 198 "AllocationTime": 1590406, 199 "NodesEvaluated": 1, 200 "NodesFiltered": 0, 201 "ClassFiltered": null, 202 "ConstraintFiltered": null, 203 "NodesExhausted": 0, 204 "ClassExhausted": null, 205 "DimensionExhausted": null, 206 "Scores": { 207 "e02b6169-83bd-9df6-69bd-832765f333eb.binpack": 6.133651487695705 208 } 209 }, 210 "DesiredStatus": "run", 211 "DesiredDescription": "", 212 "ClientStatus": "running", 213 "ClientDescription": "", 214 "TaskStates": { 215 "redis": { 216 "Events": [ 217 { 218 "KillError": "", 219 "Message": "", 220 "Signal": 0, 221 "ExitCode": 0, 222 "DriverError": "", 223 "Time": 1447806038427841000, 224 "Type": "Started" 225 } 226 ], 227 "State": "running" 228 } 229 }, 230 "CreateIndex": 7 231 } 232 ``` 233 234 </dd> 235 </dl> 236 237 ### Field Reference 238 239 * `TaskStates` - `TaskStates` is a map of tasks to their current state and the 240 latest events that have effected the state. 241 242 A task can be in the following states: 243 244 * `TaskStatePending` - The task is waiting to be run, either for the first 245 time or due to a restart. 246 * `TaskStateRunning` - The task is currently running. 247 * `TaskStateDead` - The task is dead and will not run again. 248 249 <p>The latest 10 events are stored per task. Each event is timestamped (unix nano-seconds) 250 and has one of the following types:</p> 251 252 * `Driver Failure` - The task could not be started due to a failure in the 253 driver. 254 * `Started` - The task was started; either for the first time or due to a 255 restart. 256 * `Terminated` - The task terminated. 257 * `Killed` - The task was killed by the user. 258 259 Depending on the type the event will have applicable annotations.