Connect a local IDE to a codespace¶
You can open a DataRobot codespace from a local editor such as Visual Studio Code (VS Code). The DataRobot CLI starts an SSH tunnel to the codespace, then VS Code connects to that host with Remote-SSH.
This procedure uses the DataRobot CLI and an SSH client. The steps below are written for VS Code. Other editors that use OpenSSH and your local SSH config can connect to the same host alias.
本機能の提供について
The Python 3.13 notebook environment required for this connection is available on Multi-tenant SaaS and on Self-managed in DataRobot version 11.11 and later. Select that image for the codespace; it is not the default environment.
After you connect, you can:
- Browse and edit files in the codespace persistent file system (
/home/notebooks/storage). - Use a remote terminal in your local editor.
- Run local editor extensions, including AI coding assistants, against the remote files.
前提条件¶
Before you connect:
- A codespace configured to use the Python 3.13 notebook environment. Other built-in images do not serve the SSH endpoint. See Built-in environment images.
- The DataRobot CLI (
dr). - An OpenSSH-compatible client on your machine (included with macOS and most Linux distributions; on Windows, install the OpenSSH Client optional feature).
- VS Code with the Remote-SSH extension.
Standalone notebooks
This connection works with codespaces. It does not work with standalone DataRobot Notebooks. the notebook must be converted to a codespace first.
Install the CLI plugin¶
-
Install the DataRobot CLI if it isn't already available. See Getting started with the DataRobot CLI.
curl https://cli.datarobot.com/install | shirm https://cli.datarobot.com/winstall | iex -
Install the codespace plugin.
dr plugin install codespaceThe plugin manifest name is
codespace.dr pluginanddr pluginsare aliases; DataRobot CLI examples use the singular form.
認証¶
Point the CLI at your DataRobot host and sign in.
dr auth login
dr auth set-url https://<your-datarobot-host>
dr auth login
On Windows, if your DataRobot host uses a private certificate authority, pass --export-windows-certs before auth. This flag is available only in Windows installations of the CLI:
dr --export-windows-certs auth login
Global CLI flags must appear before the subcommand. For more authentication options, see Authentication management.
Start the SSH tunnel¶
The codespace ID is the last segment of the codespace URL:
https://<datarobot-host>/usecases/<use-case-id>/notebooks/<codespace-id>
For example, in https://app.datarobot.com/usecases/64594cf462348c3004202c52/notebooks/6a34200b438c6e4a4518b049, the codespace ID is 6a34200b438c6e4a4518b049.
From a local terminal, start the tunnel. Leave this process running for the rest of the session.
To connect to a specific codespace, pass its ID. If that session is stopped or completed, the CLI starts it and waits until it is ready:
dr codespace ssh 6a34200b438c6e4a4518b049
To connect to a codespace that is already running without copying an ID from the URL, omit the ID:
dr codespace ssh
The command writes a host alias to your SSH config (~/.ssh/config on macOS and Linux, or %USERPROFILE%\.ssh\config on Windows). The alias is drcs- followed by the last eight characters of the codespace ID. In the example above, the host is drcs-4518b049.
While the CLI process is running, it keeps the codespace session from shutting down due to inactivity.
Connect from VS Code¶
- In VS Code, open the Command Palette and select Remote-SSH: Connect to Host.
- Choose the
drcs-<last-eight-characters-of-the-codespace-id>host (for example,drcs-4518b049). - When the remote window opens, choose Open Folder and select
/home/notebooks/storage.
Edit files and use a remote terminal against the codespace file system.
Isolated networks¶
If the remote environment cannot download the VS Code server from the public internet, download the server on your local machine instead. In VS Code, set the Remote-SSH setting remote.SSH.localServerDownload to always.
If you reach DataRobot through an HTTP forward proxy, set the HTTPS_PROXY environment variable in the terminal where you run the CLI, then start the tunnel from that same terminal.
注意事項¶
- Select the Python 3.13 environment image. Other images do not expose SSH.
- Only the persistent
storage/directory is available over SSH. - The CLI starts a stopped or completed session when you pass a codespace ID. It does not list or stop codespaces.
- Connecting to more than one codespace at a time is not supported.
- Windows Subsystem for Linux is not supported.
トラブルシューティング¶
| 問題 | 確認事項 |
|---|---|
| Remote-SSH cannot find the host | Leave dr codespace ssh running so the CLI can write the SSH config entry. The host name is drcs- plus the last eight characters of the codespace ID, not the full ID. |
| Connection fails immediately | Confirm the codespace uses the Python 3.13 environment image. If you omitted the ID, confirm a session is already running, or pass the codespace ID from the URL. |
| TLS / certificate errors on Windows | Sign in with dr --export-windows-certs auth login. This flag is available only on Windows. |
| VS Code server download fails | Set remote.SSH.localServerDownload to always so the client copies the server onto the remote host. |
| Requests to DataRobot fail behind a proxy | Set HTTPS_PROXY in the terminal that runs the CLI. |
| Session shuts down while you are connected | Keep the dr codespace ssh process running in the foreground. |
次のステップ¶
- Codespace sessions: Create files, manage Git, and configure the codespace before you connect from a local editor.
- Environment management: Select the Python 3.13 image and configure resources for the codespace.
- Getting started with the DataRobot CLI: Install, update, and authenticate the CLI.