Mapping concepts between Posit → Code Ocean development environments

To help ease the transition for users currently using Posit, we wanted to provide a mapping of familiar concepts there to new concepts & processes available on Code Ocean. These will be formulated below as [Concept on Posit] → [Equivalent concept or similar process on Code Ocean].

Posit: Session → Code Ocean: Cloud workstation

On Posit workbench, you are probably familiar with the concept of launching a session. This entails specifying some details about the compute resources you’d like to access, the type of session you’d like to launch, and clicking start.

On Code Ocean, this process is configured a bit differently. All computation is done in the context of a compute capsule. The specification of compute resources is done in the environment editor for your capsule. You will also have the option of selecting a starter image, which determines which software tools will come pre-installed in your capsule. We will be able to provide the best support for your workflow if you are using the latest release of one of the starter images created by Enable medicine.

Note another important difference—if you install new packages on Code Ocean, those installations will only persist if you put your capsule on hold, or add them to the capsule’s image using the environment editor.

See our guide to Configuring and starting a cloud workstation for a quick way to get started in compute sessions like what you’re used to from Posit.

Posit: Your home directory → Code Ocean: A data asset

On Posit workbench, each user had a read/write home directory that would be attached to any session that user started.

Code Ocean has a very different way of managing data from Posit Workbench, and a user-specific home directory no longer makes sense when each capsule is intended to be modular and self contained, and therefore more shareable and reproducible. To ease the transition from Posit to Code Ocean, your home directory on Posit has been saved to a bucket in AWS S3, and you have been provisioned with AWS credentials that allow access to this bucket. You can incorporate this into your Code Ocean computation by importing the data from S3 into a data asset (see code ocean documentation for a guide to creating a data asset from a cloud provider like AWS S3). This S3 bucket is named according to the pattern enablemedicine-{colab|converge}-co-{portal username} where {colab|converge} should be filled in with the name of the Posit deployment your account was on (either colab.analysis.enablemedicine.com or converge.analysis.enablemedicine.com).

<aside> 🌠 Before you can import the data asset, you must set up your AWS credentials as a secret (see Guide to User Secrets on Code Ocean)

</aside>

To access any data you want from this data asset, simply attach it to a compute capsule, where it will appear in the folder /data. After data has been read from this asset, it can be transferred into the capsule’s /scratch folder for work-in-progress, or to the /results folder to be saved as a new data asset. Any scripts you would like to work on should be moved to the /code folder.

<aside> 💡

IMPORTANT NOTE: Any changes in files or folders outside of /capsule will not persist after a cloud workstation session has been shut down. New files in /results will be saved when the session is shut down, and can be saved as a new data asset, but will not persist in that folder when another cloud workstation is started up.

</aside>

Note that previous flows written on posit workbench often read and write SpatialMap objects from disk in the same location. You can replicate this behavior by transferring data into /scratch before working on it—files saved in scratch will persist between Cloud Workstation sessions even when they are put on hold or shut down. This folder is useful because it does not count against your capsule’s data storage limit.

For more info on data management in Code Ocean, and a suggested workflow for data management using an external data asset linked to a bucket in AWS S3, see our guide to Data management on Code Ocean

Posit: Project sharing → Code Ocean: Capsule sharing

On Posit workbench, it’s possible to set up a project and share the contents of that project with another scientist for collaboration.

On Code Ocean, sharing a capsule will allow collaboration with other scientists. One key difference to note—only one user is able to edit a capsule at a time, or run a cloud workstation on that capsule at a time. If you’d like to allow another scientist to work on a capsule, remember to close (either “hold” or “shut down”) any cloud workstations you have running on that capsule, and to click “stop editing” at the top of the screen. See our guide to Sharing assets within Code Ocean for more details and recommendations for securely sharing assets.

Posit: Your .Renviron or .Pythonenv file → Code Ocean: User secrets and capsule environment variables