10346: Updates from review comments.
[arvados.git] / doc / api / methods / container_requests.html.textile.liquid
1 ---
2 layout: default
3 navsection: api
4 navmenu: API Methods
5 title: "container_requests"
6
7 ...
8
9 API endpoint base: @https://{{ site.arvados_api_host }}/arvados/v1/container_requests@
10
11 Object type: @xvhdp@
12
13 Example UUID: @zzzzz-xvhdp-0123456789abcde@
14
15 h2. Resource
16
17 A container request is a request for the Arvados cluster to perform some computational work.  See "computing with Crunch":{{site.baseurl}}/api/execution.html for details.
18
19 Each ContainerRequest offers the following attributes, in addition to the "Common resource fields":{{site.baseurl}}/api/resources.html:
20
21 All attributes are optional, unless otherwise marked as required.
22
23 table(table table-bordered table-condensed).
24 |_. Attribute|_. Type|_. Description|_. Notes|
25 |name|string|The name of the container_request.||
26 |description|string|The description of the container_request.||
27 |properties|hash|Client-defined structured data that does not affect how the container is run.||
28 |state|string|The allowed states are "Uncommitted", "Committed", and "Final".|Once a request is Committed, the only attributes that can be modified are priority, container_uuid, and container_count_max. A request in the "Final" state cannot have any of its functional parts modified (i.e., only name, description, and properties fields can be modified).|
29 |requesting_container_uuid|string|The uuid of the parent container that created this container_request, if any. Represents a process tree.|The priority of this container_request is inherited from the parent container, if the parent container is cancelled, this container_request will be cancelled as well.|
30 |container_uuid|string|The uuid of the container that satisfies this container_request. The system will find and reuse any preexisting Container that matches this container request's criteria. See "Container reuse":#container_reuse for more details.|Currently, container reuse is the default behavior and a mechanism to skip reuse is not supported.|
31 |container_count_max|integer|Maximum number of containers to start, i.e., the maximum number of "attempts" to be made.||
32 |mounts|hash|Objects to attach to the container's filesystem and stdin/stdout.|See "Mount types":#mount_types for more details.|
33 |runtime_constraints|hash|Restrict the container's access to compute resources and the outside world.|Required when in "Committed" state. e.g.,<pre><code>{
34   "ram":12000000000,
35   "vcpus":2,
36   "API":true
37 }</code></pre>See "Runtime constraints":#runtime_constraints for more details.|
38 |container_image|string|Portable data hash of a collection containing the docker image to run the container.|Required.|
39 |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.||
40 |cwd|string|Initial working directory, given as an absolute path (in the container) or a path relative to the WORKDIR given in the image's Dockerfile.|Required.|
41 |command|array of strings|Command to execute in the container.|Required. e.g., @["echo","hello"]@|
42 |output_path|string|Path to a directory or file inside the container that should be preserved as container's output when it finishes. This path must be, or be inside, one of the mount targets. For best performance, point output_path to a writable collection mount.|Required.|
43 |priority|integer|Higher value means spend more resources on this container_request, i.e., go ahead of other queued containers, bring up more nodes etc.|Priority 0 means a container should not be run on behalf of this request. Clients are expected to submit container requests with zero priority in order to prevew the container that will be used to satisfy it. Priority can be null if and only if state!="Committed".|
44 |expires_at|datetime|After this time, priority is considered to be zero.|Not yet implemented.|
45 |use_existing|boolean|If possible, use an existing (non-failed) container to satisfy the request instead of creating a new one.|Default is true|
46 @true@
47 @false@|
48 |filters|string|Additional constraints for satisfying the container_request, given in the same form as the filters parameter accepted by the container_requests.list API.||
49
50 h2(#mount_types). {% include 'mount_types' %}
51
52 h2(#runtime_constraints). {% include 'container_runtime_constraints' %}
53
54 h2(#container_reuse). Container reuse
55
56 When a container request is "Committed", the system will try to find and reuse any preexisting Container with the same exact command, cwd, environment, output_path, container_image, mounts, and runtime_constraints as this container request. The serialized fields environment, mounts and runtime_constraints are sorted to facilitate comparison.
57
58 The system will use the following scheme to determine which Container to consider for reuse: A Container with the same exact command, cwd, environment, output_path, container_image, mounts, and runtime_constraints as this container request and,
59 * The oldest successfully finished container, i.e., in state "Complete" with exit_code of 0. If matching containers with different outputs are found, the system will forgo reusing any of these finished containers and instead look for suitable containers in other states
60 * The oldest "Running" container with the highest progress, i.e., the container that is most likely to finish first
61 * The oldest "Locked" container with the highest priority, i.e., the container that is most likely to start first
62 * The oldest "Queued" container with the highest priority, i.e, the container that is most likely to start first
63
64 h2(#cancel_container). Canceling a container request
65
66 A container request may be canceled by setting it's priority to 0, using an update call.
67
68 When a container request is canceled, it will still reflect the state of the Container it is associated with via the container_uuid attribute. If that Container is being reused by any other container_requests that are still active, i.e., not yet canceled, that Container may continue to run or be scheduled to run by the system in future. However, if no other container_requests are using that Contianer, then the Container will get canceled as well.
69
70 h2. Methods
71
72 See "Common resource methods":{{site.baseurl}}/api/methods.html more information about @create@, @delete@, @get@, @list@, and @update@.
73
74 Required arguments are displayed in %{background:#ccffcc}green%.
75
76 h2(#create). create
77
78 Create a new container request.
79
80 Arguments:
81
82 table(table table-bordered table-condensed).
83 |_. Argument |_. Type |_. Description |_. Location |_. Example |
84 {background:#ccffcc}.|container_request|object|Container request resource.|request body||
85
86
87 The request body must include the required attributes command, container_image, cwd, and output_path. It can also inlcude other attributes such as environment, mounts, and runtime_constraints.
88
89 h3. delete
90
91 Delete an existing container request.
92
93 Arguments:
94
95 table(table table-bordered table-condensed).
96 |_. Argument |_. Type |_. Description |_. Location |_. Example |
97 {background:#ccffcc}.|uuid|string|The UUID of the container request in question.|path||
98
99 h3. get
100
101 Get a container request's metadata by UUID.
102
103 Arguments:
104
105 table(table table-bordered table-condensed).
106 |_. Argument |_. Type |_. Description |_. Location |_. Example |
107 {background:#ccffcc}.|uuid|string|The UUID of the container request in question.|path||
108
109 h3. list
110
111 List container_requests.
112
113 See "common resource list method.":{{site.baseurl}}/api/methods.html#index
114
115 See the create method documentation for more information about container request-specific filters.
116
117 h3. update
118
119 Update attributes of an existing container request.
120
121 Arguments:
122
123 table(table table-bordered table-condensed).
124 |_. Argument |_. Type |_. Description |_. Location |_. Example |
125 {background:#ccffcc}.|uuid|string|The UUID of the container request in question.|path||
126 |container_request|object||query||
127
128 {% include 'notebox_begin' %}
129 Setting the priority of a committed container_request to 0 may cancel a running container assigned for it.
130 See "Canceling a container request":{{site.baseurl}}/api/methods/container_requests.html#cancel_container for further details.
131 {% include 'notebox_end' %}