This page outlines how to configure and start the notebook environment.
Manage the notebook environment¶
Before you create and execute code, click the environment icon to configure the notebook's environment. The environment image determines the coding language, dependencies, and open-source libraries used in the notebook. The default image for the DataRobot Notebooks is a pre-built Python image. To see the list of all packages available in the default image, hover over that image in the Environment tab:
The screenshot and table below outline the configuration options available for a notebook environment.
|Start environment toggle||Starts or stops the notebook environment's kernel, which allows you to execute the notebook's code cells.|
|リソースタイプ||Represents a machine preset, specifying the CPU and RAM you have on your machine where the environment's kernel runs.|
|画像||Determines the coding language and associated libraries that the notebook uses.|
|ランタイム||Indicates the CPU usage, RAM usage, and elapsed runtime for the notebook's environment during an active session.|
|Session timeout||Limits the amount of inactivity time allowed before the environment stops running and the underlying machine is shut down. The default timeout on inactivity is 60 minutes, and the maximum configurable timeout is 180 minutes.|
To begin a notebook session where you create and run code, start the environment. Wait a moment for the environment to initialize, and once it displays the Started status, you can begin editing. Note that session will automatically shut down on inactivity when the timeout is reached. The session is considered inactive when the notebook has no running cells and no changes have been made to the notebook contents in the time set by the session timeout value.
From the notebook dashboard, you can view the status of all notebook environments.
Note that you can only run up to two active notebook sessions at the same time.
Built-in environment images¶
DataRobot maintains a set of built-in Docker images that you can select from to use as the container image for a given notebook.
DataRobot provides the following images:
Python 3.9 image: Contains Python version 3.9, the DataRobot Python client, and suite of common data science libraries.
Python 3.8 image: Contains Python version 3.8, the DataRobot Python client, and suite of common data science libraries. Most notably, this image comes preinstalled with the dependencies needed to work with Snowflake. These libraries include the Snowflake Python Connector and Snowpark (which requires Python 3.8).
R 4.2 image: Contains R version 4.2, the DataRobot R client, and a suite of common data science libraries.
If you need to reference sensitive strings in a notebook, rather than storing them in plain text within the notebook you can use environment variables to securely store the values. These values are stored encrypted by DataRobot. Environment variables are useful if you need to specify credentials for connecting to an external data source within your notebook, for instance.
Whenever you start a notebook session, DataRobot sets the notebook's associated environment variables in the container environment, so you can reference them from your notebook code using the following code:
import os KEY = os.environ['KEY'] # KEY variable now references your VALUE
KEY = Sys.getenv("KEY")
To access environment variables, click the lock icon in the sidebar.
Click Create new entry.
In the dialog box, enter the key and value for a single entry, and provide an optional description.
If you want to add multiple variables, select Bulk import. Use the following format on each line in the field:
KEY=VALUE # DESCRIPTION
When you have finished adding environment variables, click Save.
Edit existing variables¶
You can also edit and delete a notebook’s associated environment variables from the Environment variables panel:
- Click the pencil icon on a variable to edit it.
- Select the eye icon to view a hidden value.
- Click the trash can icon to delete a variable.
- Click Insert all to insert a code snippet that retrieves all of the notebook's environment variables and includes them in the notebook.