Create your first Code Studio

Note

All the following sections assumes that you meet the prerequisites, and notably that you have Elastic AI setup, and a containerized execution configuration

Visual Studio Code

In this section, we will define a Code Studio template to run Visual Studio Code to interactively edit and debug Python recipes, libraries, …

Create a Code Studio template

  • In “Administration > Code Studios”, click Create Code Studio template and create a new template named vscode-template

  • In the “Definition” tab, click on Add a block and select Visual Studio Code

  • Click Build

Then in the “General” tab, you can grant permission to use to given DSS groups (or all), to control which user is allowed to make Visual Studio Code runtimes. The selected users can now create new Code Studios in their projects, using this template.

Launch a Code Studio instance

After having built a Code Studio template:

  • ensure the project is associated to a cluster, either by setting a default cluster in “Administration > Settings > Containerized execution” or by setting a cluster for the project in its “Settings > Cluster selection”

  • in the “Code Studios” section, click New Code Studio, select the vscode-template template, fill a name and create the Code Studio

  • once in the Code Studio, click Start

After the Code Studio has started, you can access a Visual Studio Code server instance. Work done in the Code Studio will usually materialize as modified files in the container. These would disappear when the Code Studio is stopped, so in order to safe keep them, synchronizing them back to the DSS server’s filesystem is needed with the Sync files with DSS button (see Editing files with Code Studio).

Edit a recipe

In your Visual Studio Code file explorer, you will see a folder called “recipes” listing all your DSS project recipes, open one recipe, edit it and then click Sync files with DSS. Now check that the recipe content has been updated in the DSS flow.

JupyterLab

In this section, we will define a Code Studio template to run JupyterLab in order to interactively edit and debug Python recipes, libraries, …

Create a Code Studio template

  • In “Administration > Code Studios”, click Create Code Studio template and create a new template named jupyter-lab-template

  • in the “Definition” tab, click on Add a block and select Jupyterlab server

  • Click Build

In the “General” tab, you can then grant access to some (or all) DSS groups, to control which users is allowed to start JupyterLab runtimes. In their projects, the selected users can now create JupyterLab Code Studios.

Launch a Code Studio instance

After having built a JupyterLab template:

  • ensure the project is associated to a cluster, either by setting a default cluster in “Administration > Settings > Containerized execution” or by setting a cluster for the project in its “Settings > Cluster selection”

  • in the “Code Studios” section, click New Code Studio, select the jupyter-lab-template template, fill a name and create the Code Studio

  • once in the Code Studio, click Start

After the Code Studio has started, you get access to a Jupyterlab server instance. Work done in the Code Studio will usually materialize as modified files in the container. These would disappear when the Code Studio is stopped, so in order to safekeep them, synchronizing them back to the DSS server’s filesystem is needed, with the Sync files with DSS button.

Streamlit

Create a Code Studio template

  • In “Administration > Code Studios”, click Create Code Studio template and create a new defined by building blocks template named streamlit-template

  • In the “Definition” tab, click on Add a block and select Streamlit

  • In the “Definition” tab, click on Add a block and select Visual Studio Code

  • Click Build

Then in the “General” tab, you can grant permission to use to given DSS groups (or all) to control which user is allowed to make Jupyterlab runtimes. The selected users can now create new Jupyterlab Code Studios in their projects.

Launch a Code Studio instance

Once the template is built, in a project with a cluster attached:

  • in “Code Studios” click New Code Studio

  • select the streamlit-template Code Studio template, and create a new Code Studio named Hello

  • [optional] start the code studio, edit the code_studio-versioned/streamlit/app.py file, then click Sync files with DSS

[optional] Publish your streamlit Code Studio as a webapp:

  • select the “Hello” Code Studio, and in its action panel, click Publish, then Create

  • in the “Edit” tab of the “Hello” webapp, make sure the exposition is set to Port forwarding. Usually this is the default at the instance level, but it can be overridden in the webapp’s “Advanced settings”

  • start the webapp and go to the “View” tab

RStudio Server

In this section, we will define a Code Studio template to run RStudio Server to interactively edit and debug R recipes, libraries, …

Create a Code Studio template

  • In “Administration > Code Studios”, click Create Code Studio template and create a new template named rstudio-template

  • in the “Definition” tab, click on Add a block and select RStudio

  • Click Build

Then in the “General” tab, you can grant permission to use to given DSS groups (or all) to control which user is allowed to make RStudio runtimes. The selected users can now create new RStudio Code Studios in their projects.

Launch a Code Studio instance

After having built a RStudio template:

  • ensure the project is associated to a cluster, either by setting a default cluster in “Administration > Settings > Containerized execution” or by setting a cluster for the project in its “Settings > Cluster selection”

  • in the “Code Studios” section, click New Code Studio, select the rstudio-template template, fill a name and create the Code Studio

  • once in the Code Studio, click Start

After the Code Studio has started, you can access a RStudio server instance. Work done in the Code Studio will usually materialize as modified files in the container. These would disappear when the Code Studio is stopped, so in order to safe keep them, synchronizing them back to the DSS server’s filesystem is needed with the Sync files with DSS button (see Editing files with Code Studio).

Edit a recipe

In your RStudio file explorer, you will see a folder called “recipes” listing all your DSS project recipes, open one recipe, edit it and then click Sync files with DSS. Now check that the recipe content has been updated in the DSS flow.