Merge branch '11807-yaml-to-json'
[arvados.git] / doc / api / methods / containers.html.textile.liquid
1 ---
2 layout: default
3 navsection: api
4 navmenu: API Methods
5 title: "containers"
6
7 ...
8 {% comment %}
9 Copyright (C) The Arvados Authors. All rights reserved.
10
11 SPDX-License-Identifier: CC-BY-SA-3.0
12 {% endcomment %}
13
14 API endpoint base: @https://{{ site.arvados_api_host }}/arvados/v1/containers@
15
16 Object type: @dz642@
17
18 Example UUID: @zzzzz-dz642-0123456789abcde@
19
20 h2. Resource
21
22 A container is work order to be dispatched to an Arvados cluster to perform some computational work.  A container is created in response to a container request.  See "computing with Crunch":{{site.baseurl}}/api/execution.html for details.
23
24 Each Container offers the following attributes, in addition to the "Common resource fields":{{site.baseurl}}/api/resources.html:
25
26 table(table table-bordered table-condensed).
27 |_. Attribute|_. Type|_. Description|_. Notes|
28 |state|string|The allowed states are "Queued", "Locked", "Running", "Cancelled" and "Complete".|See "Container states":#container_states for more details.|
29 |started_at|datetime|When this container started running.|Null if container has not yet started.|
30 |finished_at|datetime|When this container finished.|Null if container has not yet finished.|
31 |log|string|Portable data hash of the collection containing logs from a completed container run.|Null if the container is not yet finished.|
32 |environment|hash|Environment variables and values that should be set in the container environment (@docker run --env@). This augments and (when conflicts exist) overrides environment variables given in the image's Dockerfile.|Must be equal to a ContainerRequest's environment in order to satisfy the ContainerRequest.|
33 |cwd|string|Initial working directory.|Must be equal to a ContainerRequest's cwd in order to satisfy the ContainerRequest|
34 |command|array of strings|Command to execute.| Must be equal to a ContainerRequest's command in order to satisfy the ContainerRequest.|
35 |output_path|string|Path to a directory or file inside the container that should be preserved as this container's output when it finishes.|Must be equal to a ContainerRequest's output_path in order to satisfy the ContainerRequest.|
36 |mounts|hash|Must contain the same keys as the ContainerRequest being satisfied. Each value must be within the range of values described in the ContainerRequest at the time the Container is assigned to the ContainerRequest.|See "Mount types":#mount_types for more details.|
37 |runtime_constraints|hash|Compute resources, and access to the outside world, that are / were available to the container.
38 Generally this will contain additional keys that are not present in any corresponding ContainerRequests: for example, even if no ContainerRequests specified constraints on the number of CPU cores, the number of cores actually used will be recorded here.|e.g.,
39 <pre><code>{
40   "ram":12000000000,
41   "vcpus":2,
42   "API":true
43 }</code></pre>See "Runtime constraints":#runtime_constraints for more details.|
44 |scheduling_parameters|hash|Parameters to be passed to the container scheduler when running this container.|e.g.,<pre><code>{
45 "partitions":["fastcpu","vfastcpu"]
46 }</code></pre>See "Scheduling parameters":#scheduling_parameters for more details.|
47 |output|string|Portable data hash of the output collection.|Null if the container is not yet finished.|
48 |container_image|string|Portable data hash of a collection containing the docker image used to run the container.||
49 |progress|number|A number between 0.0 and 1.0 describing the fraction of work done.||
50 |priority|integer|Priority assigned by the system, taking into account the priorities of all associated ContainerRequests.||
51 |exit_code|integer|Process exit code.|Null if state!="Complete"|
52 |auth_uuid|string|UUID of a token to be passed into the container itself, used to access Keep-backed mounts, etc.|Null if state∉{"Locked","Running"}|
53 |locked_by_uuid|string|UUID of a token, indicating which dispatch process changed state to Locked. If null, any token can be used to lock. If not null, only the indicated token can modify this container.|Null if state∉{"Locked","Running"}|
54
55 h2(#container_states). Container states
56
57 table(table table-bordered table-condensed).
58 |_. State|_. Sgnificance|_. Allowed next|
59 |Queued|Waiting for a dispatcher to lock it and try to run the container.|Locked, Cancelled|
60 |Locked|A dispatcher has "taken" the container and is allocating resources for it. The container has not started yet.|Queued, Running, Cancelled|
61 |Running|Resources have been allocated and the contained process has been started (or is about to start). Crunch-run _must_ set state to Running _before_ there is any possibility that user code will run in the container.|Complete, Cancelled|
62 |Complete|Container was running, and the contained process/command has exited.|-|
63 |Cancelled|The container did not run long enough to produce an exit code. This includes cases where the container didn't even start, cases where the container was interrupted/killed before it exited by itself (e.g., priority changed to 0), and cases where some problem prevented the system from capturing the contained process's exit status (exit code and output).|-|
64
65 h2(#mount_types). {% include 'mount_types' %}
66
67 h2(#runtime_constraints). {% include 'container_runtime_constraints' %}
68
69 h2(#scheduling_parameters). {% include 'container_scheduling_parameters' %}
70
71 h2. Methods
72
73 See "Common resource methods":{{site.baseurl}}/api/methods.html for more information about @create@, @delete@, @get@, @list@, and @update@.
74
75 Required arguments are displayed in %{background:#ccffcc}green%.
76
77 h2(#create). create
78
79 Create a new Container.
80
81 Arguments:
82
83 table(table table-bordered table-condensed).
84 |_. Argument |_. Type |_. Description |_. Location |_. Example |
85 {background:#ccffcc}.|container|object|Container resource|request body||
86
87 h3. delete
88
89 Delete an existing Container.
90
91 Arguments:
92
93 table(table table-bordered table-condensed).
94 |_. Argument |_. Type |_. Description |_. Location |_. Example |
95 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
96
97 h3. get
98
99 Get a Container's metadata by UUID.
100
101 Arguments:
102
103 table(table table-bordered table-condensed).
104 |_. Argument |_. Type |_. Description |_. Location |_. Example |
105 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
106
107 h3. list
108
109 List containers.
110
111 See "common resource list method.":{{site.baseurl}}/api/methods.html#index
112
113 See the create method documentation for more information about Container-specific filters.
114
115 h3. update
116
117 Update attributes of an existing Container.
118
119 Arguments:
120
121 table(table table-bordered table-condensed).
122 |_. Argument |_. Type |_. Description |_. Location |_. Example |
123 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
124 |container|object||query||
125
126 h3. auth
127
128 Get the api_client_authorization record indicated by this container's auth_uuid, which belongs to the container's locked_by_uuid.
129
130 table(table table-bordered table-condensed).
131 |_. Argument |_. Type |_. Description |_. Location |_. Example |
132 {background:#ccffcc}.|uuid|string||path||