Computation

Prerequisites

The Computation ID can only be accessed from the Computation Object.

A typical use case is to use:

Both methods will have the Computation ID in the Response that can be used in Computations API for further tracking and getting results.

circle-info

When running a Pipeline, the Data Asset mount point will be the mount point of the Data Asset currently attached to the Pipeline. If the Pipeline does not have a mount point accessible (from a Data Asset) and the user attempts to run the Pipeline with a replaced Data Asset in the API, they will encounter an error due to an incorrect file path.

When replacing Data Assets, it is only possible to replace External Data Assets with other External Assets and Internal Data Assets with other Internal Assets.

  • id string

    Computational id

  • created float64

    Computation create time

  • name string

    Display name of the Computation

  • run_time integer

    Total run time in seconds

  • cloud_workstation boolean Indicates whether this Computation is a cloud workstation

  • state enum

    • initializing, running, finalizing, completed

  • end_status enum

    • stopped, failed, succeeded

  • exit_code integer

    Value will be 0 when the code runs successfully and non-zero when it doesn't. Any error in a Pipeline will have an exit code value of 1. Only exists once state (above) is completed.

  • has_results boolean

    Indicates whether the Computation has results

  • parameters array (Optional)

    Run parameters

    • name string

      Parameter name

      • value string Parameter value

  • data_assets array<dictionary> (Optional)

    Attached Data Assets

    • id string

      Attached Data Asset ID

    • mount string

      Attached Data Asset mount

  • nextflow_profile string (Optional) Pipeline Nextflow profile

  • processes array<dictionary> (Optional) Pipeline processes information

    • name string Pipeline process name (as it appears in the main.nf)

    • capsule_id string ID of the Capsule executed in the process

    • version boolean Capsule version in case it's Released

    • public boolean Indicates the Capsule is a Code Ocean App

    • parameters array<dictionary> Run Parameters

      • name string Parameter Label

      • param_name string Parameter Name

      • value string Parameter Value

Get Computation

GET https://{codeocean-domain}/api/v1/computations/{computation_id}

This API allows for the retrieval of information from a Computational run.

Path Parameters

Name
Type

computation_id*

string

Scope

Type
Permission

Capsule

Read

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag
chevron-rightResponsehashtag

List Computation Result Files

POST https://{codeocean-domain}/api/v1/computations/{computation_id}/results

This API allows for listing of result files generated by a Computation.

Path Parameters

Name
Type

computation_id*

string

Request Body

Name
Type
Description

path

string

The path of the folder. Empty path will retrieve the /results root folder.

Scope

Type
Permission

Capsule

Read

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag
chevron-rightResponsehashtag

Get Result File URLs

GET https://{codeocean-domain}/api/v1/computations/{computation_id}/results/urls?path={path_to_file}

This API allows for the generation of two URLs to a Computation result file:

  • download_url - signed URL for downloading the file

  • view_url - signed URL for viewing the file in the browser

circle-info

This API was introduced in Code Ocean version 4.0. The previous Get Result File Download URL API is deprecated but will be supported until August 2026.

Path Parameters

Name
Type

computation_id*

string

path_to_file*

string

Scope

Type
Permission

Capsule

Read

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag
chevron-rightResponsehashtag
  • download_url string Download file URL

  • view_url string View file URL

Delete Computation

DELETE https://{domain}/api/v1/computations/{computation_id}

This API allows for the deletion of a Computational run. If it is running, the Computation will stop.

Path Parameters

Name
Type

computation_id*

string

Scope

Type
Permission

Capsule

Read/Write

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Rename Computation

PATCH https://{domain}/api/v1/computations/{computation_id}?name={computation_name}

This API allows for the renaming of an existing Computational run immediately after it has been initiated.

Request Body

Name
Type

computation_id*

string

computation_name

string

Scope

Type
Permission

Capsule

Read/Write

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Capsule

POST https://{domain}/api/v1/computations

This API allows for the running of Capsules/Pipelines with Data Assets and Ordered or Named Parameters.

Prerequisite

Before using this API call, you may need AWS Cloud Credentials configured as Secrets or an Assumable Role, if you are using Data Assets from Cloud Resources.

Request Body

Name
Type

capsule_id*

string

pipeline_id

string

nextflow_profile

string

data_assets*

array<dict>

id*

string

mount

string

parameters

array<string>

named_parameters

array<dict>

processes

array<dict>

Scope

Type
Permission

Capsule

Read/Write

Data Asset

Read

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag
chevron-rightResponsehashtag

Run Capsule with Data Assets and Ordered Parameters

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Capsule with Data Assets and Named Parameters

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Pipeline

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Pipeline with Data Assets and Ordered Capsules

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Pipeline with Data Asset and Named Capsules

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Run Pipeline with Data Assets and Ordered + Named Capsules

chevron-rightRequest Example Bashhashtag
chevron-rightRequest Example Python SDKhashtag

Last updated

Was this helpful?