--- layout: default navsection: api navmenu: Schema title: ContainerRequest ... A ContainerRequest: * Is a client's expression of interest in knowing the outcome of a computational process. * The system is responsible for finding suitable containers and assigning them to container_requests. * The client's description of the ContainerRequest is less precise than of a Container: a ContainerRequest describes container constraints which can have different interpretations over time. For example, a ContainerRequest with a {"kind":"git_tree","commit_range":"abc123..master",...} mount might be satisfiable by any of several different source trees, and this set of satisfying source trees can change when the repository's "master" branch is updated. h2. Methods See "container_requests":{{site.baseurl}}/api/methods/container_requests.html h2. Resource Each ContainerRequest offers the following attributes, in addition to the usual "attributes of Arvados resources":{{site.baseurl}}/api/resources.html: All attributes are optional, unless otherwise marked as required. table(table table-bordered table-condensed). |_. Attribute|_. Type|_. Description|_. Notes| |name|string|The name of the container_request.|| |description|string|The description of the container_request.|| |properties|hash|Client-defined structured data that does not affect how the container is run.|| |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).| |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.| |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 ContainerRequest'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.| |container_count_max|integer|Maximum number of containers to start, i.e., the maximum number of "attempts" to be made.|| |mounts|hash|Objects to attach to the container's filesystem and stdin/stdout.|See "Mount types":#mount_types for more details.| |runtime_constraints|hash|Restrict the container's access to compute resources and the outside world.|Required when in "Committed" state. e.g.,
{
  "ram":12000000000,
  "vcpus":2,
  "API":true
}
See "Runtime constraints":#runtime_constraints for more details.| |container_image|string|Portable data hash of a collection containing the docker image to run the container.|Required.| |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.|| |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.| |command|array of strings|Command to execute in the container.|Required. e.g., @["echo","hello"]@| |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.| |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 ContainerRequests 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".| |expires_at|datetime|After this time, priority is considered to be zero.|Not yet implemented.| |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.|| h2(#mount_types). {% include 'mount_types' %} h2(#runtime_constraints). {% include 'container_runtime_constraints' %} h2(#container_reuse). Container reuse When a ContainerRequest 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 ContainerRequest. The serialized fields environment, mounts and runtime_constraints are sorted to facilitate comparison. 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 ContainerRequest and, * 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 * The oldest "Running" container with the highest progress, i.e., the container that is most likely to finish first * The oldest "Locked" container with the highest priority, i.e., the container that is most likely to start first * The oldest "Queued" container with the highest priority, i.e, the container that is most likely to start first {% include 'notebox_begin' %} Currently, container reuse is the default behavior and a mechanism to skip reuse is not supported. {% include 'notebox_end' %} h2(#cancel_container). Canceling a ContainerRequest A ContainerRequest may be canceled by setting it's priority to 0, using an update call. When a ContainerRequest 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.