Skip to content

Commit f67531e

Browse files
authored
Remove channel strategy & q-ctrl (#1966)
* Remove channel strategy & q-ctrl * Add release note * merge conflicts again * Address comments
1 parent f7ad24c commit f67531e

File tree

18 files changed

+23
-569
lines changed

18 files changed

+23
-569
lines changed

.github/workflows/q-ctrl-tests.yml

-54
This file was deleted.

qiskit_ibm_runtime/accounts/account.py

+2-26
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def __init__(
4242
instance: Optional[str] = None,
4343
proxies: Optional[ProxyConfiguration] = None,
4444
verify: Optional[bool] = True,
45-
channel_strategy: Optional[str] = None,
4645
):
4746
"""Account constructor.
4847
@@ -53,15 +52,13 @@ def __init__(
5352
instance: Service instance to use.
5453
proxies: Proxy configuration.
5554
verify: Whether to verify server's TLS certificate.
56-
channel_strategy: Error mitigation strategy.
5755
"""
5856
self.channel: str = None
5957
self.url: str = None
6058
self.token = token
6159
self.instance = instance
6260
self.proxies = proxies
6361
self.verify = verify
64-
self.channel_strategy = channel_strategy
6562
self.private_endpoint: bool = False
6663

6764
def to_saved_format(self) -> dict:
@@ -81,7 +78,6 @@ def from_saved_format(cls, data: dict) -> "Account":
8178
token = data.get("token")
8279
instance = data.get("instance")
8380
verify = data.get("verify", True)
84-
channel_strategy = data.get("channel_strategy")
8581
private_endpoint = data.get("private_endpoint", False)
8682
return cls.create_account(
8783
channel=channel,
@@ -90,7 +86,6 @@ def from_saved_format(cls, data: dict) -> "Account":
9086
instance=instance,
9187
proxies=proxies,
9288
verify=verify,
93-
channel_strategy=channel_strategy,
9489
private_endpoint=private_endpoint,
9590
)
9691

@@ -103,7 +98,6 @@ def create_account(
10398
instance: Optional[str] = None,
10499
proxies: Optional[ProxyConfiguration] = None,
105100
verify: Optional[bool] = True,
106-
channel_strategy: Optional[str] = None,
107101
private_endpoint: Optional[bool] = False,
108102
) -> "Account":
109103
"""Creates an account for a specific channel."""
@@ -114,7 +108,6 @@ def create_account(
114108
instance=instance,
115109
proxies=proxies,
116110
verify=verify,
117-
channel_strategy=channel_strategy,
118111
)
119112
elif channel == "ibm_cloud":
120113
return CloudAccount(
@@ -123,7 +116,6 @@ def create_account(
123116
instance=instance,
124117
proxies=proxies,
125118
verify=verify,
126-
channel_strategy=channel_strategy,
127119
private_endpoint=private_endpoint,
128120
)
129121
else:
@@ -167,20 +159,8 @@ def validate(self) -> "Account":
167159
self._assert_valid_url(self.url)
168160
self._assert_valid_instance(self.instance)
169161
self._assert_valid_proxies(self.proxies)
170-
self._assert_valid_channel_strategy(self.channel_strategy)
171162
return self
172163

173-
@staticmethod
174-
def _assert_valid_channel_strategy(channel_strategy: str) -> None:
175-
"""Assert that the channel strategy is valid."""
176-
# add more strategies as they are implemented
177-
strategies = ["q-ctrl", "default"]
178-
if channel_strategy and channel_strategy not in strategies:
179-
raise InvalidAccountError(
180-
f"Invalid `channel_strategy` value. Expected one of "
181-
f"{strategies}, got '{channel_strategy}'."
182-
)
183-
184164
@staticmethod
185165
def _assert_valid_channel(channel: ChannelType) -> None:
186166
"""Assert that the channel parameter is valid."""
@@ -229,7 +209,6 @@ def __init__(
229209
instance: Optional[str] = None,
230210
proxies: Optional[ProxyConfiguration] = None,
231211
verify: Optional[bool] = True,
232-
channel_strategy: Optional[str] = None,
233212
):
234213
"""Account constructor.
235214
@@ -239,9 +218,8 @@ def __init__(
239218
instance: Service instance to use.
240219
proxies: Proxy configuration.
241220
verify: Whether to verify server's TLS certificate.
242-
channel_strategy: Error mitigation strategy.
243221
"""
244-
super().__init__(token, instance, proxies, verify, channel_strategy)
222+
super().__init__(token, instance, proxies, verify)
245223
resolved_url = url or IBM_QUANTUM_API_URL
246224
self.channel = "ibm_quantum"
247225
self.url = resolved_url
@@ -272,7 +250,6 @@ def __init__(
272250
instance: Optional[str] = None,
273251
proxies: Optional[ProxyConfiguration] = None,
274252
verify: Optional[bool] = True,
275-
channel_strategy: Optional[str] = None,
276253
private_endpoint: Optional[bool] = False,
277254
):
278255
"""Account constructor.
@@ -283,10 +260,9 @@ def __init__(
283260
instance: Service instance to use.
284261
proxies: Proxy configuration.
285262
verify: Whether to verify server's TLS certificate.
286-
channel_strategy: Error mitigation strategy.
287263
private_endpoint: Connect to private API URL.
288264
"""
289-
super().__init__(token, instance, proxies, verify, channel_strategy)
265+
super().__init__(token, instance, proxies, verify)
290266
resolved_url = url or IBM_CLOUD_API_URL
291267
self.channel = "ibm_cloud"
292268
self.url = resolved_url

qiskit_ibm_runtime/accounts/management.py

-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ def save(
4545
proxies: Optional[ProxyConfiguration] = None,
4646
verify: Optional[bool] = None,
4747
overwrite: Optional[bool] = False,
48-
channel_strategy: Optional[str] = None,
4948
set_as_default: Optional[bool] = None,
5049
private_endpoint: Optional[bool] = False,
5150
) -> None:
@@ -61,7 +60,6 @@ def save(
6160
instance=instance,
6261
proxies=proxies,
6362
verify=verify,
64-
channel_strategy=channel_strategy,
6563
private_endpoint=private_endpoint,
6664
)
6765
return save_config(

qiskit_ibm_runtime/api/clients/runtime.py

+2-15
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def program_run(
6161
start_session: Optional[bool] = False,
6262
session_time: Optional[int] = None,
6363
private: Optional[bool] = False,
64-
channel_strategy: Optional[str] = None,
6564
) -> Dict:
6665
"""Run the specified program.
6766
@@ -78,7 +77,6 @@ def program_run(
7877
start_session: Set to True to explicitly start a runtime session. Defaults to False.
7978
session_time: Length of session in seconds.
8079
private: Marks job as private.
81-
channel_strategy: Error mitigation strategy.
8280
8381
Returns:
8482
JSON response.
@@ -99,7 +97,6 @@ def program_run(
9997
start_session=start_session,
10098
session_time=session_time,
10199
private=private,
102-
channel_strategy=channel_strategy,
103100
**hgp_dict,
104101
)
105102

@@ -274,27 +271,17 @@ def session_details(self, session_id: str) -> Dict[str, Any]:
274271
"""
275272
return self._api.runtime_session(session_id=session_id).details()
276273

277-
def list_backends(
278-
self, hgp: Optional[str] = None, channel_strategy: Optional[str] = None
279-
) -> List[str]:
274+
def list_backends(self, hgp: Optional[str] = None) -> List[str]:
280275
"""Return IBM backends available for this service instance.
281276
282277
Args:
283278
hgp: Filter by hub/group/project.
284-
channel_strategy: Filter by channel strategy.
285279
286280
Returns:
287281
IBM backends available for this service instance.
288282
"""
289-
return self._api.backends(hgp=hgp, channel_strategy=channel_strategy)["devices"]
290283

291-
def is_qctrl_enabled(self) -> bool:
292-
"""Returns a boolean of whether or not the instance has q-ctrl enabled.
293-
294-
Returns:
295-
Boolean value.
296-
"""
297-
return self._api.is_qctrl_enabled()
284+
return self._api.backends(hgp=hgp)["devices"]
298285

299286
def backend_configuration(self, backend_name: str) -> Dict[str, Any]:
300287
"""Return the configuration of the IBM backend.

qiskit_ibm_runtime/api/rest/runtime.py

-17
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def program_run(
7777
start_session: Optional[bool] = False,
7878
session_time: Optional[int] = None,
7979
private: Optional[bool] = False,
80-
channel_strategy: Optional[str] = None,
8180
) -> Dict:
8281
"""Execute the program.
8382
@@ -96,7 +95,6 @@ def program_run(
9695
start_session: Set to True to explicitly start a runtime session. Defaults to False.
9796
session_time: Length of session in seconds.
9897
private: Marks job as private.
99-
channel_strategy: Error mitigation strategy.
10098
10199
Returns:
102100
JSON response.
@@ -125,8 +123,6 @@ def program_run(
125123
payload["hub"] = hub
126124
payload["group"] = group
127125
payload["project"] = project
128-
if channel_strategy:
129-
payload["channel_strategy"] = channel_strategy
130126
if private:
131127
payload["private"] = True
132128
data = json.dumps(payload, cls=RuntimeEncoder)
@@ -216,14 +212,12 @@ def backends(
216212
self,
217213
hgp: Optional[str] = None,
218214
timeout: Optional[float] = None,
219-
channel_strategy: Optional[str] = None,
220215
) -> Dict[str, List[str]]:
221216
"""Return a list of IBM backends.
222217
223218
Args:
224219
hgp: The service instance to use, only for ``ibm_quantum`` channel, in h/g/p format.
225220
timeout: Number of seconds to wait for the request.
226-
channel_strategy: Error mitigation strategy.
227221
228222
Returns:
229223
JSON response.
@@ -232,19 +226,8 @@ def backends(
232226
params = {}
233227
if hgp:
234228
params["provider"] = hgp
235-
if channel_strategy:
236-
params["channel_strategy"] = channel_strategy
237229
return self.session.get(url, params=params, timeout=timeout).json()
238230

239-
def is_qctrl_enabled(self) -> bool:
240-
"""Return boolean of whether or not the instance has q-ctrl enabled.
241-
242-
Returns:
243-
Boolean value.
244-
"""
245-
url = self.get_url("cloud_instance")
246-
return self.session.get(url).json().get("qctrl_enabled")
247-
248231
def usage(self) -> Dict[str, Any]:
249232
"""Return monthly open plan usage information.
250233

qiskit_ibm_runtime/estimator.py

-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from .options.estimator_options import EstimatorOptions
2828
from .base_primitive import BasePrimitiveV2
2929
from .utils.deprecation import issue_deprecation_msg
30-
from .utils.qctrl import validate_v2 as qctrl_validate_v2
3130
from .utils import validate_estimator_pubs
3231

3332
# pylint: disable=unused-import,cyclic-import
@@ -119,8 +118,6 @@ def __init__(
119118
120119
options: Estimator options, see :class:`EstimatorOptions` for detailed description.
121120
122-
Raises:
123-
NotImplementedError: If "q-ctrl" channel strategy is used.
124121
"""
125122
BaseEstimatorV2.__init__(self)
126123
Estimator.__init__(self)
@@ -167,10 +164,6 @@ def _validate_options(self, options: dict) -> None:
167164
ValueError: if validation fails.
168165
"""
169166

170-
if self._service._channel_strategy == "q-ctrl":
171-
qctrl_validate_v2(options)
172-
return
173-
174167
if (
175168
options.get("resilience", {}).get("pec_mitigation", False) is True
176169
and self._backend is not None

qiskit_ibm_runtime/fake_provider/local_service.py

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def __init__(self) -> None:
4949
An instance of QiskitRuntimeService.
5050
5151
"""
52-
self._channel_strategy = None
5352

5453
def backend(
5554
self, name: str = None, instance: str = None # pylint: disable=unused-argument

0 commit comments

Comments
 (0)