# Containers for Execution

The Platform supports three types of containers related to job execution:

1. [**Temporary workspace**](https://documentation.dnanexus.com/developer/api/running-analyses/..#project-context-and-temporary-workspace): created whenever an app or applet is run
2. [**Project cache container**](https://documentation.dnanexus.com/developer/api/apps#app-workspace-and-containers): container in which data can be cached for future execution by the same version of an app. It is always associated with a particular project
3. [**Resources container**](https://documentation.dnanexus.com/developer/api/apps#app-workspace-and-containers): created during app creation, containing any resources the app requires for execution

The table below summarizes the permissions that a job running the associated applet or app receives, as well as the maximum permissions a member of the project context can receive (they must have equal or greater permissions in the project).

| Container           | Job        | Project Member                        |
| ------------------- | ---------- | ------------------------------------- |
| Temporary workspace | CONTRIBUTE | VIEW                                  |
| Project cache       | CONTRIBUTE | CONTRIBUTE                            |
| Resources container | VIEW       | VIEW if app developer, NONE otherwise |

Jobs running other applets or apps can access the resources container of an app with VIEW permissions only if they have been granted access to act on behalf of the user as a developer.

## Containers for Analyses

Analyses also have temporary workspace containers that are created on their behalf. These containers are used primarily by the system for storing intermediate results for the analysis, and are not meant to be accessed directly by users or jobs. These containers are cleaned up after the associated analysis has transitioned to a terminal state.

## Container API Method Specifications

### API method: `/container-xxxx/describe`

#### Specification

Describes the specified container.

#### Inputs

* `fields` **mapping** (optional) Restrict the output of this method to have only the provided keys in this field.
  * **key** — Output field to include or exclude. See the "Outputs" section below for valid values.
  * **value** **boolean** — The value `true`.

#### Outputs

* `id` **string** ID of the container in the format "container-xxxx"

The following fields are included by default (but can be disabled using `fields`):

* `class` **string** The value "container".
* `name` **string** The name of the container.
* `region` **string** The region this container resides in. For more information about regions, see [Regions](https://documentation.dnanexus.com/developer/api/regions).
* `billTo` **string** ID of the account to which any costs associated with this container are billed.
* `type` **string** The type of container: one of `temporary` (for applet/app execution), `cache` (for apps), or `resources` (for apps).
* `created` [**timestamp**](https://documentation.dnanexus.com/developer/api/..#data-types) Time at which this container was created.
* `modified` [**timestamp**](https://documentation.dnanexus.com/developer/api/..#data-types) Time at which this container was last updated.
* `level` **string** The highest permissions level that the requesting user has. This field is only returned when called directly, that is, it does not show up in the `describe` values returned in [`/system/findProjects`](https://documentation.dnanexus.com/developer/search#api-method-system-findprojects).
* `dataUsage` **number** Data usage in GB (not including sponsored data). A short amount of time may elapse between changes to the container and when this number is updated.
* `sponsoredDataUsage` **number** Sum of DNAnexus-sponsored and third-party sponsored data usage in GB. A short amount of time may elapse between changes to the container and when this number is updated.

The following fields (included by default) are available if `type` is "temporary" or "cache":

* `project` **string** The associated project context.

The following fields (included by default) are available if `type` is "cache" or "resources":

* `app` **string** ID of the associated app.
* `appName` **string** Name of the associated app.

The following fields (included by default) are available if `type` is "temporary", the associated job was run with `delayWorkspaceDestruction` set to true, and the job has finished (successfully or not):

* `destroyAt` [**timestamp**](https://documentation.dnanexus.com/developer/api/..#data-types) Time after which this container is automatically destroyed.

The following fields are only returned if the corresponding field in the `fields` input is set to true:

* `folders` **array of strings** List of all folders in the container.
* `egressBillTo` **string** The value of the `egressBillTo` property, inherited from the project that the container is associated with at the time of the container's creation.
* `fileUploadParameters` **mapping** Information about what part sizes and numbers should be used to [`/file-xxxx/upload`](https://documentation.dnanexus.com/developer/introduction-to-data-object-classes/files#api-method-file-xxxx-upload) files in this container. See the section [Limits on Parts](https://documentation.dnanexus.com/developer/introduction-to-data-object-classes/files#limits-on-parts) of the Files API for more information about interpreting this.
  * `minimumPartSize` **integer** Minimum part size, in bytes, that applies to all parts except the part with the highest index. Clients may assume that if `emptyLastPartAllowed` is `false`, then `minimumPartSize` is at least 1, that is, the constraint on the last part is no stronger than the constraint on previous parts.
  * `maximumPartSize` **integer** Maximum part size, in bytes.
  * `emptyLastPartAllowed` **boolean** If `true`, then the minimum number of parts is 1 and the part with the highest index may contain 0 bytes. If `false`, then the minimum number of parts is 0 and the part with the highest index must contain at least 1 byte. All parts other than the part with the highest index must still have a minimum size given by `minimumPartSize`. If `true`, then the client can upload a 0-byte file by invoking [`/file-xxxx/upload`](https://documentation.dnanexus.com/developer/introduction-to-data-object-classes/files#api-method-file-xxxx-upload) once with a part of size 0. If `false`, then the client can upload a 0-byte file by *not* invoking `/file-xxxx/upload` at all.
  * `maximumNumParts` **integer** The maximum number of parts that may be uploaded (also equal to the largest permissible part index).
  * `maximumFileSize` **integer** The maximum size of the file, in bytes.

#### Errors

* ResourceNotFound (the specified container does not exist)
* InvalidInput (the input is not a hash, `folders` (if provided) is not a boolean)
* PermissionDenied (VIEW access required)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.dnanexus.com/developer/api/running-analyses/containers-for-execution.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
