Managing Workspaces¶
To manage workspaces, go to the Workspaces page by clicking the IDE Workspaces link.
The following figure shows the Workspaces page. Each row displays information about a workspace such as its associated Leap project and has various actions that you can perform. For example, you can use the context menu (item 1 in the figure) to delete or download a specific workspace.

Fig. 123 Leap IDE Workspaces¶
Creating a Workspace¶
Create a workspace by clicking New Workspace and starting from a D-Wave example, a repository that you previously opened, or an existing GitHub repository, pull request, or branch by entering its URL on the From Context tab.
Alternatively, if you have an existing GitHub repository,
pull request, branch, or issue, you can create a Leap IDE workspace by prefixing
the URL https://ide.dwavesys.io/#
to your repository’s pull request, branch,
or issue URL as follows:
https://ide.dwavesys.io/#<github_url>
- <github_url>
The URL to your GitHub repository, pull request, branch, or issue.
For example,
https://ide.dwavesys.io/#https://github.com/myusername/myquantumapp
.
The GitHub repository files are opened in a Leap IDE workspace and the Leap IDE workspace Docker image brings in the preloaded environment. The workspace is associated with the API token of the active project 1 on the Leap dashboard; the Leap IDE frequently refreshes the associated project’s API token and gets the new one if it has changed. Solver-access time for problems submitted in a workspace is charged against the associated project. You can see the project with which a workspace is associated on the Workspaces page.
- 1
If you have a Trial or Developer Plan, you have only one project.
Stopping a Workspace¶
You stop a workspace to release the Leap compute resources that is it consuming; problems that you have submitted are not stopped and continue to run until they have completed on the solvers.
To conserve Leap compute resources, workspaces are automatically stopped either after 1 hour of mouse or keyboard inactivity or 3 minutes after the browser window or tab is closed.
To stop a workspace, click the workspace’s Stop button.
Opening a Workspace¶
To open a workspace, click the workspace’s Open button.
If the workspace was stopped, it might take longer to open because the Docker image and other resources must be loaded again.
Searching for a Workspace¶
To search for a workspace by name or context (that is, the repository’s URL), enter part of the workspace name or context for which to search in the Search Workspaces field.
Downloading a Workspace¶
You can download your entire workspace in a tar file, which you can use as a backup or for debugging. You can use the GitHub repository files in the tar file to create a new repository.
To download your workspace, select the > Download
context menu for a workspace row.
Pinning a Workspace¶
You can pin a workspace to prevent it from being automatically deleted after 21 days of inactivity. When your reopen a pinned workspace, be aware that it might not have the latest Leap IDE workspace Docker image. To get the latest Docker image, push your changes to the workspace’s GitHub repository and create a new workspace for the repository.
To pin a workspace, click the workspace’s Pin button;
the pinned workspaces are displayed at the top of the list of workspaces
in the Pinned workspaces section.
Deleting a Workspace¶
Select the > Delete context menu for a workspace row.
Granting Permissions to a GitHub Repository¶
You grant the Leap IDE permission to write to your GitHub repository as follows:
On the Workspaces page, select the your_user_name > Settings > IDE Workspaces tab.
Click the GitHub … > Edit Permissions menu and do one of the following:
If your repository is private, select repo.
If your repository is public, select public_repo.
Note
If you converted your Trial Plan account to a Developer Plan to get more solver-access time, you should have been prompted to provide your GitHub credentials.
Finding a Workspace’s Leap Project Name¶
To find the name of the Leap project associated with the workspace, execute the following command in the terminal:
leapide workspace
The project name, project code (which is the API token prefix), project ID (which is for internal use), and workspace ID are displayed.
Note
The leapide --help
command prints a description of commands.
Finding a Workspace’s API Token¶
To find the API token associated with a workspace, execute the following command in the terminal:
dwave config inspect
For more information, see the Ocean dwave CLI documentation.
Charging Solver-Access Time to a Different Leap Project¶
This section describes how charging solver-access time is related to the Leap project, API token, and workspace.
By default, a workspace is associated with the Leap project that was active when the workspace was created and solver-access time is charged to that Leap project. The Leap project’s API token, which is stored in an Ocean configuration file, associates the workspace with the Leap project. While the workspace is running, the API token is frequently fetched from the associated Leap project.
Thus, to change the Leap project that solver-access time is charged against,
change the API token that the workspace uses.
You can globally override the default API token for one or more workspaces
or locally set an API token in a workspace terminal. In both cases,
you specify the new API token
in the DWAVE_API_TOKEN
environment variable;2
the environment variable’s API token overrides the API token that is stored
in the Ocean configuration file.
Note
To find the Ocean configuration file, execute
dwave config ls
in the terminal.The API token for the active Leap project is displayed on the Leap dashboard.
- 2
You can also override the API token in Ocean. For information, see the Ocean dwave-cloud-client Configuration documentation.
Globally Overriding the Default API Token¶
You can globally override the default API token for one or more workspaces that are in a particular scope (that is, a GitHub organization and repository); that is, whenever a workspace that is in scope starts, the new API token is used instead of the default API token.
Note
You must restart any running workspaces for the new API token to take effect for that workspace.
To globally override the default API token, create a DWAVE_API_TOKEN
environment variable that specifies the new API token and scope in
in the Leap Settings > IDE Workspaces > Variables section.
Scope is specified in the Scope field, which determines the workspaces
to which the DWAVE_API_TOKEN
environment variable applies.
The Scope field format is owner/repository, where:
- owner
Name of the GitHub owner.
- repository
Name of the GitHub repository.
Some examples are as follows:
*/*
(Default) All workspaces.
dwave-example/factoring
You can also use a workspace’s .bashrc
file to override
the default API token or the one set in Leap settings
by adding the DWAVE_API_TOKEN
environment variable (without the scope)
to the .bashrc
file.
Locally Setting a New API Token in the Terminal¶
In the local workspace terminal, you can set a new API token that applies to either all the commands run in the current terminal or the current command only.
To set a new API token for a terminal, execute the following command in the workspace terminal:
export DWAVE_API_TOKEN=<token>
- <token>
The API token for a different project.
Now you can run your program with the new API token in the terminal as follows:
python <file_name>.py
- <file_name>
The file name of the program.
To run a program once only with a new API token, include the command for running the program on the same line as setting the environment variable as follows:
DWAVE_API_TOKEN=<token> python <file_name>.py
Configuring Advanced Options¶
This section describes advanced configuration options.
Automatically Installing Repository Requirements¶
To open a repository with your required packages loaded,
create a .gitpod.yml
YAML file in the repository’s root directory
and include the following tasks
section:
tasks:
- init: pip install -r requirements.txt
For an example, see the D-Wave portfolio optimization example.
For more information about the .gitpod.yml
file,
see https://www.gitpod.io/docs/config-gitpod-file/.
Adding Your Own Dockerfile¶
If the Leap IDE Docker image does not include the tools and libraries you need for your project, you can add them to your own Dockerfile. If you have small modifications to make to the Leap IDE Docker image, you could build on top of that image.
The Leap IDE uses a Docker image, dwavesys/leapide:latest-v2-prod
,
based on Python 3.9.
To build on top of it, your Dockerfile
(which must be referenced from
.gitpod.yml
) should look like the following:
FROM dwavesys/leapide:latest-v2-prod
USER root
# install system packages
RUN apt-get update \
&& apt-get install -yq --no-install-recommends \
clang \
libboost-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/*
# install system-wide python package
RUN pip install --no-cache-dir \
dwave-ocean-sdk==4.0.0 \
&& rm -rf /tmp/*
For more information about Gitpod Docker images, see https://www.gitpod.io/docs/config-docker.