How to create a capsule in 5 minutes

Creating a new capsule

To create a new capsule:

  1. Click Add capsule

  2. Click Create New Instructions to Copy from public git and Clone from git are provided here.

Building a compute capsule

There are three main components of a Code Ocean capsule:

  • File tree

  • Environment

  • Timeline

Configuring the environment

Select your preferred environment from the list of options, in this example, Python is chosen.

To customize the environment, install packages using the appropriate package manager. In this example pip is used to install matplotlib. A version number can be specified. by default the latest version is used.

Adding code and data to complete a first run

To add sample code using the existing template, go to the left panel below results.

Click Start with Sample Files. Files will appear in the folders above.

Click Reproducible Run, to see the results generated from sample files. A Reproducible Run executes the preconfigured run bash script. A more detailed description of the Reproducible Run is provided here.

After a successful Reproducible Run, it is good practice to commit changes to ensure a fully functional version of the capsule is documented in the Timeline.

Viewing Results

The results from each Reproducible Run can be accessed from the capsule timeline. The results directory contains the output from the most recent Reproducible Run.

Launching a Cloud Workstation

The Cloud Workstation is integrated into the right panel to easily launch a development session that enables you to interactively run a compute capsule. It works best for exploring data of testing ideas. Code Ocean offers seven built-in development environment tool options for use with the Cloud Workstation.

Conclusion

From the capsule dashboard you can navigate to the gallery page which contains a subset of publicly available capsules. These capsules are a good starting point to explore what’s possible in Code Ocean. They can be duplicated if you’d like to use them in your own project.

Last updated