Skip to content

Commit 13cead9

Browse files
committed
Can specify CRN or instance name
1 parent c7c8b26 commit 13cead9

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

docs/guides/cloud-setup.mdx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,24 @@ Your user account is associated with one or more [instances](./instances) that g
4949

5050
1. Find your access credentials.
5151
1. Find your API key. From the [dashboard](https://quantum.cloud.ibm.com/), create your API key, then copy it to a secure location so you can use it for authentication.
52-
2. Find your CRN from the Instances section of the dashboard. Click the icon to copy your CRN for the instance you want to use, then save it in a secure location so you can use it for authentication.
52+
2. Optional: Find your CRN from the Instances section of the dashboard. Click the icon to copy your CRN for the instance you want to use, then save it in a secure location so you can use it to identify the instance.
5353

5454
1. <span id="cloud-save"></span>**If you are working in a trusted Python environment (such as on a personal laptop or workstation),** use the `save_account()` method to save your credentials locally. ([Skip to the next step](#cloud-untrusted) if you are not using a trusted environment, such as a shared or public computer, to authenticate to IBM Cloud.) To use `save_account()`, activate a Python virtual environment. Then, run Python in your virtual environment and enter the following:
5555

5656

5757
```python
5858
token = "<your-API-token>"
5959
```
60+
<Admonition type="Note">
61+
When an instance CRN or name is passed in, only backends and jobs from that instance are available. If an instance is not specified, all backends and jobs across all instances in your account are available. In this case, when a backend is specified, an instance that can access that backend is found and used.
62+
</Admonition>
6063

6164
```python
6265
from qiskit_ibm_runtime import QiskitRuntimeService
6366
service = QiskitRuntimeService.save_account(
6467
token=token, # Your token is confidential.
6568
# Do not share your key in public code.
66-
instance="<IBM Cloud CRN>",
69+
instance="<IBM Cloud CRN or instance name>", # Optionally specify the CRN to use.
6770
name="<account-name>", # Optionally name this set of account credentials.
6871
set_as_default=True, # Optionally set these as your default credentials.
6972
)
@@ -101,7 +104,7 @@ Your user account is associated with one or more [instances](./instances) that g
101104
service = QiskitRuntimeService(
102105
# Delete your key on the API keys page after entering this code:
103106
token="<IBM Cloud API key>",
104-
instance="<IBM Cloud CRN>"
107+
instance="<IBM Cloud CRN or instance name>"
105108
)
106109
```
107110

docs/guides/instances.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The instances that you can access are listed at the bottom of your [Account page
3434
<CloudContent>
3535
Access to IBM Quantum Platform services is controlled by the **instances** to which you are assigned. Users can belong to more than one instance at any given time.
3636

37-
An instance is a deployment of Qiskit Runtime. You need a different instance for every service plan (such as Open or Standard) you use in every region that you want to use. The account manager and anyone with enough permission can create an instance and define its configuration, such as its allocations, usage limits, quantum computers, and user permissions. Each instance is identified by a unique Cloud Resource Name (CRN). This CRN is used when sending workloads from your Qiskit programs.
37+
An instance is a deployment of Qiskit Runtime. You need a different instance for every service plan (such as Open or Standard) you use in every region that you want to use. The account manager and anyone with enough permission can create an instance and define its configuration, such as its allocations, usage limits, quantum computers, and user permissions. Each instance is identified by a unique Cloud Resource Name (CRN). This CRN can be used when sending workloads from your Qiskit programs.
3838

3939
The IBM Quantum Platform [dashboard](https://quantum.cloud.ibm.com/) displays the instances to which you have access. You can view full details, edit, and delete instances on the [Instances page.](https://quantum.cloud.ibm.com/instances)
4040

@@ -130,10 +130,15 @@ If you do not specify an instance, the code will select one in the following ord
130130

131131
</LegacyContent>
132132
<CloudContent>
133-
You must use the CRN to specify an instance to use; either when initializing the service or when sending the workload to a QPU. The instance's CRN is listed on the [Platform dashboard](https://quantum.cloud.ibm.com/). Before running the below code, follow the steps to [save an account.](/docs/guides/cloud-setup#cloud-save)
133+
You can use the CRN or instance name to specify an instance to use; either when initializing the service or when sending the workload to a QPU. When an instance is passed in, only backends and jobs from that instance are available.
134+
135+
If an instance is not included, all backends and jobs across all instances in your account are available. In this case, when a backend is specified, an instance that can access the backend is found and used.
136+
137+
The instance's CRN is listed on the [Platform dashboard](https://quantum.cloud.ibm.com/). Before running the below code, follow the steps to [save an account.](/docs/guides/cloud-setup#cloud-save)
134138

135139
```python
136-
# Specify an instance at service level. This becomes the default unless overwritten.
140+
# Optional: Specify an instance at service level.
141+
# This becomes the default unless overwritten.
137142
service = QiskitRuntimeService(instance="<CRN>")
138143
backend = service.backend("<QPU-name>")
139144
```

docs/guides/retired-qpus.mdx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,16 @@ jobs = service.jobs(backend_name=<backend_name>)
104104
```
105105
</LegacyContent>
106106
<CloudContent>
107+
108+
<Admonition type="Note">
109+
Passing in a Cloud Resource Name (CRN) or name in the following code is optional. When it is passed in, only backends and jobs from that instance are available. If an instance is not specified, all backends and jobs across all instances in your account are available. In this case, when a backend is specified, an instance that can access that backend is found and used.
110+
</Admonition>
111+
107112
```python
108113
from qiskit_ibm_runtime import QiskitRuntimeService
109114

110-
# Load your IBM Quantum account(s). Replace "<IBM Cloud CRN>" with your desired instance's CRN
111-
service = QiskitRuntimeService(channel="ibm_cloud", instance="<IBM Cloud CRN>")
115+
# Load your IBM Quantum account. Replace "<IBM Cloud CRN>" with your desired instance's CRN or name.
116+
service = QiskitRuntimeService(channel="ibm_cloud", instance="<IBM Cloud CRN or Name>")
112117

113118
# Retrieve a single job by id
114119
job = service.job(<job_id>)

0 commit comments

Comments
 (0)