Skip to content

Commit f321b6c

Browse files
dcmckayibmwshanks
andauthored
Remove automatic retrieval to hgp (#1587)
With the change to the qiskit-ibm-runtime service, the hub/group/project access syntax has been removed. Lingering references to this in experiments caused errors with the release of runtime 0.41.0. The attempt to retrieve the hub/group/project automatically by `ExperimentData` has been removed. The hub/group/project properties have been left, though they are mostly useless outside of loading historical data since the current model of the IBM Quantum service does not use them. --------- Co-authored-by: Will Shanks <[email protected]>
1 parent 49e595d commit f321b6c

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

docs/howtos/cloud_service.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ Save and load experiment data with the cloud service
22
====================================================
33

44
.. note::
5-
This guide is only for those who have access to the cloud service. You can
6-
check whether you do by logging into the IBM Quantum interface
7-
and seeing if you can see the `database <https://quantum.ibm.com/experiments>`__.
5+
The cloud service at `database <https://quantum.ibm.com/experiments>` has been
6+
sunset in the move to the new IBM Quantum cloud platform. Saving and loading
7+
to the cloud will not work. We are working on a local saving solution.
88

99
Problem
1010
-------

qiskit_experiments/framework/experiment_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,15 +598,15 @@ def _set_backend(self, new_backend: Backend, recursive: bool = True) -> None:
598598
self._db_data.backend = self._backend_data.name
599599
if self._db_data.backend is None:
600600
self._db_data.backend = str(new_backend)
601-
if hasattr(self._backend, "_instance") and self._backend._instance:
602-
self.hgp = self._backend._instance
603601
if recursive:
604602
for data in self.child_data():
605603
data._set_backend(new_backend)
606604

607605
@property
608606
def hgp(self) -> str:
609607
"""Returns Hub/Group/Project data as a formatted string"""
608+
if self.hub is None or self.group is None or self.project is None:
609+
raise QiskitError("Hub, group, and/or project are not set!")
610610
return f"{self.hub}/{self.group}/{self.project}"
611611

612612
@hgp.setter
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
3+
upgrade:
4+
- |
5+
The automatic retrieval of hub, group, and project information from a
6+
backend for storage in an :class:`~.ExperimentData` instance has been
7+
removed as these properties are no longer a part of the access model in
8+
the new IBM Quantum Platform on IBM Cloud. The new model has instances with
9+
"plans" and "names" but these do not map directly to the hub, group, and
10+
project information. Currently, no attempt is made to capture this
11+
information in an equivalent way.
12+
13+
fixes:
14+
- |
15+
As described in the Upgrade Notes, automatic retrieval of hub, group, and
16+
project information is no longer attempted when the backend is set on an
17+
:class:`~.ExperimentData` instance. Avoiding this retrieval avoids an
18+
exception being raised when working with
19+
:external+qiskit_ibm_runtime:doc:`qiskit-ibm-runtime <index>` version 0.41
20+
which changed the behavior of the interface that had been used for
21+
accessing the hub, group, and project information.

test/database_service/test_db_experiment_data.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,13 +1150,6 @@ def test_getters(self):
11501150
data._db_data.updated_datetime = test_time
11511151
self.assertEqual(data.updated_datetime, test_time)
11521152

1153-
data._db_data.hub = "hub_name"
1154-
data._db_data.group = "group_name"
1155-
data._db_data.project = "project_name"
1156-
self.assertEqual(data.hub, "hub_name")
1157-
self.assertEqual(data.group, "group_name")
1158-
self.assertEqual(data.project, "project_name")
1159-
11601153
data._db_data.experiment_id = "exp_id"
11611154
data._db_data.experiment_type = "exp_type"
11621155
self.assertEqual(data.experiment_id, "exp_id")
@@ -1198,15 +1191,6 @@ def test_metadata_too_large(self):
11981191
]
11991192
self.assertTrue(exp_data._metadata_too_large())
12001193

1201-
def test_hgp_setter(self):
1202-
"""Tests usage of the hgp setter"""
1203-
exp_data = ExperimentData()
1204-
exp_data.hgp = "ibm-q-internal/deployed/default"
1205-
self.assertEqual("ibm-q-internal/deployed/default", exp_data.hgp)
1206-
self.assertEqual("ibm-q-internal", exp_data.hub)
1207-
self.assertEqual("deployed", exp_data.group)
1208-
self.assertEqual("default", exp_data.project)
1209-
12101194
def test_add_delete_artifact(self):
12111195
"""Tests adding an artifact and a list of artifacts. Tests deleting an artifact
12121196
by name, ID, and index and ID. Test the metadata is correctly tracking additions

0 commit comments

Comments
 (0)