10346: Checkpoint. Merge schema and method docs. Write doc describing syntax of...
[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
9 See "REST methods for working with Arvados resources":{{site.baseurl}}/api/methods.html
10
11 API endpoint base: @https://{{ site.arvados_api_host }}/arvados/v1/containers@
12
13 Required arguments are displayed in %{background:#ccffcc}green%.
14
15 h2. Resource
16
17 Each Container offers the following attributes, in addition to the usual "attributes of Arvados resources":{{site.baseurl}}/api/resources.html:
18
19 table(table table-bordered table-condensed).
20 |_. Attribute|_. Type|_. Description|_. Notes|
21 |state|string|The allowed states are "Queued", "Locked", "Running", "Cancelled" and "Complete".|See "Container states":#container_states for more details.|
22 |started_at|datetime|When this container started running.|Null if container has not yet started.|
23 |finished_at|datetime|When this container finished.|Null if container has not yet finished.|
24 |log|string|Portable data hash of the collection containing logs from a completed container run.|Null if the container is not yet finished.|
25 |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.|
26 |cwd|string|Initial working directory.|Must be equal to a ContainerRequest's cwd in order to satisfy the ContainerRequest|
27 |command|array of strings|Command to execute.| Must be equal to a ContainerRequest's command in order to satisfy the ContainerRequest.|
28 |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.|
29 |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.|
30 |runtime_constraints|hash|Compute resources, and access to the outside world, that are / were available to the container.
31 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.,
32 <pre><code>{
33   "ram":12000000000,
34   "vcpus":2,
35   "API":true
36 }</code></pre>See "Runtime constraints":#runtime_constraints for more details.|
37 |output|string|Portable data hash of the output collection.|Null if the container is not yet finished.|
38 |container_image|string|Portable data hash of a collection containing the docker image used to run the container.||
39 |progress|number|A number between 0.0 and 1.0 describing the fraction of work done.||
40 |priority|integer|Priority assigned by the system, taking into account the priorities of all associated ContainerRequests.||
41 |exit_code|integer|Process exit code.|Null if state!="Complete"|
42 |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"}|
43 |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"}|
44
45 h2(#container_states). Container states
46
47 table(table table-bordered table-condensed).
48 |_. State|_. Sgnificance|_. Allowed next|
49 |Queued|Waiting for a dispatcher to lock it and try to run the container.|Locked, Cancelled|
50 |Locked|A dispatcher has "taken" the container and is allocating resources for it. The container has not started yet.|Queued, Running, Cancelled|
51 |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|
52 |Complete|Container was running, and the contained process/command has exited.|-|
53 |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).|-|
54
55 h2(#mount_types). {% include 'mount_types' %}
56
57 h2(#runtime_constraints). {% include 'container_runtime_constraints' %}
58
59 h2. Methods
60 h2(#create). create
61
62 Create a new Container.
63
64 Arguments:
65
66 table(table table-bordered table-condensed).
67 |_. Argument |_. Type |_. Description |_. Location |_. Example |
68 {background:#ccffcc}.|container|object|See "Container resource":{{site.baseurl}}/api/schema/Container.html|request body||
69
70 h3. delete
71
72 Delete an existing Container.
73
74 Arguments:
75
76 table(table table-bordered table-condensed).
77 |_. Argument |_. Type |_. Description |_. Location |_. Example |
78 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
79
80 h3. get
81
82 Get a Container's metadata by UUID.
83
84 Arguments:
85
86 table(table table-bordered table-condensed).
87 |_. Argument |_. Type |_. Description |_. Location |_. Example |
88 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
89
90 h3. list
91
92 List containers.
93
94 Arguments:
95
96 table(table table-bordered table-condensed).
97 |_. Argument |_. Type |_. Description |_. Location |_. Example |
98 |limit|integer (default 100)|Maximum number of containers to return.|query||
99 |order|string|Order in which to return matching containers.|query||
100 |filters|array|Conditions for filtering containers.|query||
101
102 See the create method documentation for more information about Container-specific filters.
103
104 h3. update
105
106 Update attributes of an existing Container.
107
108 Arguments:
109
110 table(table table-bordered table-condensed).
111 |_. Argument |_. Type |_. Description |_. Location |_. Example |
112 {background:#ccffcc}.|uuid|string|The UUID of the Container in question.|path||
113 |container|object||query||
114
115 h3. auth
116
117 Get the api_client_authorization record indicated by this container's auth_uuid, which belongs to the container's locked_by_uuid.
118
119 table(table table-bordered table-condensed).
120 |_. Argument |_. Type |_. Description |_. Location |_. Example |
121 {background:#ccffcc}.|uuid|string||path||