Using JupyterLab in Code Studios#

In this article, we will cover the main features and use cases of JupyterLab for Code Studio. If you want to know what can be edited in Code Studio and, by extension, in JupyterLab, please refer to this page.

Prerequisites#

To use JupyterLab in Code Studios, you need a Dataiku 11+ instance with:

  • A working Code Studio instance with a JupyterLab block

  • A configured Kubernetes cluster

  • An instance set up for Elastic AI computation created by an admin user

Editing a Dataiku recipe#

JupyterLab in Code Studios allows you to quickly and dynamically edit your code recipe created in the Flow.

  1. From the Flow, open the code recipe you wish to edit.

  2. In the top-right corner, click on Edit in Code Studio and select your Code Studio instance.

Edit a recipe from the recipe page

You can also access your recipe directly from JupyterLab in Code Studios:

  1. From the left panel, navigate to the recipes folder.

  2. Click the recipe you want to edit to open it in the center panel as a Python file.

Note

You can execute your code in a Code Studio. However, to create a new recipe or build the output, you still have to do it from the Flow.

If you want to run the recipe, you need to create a Launcher by clicking the + button (in the JupyterLab interface) and then selecting the right launcher, as shown in the figure below. Then you can use the usual commands to run the recipe (%run+Tab, or ). The list of commands is accessible by typing %+Tab in the launcher.

How to create a Launcher

Debugging a Dataiku recipe#

You can use JupyterLab debugging tools on a code recipe in a Code Studio, just as you would on local JupyterLab. Several commands trigger a debugger to allow a traceback when raising an exception. To name a few, you can use:

  • %debug

  • %pdb

Editing a Jupyter Notebook#

Editing a notebook in a Code Studio is the same process as editing a recipe. To do so:

  1. Go to the Notebook page (G+N) and select a notebook to edit.

  2. In the top right corner, click Edit in Code Studio.

Alternatively, you can edit your notebook from your Code Studio instance. To do so:

  1. From the left panel, navigate to the notebook folder.

  2. Select the notebook you want to open.

Unlike the recipe, you can create a new notebook directly from a Code Studio:

  1. Click File > New > Notebook and select the type of notebook you want to create.

  2. Click Sync files with DSS to save it to Dataiku.

  3. Go to the Notebook page (G+N) to access your new notebook.

Wrapping up#

Congratulations, you should now have a functional setup to leverage JupyterLab in Code Studios to edit your code in Dataiku as if you were working with your local JupyterLab!