Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate auth parameter and add new channel parameter #226

Merged
merged 31 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
558749c
Add channel parameter
rathishcholarajan Mar 20, 2022
7c8380c
Fix unit tests
rathishcholarajan Mar 21, 2022
fadb457
Add mising space
rathishcholarajan Mar 22, 2022
b6d1f80
Save account with new channel parameter even when auth is passed
rathishcholarajan Mar 22, 2022
c503154
Fix delete_account for auth parameter
rathishcholarajan Mar 23, 2022
0ada0c9
Fix style
rathishcholarajan Mar 23, 2022
4417689
Make auth parameter work with saved_accounts
rathishcholarajan Mar 23, 2022
8edfdc9
Support auth parameter when enabling account
rathishcholarajan Mar 23, 2022
77bb29c
Merge branch 'main' into 217-channel-parameter
rathishcholarajan Mar 24, 2022
c94531f
Merge branch 'main' into 217-channel-parameter
rathishcholarajan Mar 25, 2022
b9c16c7
Revert temporarily to fix doc builds on fork
rathishcholarajan Mar 25, 2022
99073f7
Add some tests for overwriting saved auth accounts with channel accounts
rathishcholarajan Mar 25, 2022
bc79b25
Add couple more scenarios for testing overwriting named auth accounts…
rathishcholarajan Mar 25, 2022
0922e28
Add couple more tests for saving named legacy accounts
rathishcholarajan Mar 25, 2022
20a27a7
Test to list existing auth accounts in channel format
rathishcholarajan Mar 25, 2022
1db9e99
Fix lint
rathishcholarajan Mar 25, 2022
44a21e8
Add test for filtering auth accounts
rathishcholarajan Mar 25, 2022
4513d55
Fix lint
rathishcholarajan Mar 25, 2022
648647b
Fix failing integration tests
rathishcholarajan Mar 25, 2022
bfbd3da
Add tests for deleting existing auth accounts using channel
rathishcholarajan Mar 25, 2022
544b39a
Remove channel IDs to address confusion
rathishcholarajan Mar 28, 2022
593bb82
Update docs/tutorials/04_account_management.ipynb
rathishcholarajan Mar 28, 2022
489409b
Refactor and add functions for duplicated logic
rathishcholarajan Mar 28, 2022
dc1288c
Use strings for now since enums don't play well with literals
rathishcholarajan Mar 28, 2022
3d6b2b2
Ban latest released click version to temp fix make style build
rathishcholarajan Mar 28, 2022
e6c778e
Add update account function
rathishcholarajan Mar 29, 2022
7b96727
Update black
rathishcholarajan Mar 29, 2022
2ec5f48
Fix docs build
rathishcholarajan Mar 29, 2022
92e7ec2
Merge branch 'main' into 217-channel-parameter
rathishcholarajan Mar 29, 2022
16a46cf
Call migrate function to update config file automatically vs have the…
rathishcholarajan Mar 29, 2022
7d8ee74
Add release note
rathishcholarajan Mar 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
matrix:
python-version: [ 3.9 ]
os: [ "ubuntu-latest" ]
environment: [ "legacy-production", "cloud-production" ]
environment: [ "ibm-quantum-production", "ibm-cloud-production" ]
environment: ${{ matrix.environment }}
env:
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
python-version: [ 3.9 ]
os: [ "ubuntu-latest" ]
environment: [ "legacy-production", "legacy-staging", "cloud-production", "cloud-staging" ]
environment: [ "ibm-quantum-production", "ibm-quantum-staging", "ibm-cloud-production", "ibm-cloud-staging" ]
environment: ${{ matrix.environment }}
env:
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
matrix:
python-version: [ 3.9 ]
os: [ "ubuntu-latest" ]
environment: [ "legacy-production", "legacy-staging", "cloud-production", "cloud-staging" ]
environment: [ "ibm-quantum-production", "ibm-quantum-staging", "ibm-cloud-production", "ibm-cloud-staging" ]
environment: ${{ matrix.environment }}
env:
QISKIT_IBM_TOKEN: ${{ secrets.QISKIT_IBM_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ $ make e2e-test

#### Configuration

Integration and E2E tests require an environment configuration and can either be run against IBM Quantum APIs ("Legacy") or IBM Cloud Quantum Service APIs.
Integration and E2E tests require an environment configuration and can either be run against IBM Quantum APIs ("ibm_quantum") or IBM Cloud ("ibm_cloud") Quantum Service APIs.


Sample configuration for IBM Quantum
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ IBM Cloud API key and Cloud Resource Name (CRN), which you will need for authent
### Qiskit Runtime on IBM Quantum

Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an
existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum, which is referred to as legacy runtime.
existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum.

You will need your IBM Quantum API token to authenticate with the Qiskit Runtime service:

Expand All @@ -65,10 +65,10 @@ them each time. The credentials are saved in the `$HOME/.qiskit/qiskit-ibm.json`
from qiskit_ibm_runtime import IBMRuntimeService

# Save an IBM Cloud account.
IBMRuntimeService.save_account(auth="cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
IBMRuntimeService.save_account(channel="ibm_cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")

# Save an IBM Quantum account.
IBMRuntimeService.save_account(auth="legacy", token="MY_IBM_QUANTUM_TOKEN")
IBMRuntimeService.save_account(channel="ibm_quantum", token="MY_IBM_QUANTUM_TOKEN")
```

Once the account is saved on disk, you can instantiate the service without any arguments:
Expand Down Expand Up @@ -101,10 +101,10 @@ service with your credentials.
from qiskit_ibm_runtime import IBMRuntimeService

# For an IBM Cloud account.
cloud_service = IBMRuntimeService(auth="cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")
ibm_cloud_service = IBMRuntimeService(channel="ibm_cloud", token="MY_IBM_CLOUD_API_KEY", instance="MY_IBM_CLOUD_CRN")

# For an IBM Quantum account.
legacy_service = IBMRuntimeService(auth="legacy", token="MY_IBM_QUANTUM_TOKEN")
ibm_quantum_service = IBMRuntimeService(channel="ibm_quantum", token="MY_IBM_QUANTUM_TOKEN")
```

## Accessing Qiskit Runtime Programs
Expand Down
2 changes: 0 additions & 2 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# 3.1.0 is buggy
Jinja2!=3.1.0
4 changes: 2 additions & 2 deletions docs/max_time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Qiskit Runtime on IBM Cloud
The system limit on the job execution time is 3 hours for a job running on a simulator
and 8 hours for a job running on a physical system.

Qiskit Runtime on IBM Quantum (legacy)
--------------------------------------
Qiskit Runtime on IBM Quantum
-----------------------------

The system limit on the job execution time is

Expand Down
1 change: 0 additions & 1 deletion docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.. release-notes:: Release Notes
:version: 0.2.0, 0.1.0, 0.1.0rc2, 0.1.0rc1
rathishcholarajan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"# Save account on disk.\n",
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
"\n",
"service = IBMRuntimeService()"
]
Expand Down Expand Up @@ -689,11 +689,11 @@
"source": [
"There are additional tutorials in this directory:\n",
"\n",
"- [02_introduction_legacy_runtime.ipynb](02_introduction_legacy_runtime.ipynb) is the corresponding tutorial on using legacy Qiskit Runtime. You can skip this tutorial if you don't plan on using legacy runtime.\n",
"- [02_introduction_ibm_quantum_runtime.ipynb](02_introduction_ibm_quantum_runtime.ipynb) is the corresponding tutorial on using Qiskit Runtime on IBM Quantum. You can skip this tutorial if you don't plan on using Qiskit Runtime on IBM Quantum.\n",
"- [03_backends.ipynb](03_backends.ipynb) describes how to find a target backend for the Qiskit Runtime program you want to invoke. \n",
"- [04_account_management.ipynb](04_account_management.ipynb) describes how to save, load, and delete your account credentials on disk.\n",
"- [qiskit_runtime_vqe_program.ipynb](sample_vqe_program/qiskit_runtime_vqe_program.ipynb) goes into more details on uploading a real-world program (VQE). \n",
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on legacy Qiskit Runtime."
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available in Qiskit Runtime on IBM Quantum."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"id": "1de4634b",
"metadata": {},
"source": [
"# Legacy Qiskit Runtime"
"# Qiskit Runtime on IBM Quantum"
]
},
{
"cell_type": "markdown",
"id": "5affe56b",
"metadata": {},
"source": [
"Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum, which is referred to as _legacy runtime_. \n"
"Prior to becoming an IBM Cloud service, Qiskit Runtime was offered on IBM Quantum. If you have an existing IBM Quantum account, you can continue using Qiskit Runtime on IBM Quantum. \n"
]
},
{
Expand Down Expand Up @@ -80,7 +80,7 @@
"source": [
"Before you can start using Qiskit Runtime, you need to initialize your account. You can do this by calling `IBMRuntimeService` with your IBM Quantum API token, which can be found on the [IBM Quantum accounts page](https://quantum-computing.ibm.com/account).\n",
"\n",
"You can also choose to save your credentials on disk (in the `$HOME/.qiskit/qiskit-ibm.json` file). By doing so, you only need to use `IBMRuntimeService(auth=\"legacy\")` in the future to initialize your account.\n",
"You can also choose to save your credentials on disk (in the `$HOME/.qiskit/qiskit-ibm.json` file). By doing so, you only need to use `IBMRuntimeService(channel=\"ibm_quantum\")` in the future to initialize your account.\n",
"\n",
"For more information about account management, such as how to delete or view an account, see [04_account_management.ipynb](04_account_management.ipynb)."
]
Expand All @@ -95,10 +95,10 @@
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"# Save account on disk.\n",
"# IBMRuntimeService.save_account(auth=\"legacy\", token=<IBM Quantun API token>)\n",
"# IBMRuntimeService.save_account(channel=\"ibm_quantum\", token=<IBM Quantun API token>)\n",
"\n",
"# The \"auth\" keyword is not needed if you have only 1 type (legacy or cloud) of account saved.\n",
"service = IBMRuntimeService(auth=\"legacy\")"
"# The \"channel\" keyword is not needed if you have only 1 type (ibm_quantum or ibm_cloud) of account saved.\n",
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
]
},
{
Expand Down Expand Up @@ -417,7 +417,7 @@
"metadata": {},
"source": [
"<div class=\"alert alert-block alert-info\">\n",
"<b>Note:</b> To ensure fairness, there is a maximum execution time for each Qiskit Runtime job. Refer to <a href=\"https://qiskit.org/documentation/partners/qiskit_ibm_runtime/max_time.html#qiskit-runtime-on-ibm-quantum-legacy\">this documentation</a> on what the time limit is.\n",
"<b>Note:</b> To ensure fairness, there is a maximum execution time for each Qiskit Runtime job. Refer to <a href=\"https://qiskit.org/documentation/partners/qiskit_ibm_runtime/max_time.html#qiskit-runtime-on-ibm-quantum-ibm-quantum\">this documentation</a> on what the time limit is.\n",
"</div>"
]
},
Expand Down Expand Up @@ -535,7 +535,7 @@
"- [04_account_management.ipynb](04_account_management.ipynb) describes how to save, load, and delete your account credentials on disk.\n",
"- [05_uploading_program.ipynb](05_uploading_program.ipynb) is an introduction on uploading your custom Qiskit Runtime program.\n",
"- [qiskit_runtime_vqe_program.ipynb](sample_vqe_program/qiskit_runtime_vqe_program.ipynb) goes into more details on uploading a real-world program (VQE). \n",
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on legacy Qiskit Runtime."
"- [qka.ipynb](qka.ipynb), [vqe.ipynb](vqe.ipynb), and [qiskit_runtime_expval_program.ipynb](sample_expval_program/qiskit_runtime_expval_program.ipynb) describe how to use the public programs `qka`, `vqe`, and `sample-expval`, respectively. These programs are currently only available on Qiskit Runtime on IBM Quantum."
]
},
{
Expand Down
7 changes: 3 additions & 4 deletions docs/tutorials/03_backends.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,8 @@
}
],
"source": [
"# This program currently is only available on legacy Qiskit Runtime.\n",
"legacy_service = IBMRuntimeService(auth=\"legacy\")\n",
"program = legacy_service.program(\"hello-world\")\n",
"ibm_quantum_service = IBMRuntimeService(channel=\"ibm_quantum\")\n",
"program = ibm_quantum_service.program(\"hello-world\")\n",
"print(program.backend_requirements)"
]
},
Expand Down Expand Up @@ -269,7 +268,7 @@
}
],
"source": [
"legacy_service.backends(min_num_qubits=5)"
"ibm_quantum_service.backends(min_num_qubits=5)"
]
},
{
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/04_account_management.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"id": "c22a29f4",
"metadata": {},
"source": [
"Qiskit Runtime is available on both IBM Cloud and IBM Quantum. The former requires an IBM Cloud account and the latter an IBM Quantum account. If you don't have these accounts, please refer to [01_introduction_cloud_runtime.ipynb](01_introduction_cloud_runtime.ipynb) or [02_introduction_legacy_runtime.ipynb](02_introduction_legacy_runtime.ipynb) on how to set one up.\n",
"Qiskit Runtime is available on both IBM Cloud and IBM Quantum. The former requires an IBM Cloud account and the latter an IBM Quantum account. If you don't have these accounts, please refer to [01_introduction_ibm_cloud_runtime.ipynb](01_introduction_ibm_cloud_runtime.ipynb) or [02_introduction_ibm_quantum_runtime.ipynb](02_introduction_ibm_quantum_runtime.ipynb) on how to set one up.\n",
"\n"
]
},
Expand Down Expand Up @@ -74,7 +74,7 @@
"id": "bfb828ec",
"metadata": {},
"source": [
"Below are examples of saving an IBM Cloud and an IBM Quantum accounts. The `auth` parameter indicates the authentication type of the account. If you are saving multiple account, consider using the `name` parameter to differentiate them.\n"
"Below are examples of saving an IBM Cloud and an IBM Quantum accounts. The `channel` parameter allows to distinguish between different account types. If you are saving multiple accounts per channel, consider using the `name` parameter to differentiate them.\n"
]
},
{
Expand All @@ -87,10 +87,10 @@
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"# Save an IBM Cloud account on disk.\n",
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN> or <IBM Cloud service name>)\n",
"\n",
"# Save an IBM Quantum account on disk.\n",
"# IBMRuntimeService.save_account(auth=\"legacy\", token=<IBM Quantum API token>)"
"# IBMRuntimeService.save_account(channel=\"ibm_quantum\", token=<IBM Quantum API token>)"
]
},
{
Expand Down Expand Up @@ -125,7 +125,7 @@
"id": "9a4504f8",
"metadata": {},
"source": [
"If you have both an IBM Cloud and an IBM Quantum accounts saved, `IBMRuntimeService()` by default will load the IBM Cloud account. To load the IBM Quantum account, you can specify `IBMRuntimeService(auth=\"legacy\")` instead.\n",
"If you have both an IBM Cloud and an IBM Quantum accounts saved, `IBMRuntimeService()` by default will load the IBM Cloud account. To load the IBM Quantum account, you can specify `IBMRuntimeService(channel=\"ibm_quantum\")` instead.\n",
"\n",
"Alternatively, if you specified a `name` for your account when saving it, you can also specify the name of the account to load."
]
Expand All @@ -138,7 +138,7 @@
"outputs": [],
"source": [
"# Save an IBM Cloud account on disk and give it a name.\n",
"# IBMRuntimeService.save_account(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>, name=\"prod\")\n",
"# IBMRuntimeService.save_account(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>, name=\"prod\")\n",
"\n",
"# service = IBMRuntimeService(name=\"prod\")"
]
Expand All @@ -159,7 +159,7 @@
"outputs": [],
"source": [
"# Initialize an IBM Cloud account without saving it.\n",
"# service = IBMRuntimeService(auth=\"cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>)"
"# service = IBMRuntimeService(channel=\"ibm_cloud\", token=<IBM Cloud API key>, instance=<IBM Cloud CRN>)"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/qka.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"source": [
"# Load your account and get the quantum backend\n",
"\n",
"We'll be using the 27-qubit device `ibmq_montreal` for this tutorial on legacy Qiskit Runtime."
"We'll be using the 27-qubit device `ibmq_montreal` for this tutorial in Qiskit Runtime on IBM Quantum."
]
},
{
Expand All @@ -104,7 +104,7 @@
"\n",
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"service = IBMRuntimeService(auth=\"legacy\")\n",
"service = IBMRuntimeService(channel=\"ibm_quantum\")\n",
"backend = service.backend(\"ibmq_montreal\")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
"source": [
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"service = IBMRuntimeService(auth=\"legacy\")"
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/vqe.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
"source": [
"from qiskit_ibm_runtime import IBMRuntimeService\n",
"\n",
"service = IBMRuntimeService(auth=\"legacy\")"
"service = IBMRuntimeService(channel=\"ibm_quantum\")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
on disk.

Qiskit Runtime is available on both IBM Cloud and IBM Quantum, and you can specify
``auth="cloud"`` for IBM Cloud and ``auth="legacy"`` for IBM Quantum. The default
``channel="ibm_cloud"`` for IBM Cloud and ``channel="ibm_quantum"`` for IBM Quantum. The default
is IBM Cloud.

Listing runtime programs
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/accounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Account management functionality related to the IBM Runtime Services.
"""

from .account import Account, AccountType
from .account import Account, AccountType, ChannelType
from .management import AccountManager
from .exceptions import (
AccountNotFoundError,
Expand Down
Loading