Skip to content

Commit

Permalink
Merge branch 'main' into meow
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT authored Oct 21, 2024
2 parents b7e742b + f67531e commit c86dd9c
Show file tree
Hide file tree
Showing 24 changed files with 58 additions and 571 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/q-ctrl-tests.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Finally, preview the docs build by following the instructions in
Building The release notes are part of the standard qiskit-ibm-runtime
documentation builds. To check what the rendered html output of the release
notes will look like for the current state of the repo you can run:
`tox -edocs` which will build all the documentation into `docs/_build/html`
`tox -e docs` which will build all the documentation into `docs/_build/html`
and the release notes in particular will be located at
`docs/_build/html/release_notes.html`.

Expand Down
4 changes: 4 additions & 0 deletions docs/apidocs/debug_tools.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: qiskit_ibm_runtime.debug_tools
:no-members:
:no-inherited-members:
:no-special-members:
1 change: 1 addition & 0 deletions docs/apidocs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ qiskit-ibm-runtime API reference
qiskit_ibm_runtime.transpiler.passes.scheduling
fake_provider
execution_span
debug_tools
visualization
28 changes: 2 additions & 26 deletions qiskit_ibm_runtime/accounts/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(
instance: Optional[str] = None,
proxies: Optional[ProxyConfiguration] = None,
verify: Optional[bool] = True,
channel_strategy: Optional[str] = None,
):
"""Account constructor.
Expand All @@ -53,15 +52,13 @@ def __init__(
instance: Service instance to use.
proxies: Proxy configuration.
verify: Whether to verify server's TLS certificate.
channel_strategy: Error mitigation strategy.
"""
self.channel: str = None
self.url: str = None
self.token = token
self.instance = instance
self.proxies = proxies
self.verify = verify
self.channel_strategy = channel_strategy
self.private_endpoint: bool = False

def to_saved_format(self) -> dict:
Expand All @@ -81,7 +78,6 @@ def from_saved_format(cls, data: dict) -> "Account":
token = data.get("token")
instance = data.get("instance")
verify = data.get("verify", True)
channel_strategy = data.get("channel_strategy")
private_endpoint = data.get("private_endpoint", False)
return cls.create_account(
channel=channel,
Expand All @@ -90,7 +86,6 @@ def from_saved_format(cls, data: dict) -> "Account":
instance=instance,
proxies=proxies,
verify=verify,
channel_strategy=channel_strategy,
private_endpoint=private_endpoint,
)

Expand All @@ -103,7 +98,6 @@ def create_account(
instance: Optional[str] = None,
proxies: Optional[ProxyConfiguration] = None,
verify: Optional[bool] = True,
channel_strategy: Optional[str] = None,
private_endpoint: Optional[bool] = False,
) -> "Account":
"""Creates an account for a specific channel."""
Expand All @@ -114,7 +108,6 @@ def create_account(
instance=instance,
proxies=proxies,
verify=verify,
channel_strategy=channel_strategy,
)
elif channel == "ibm_cloud":
return CloudAccount(
Expand All @@ -123,7 +116,6 @@ def create_account(
instance=instance,
proxies=proxies,
verify=verify,
channel_strategy=channel_strategy,
private_endpoint=private_endpoint,
)
else:
Expand Down Expand Up @@ -167,20 +159,8 @@ def validate(self) -> "Account":
self._assert_valid_url(self.url)
self._assert_valid_instance(self.instance)
self._assert_valid_proxies(self.proxies)
self._assert_valid_channel_strategy(self.channel_strategy)
return self

@staticmethod
def _assert_valid_channel_strategy(channel_strategy: str) -> None:
"""Assert that the channel strategy is valid."""
# add more strategies as they are implemented
strategies = ["q-ctrl", "default"]
if channel_strategy and channel_strategy not in strategies:
raise InvalidAccountError(
f"Invalid `channel_strategy` value. Expected one of "
f"{strategies}, got '{channel_strategy}'."
)

@staticmethod
def _assert_valid_channel(channel: ChannelType) -> None:
"""Assert that the channel parameter is valid."""
Expand Down Expand Up @@ -229,7 +209,6 @@ def __init__(
instance: Optional[str] = None,
proxies: Optional[ProxyConfiguration] = None,
verify: Optional[bool] = True,
channel_strategy: Optional[str] = None,
):
"""Account constructor.
Expand All @@ -239,9 +218,8 @@ def __init__(
instance: Service instance to use.
proxies: Proxy configuration.
verify: Whether to verify server's TLS certificate.
channel_strategy: Error mitigation strategy.
"""
super().__init__(token, instance, proxies, verify, channel_strategy)
super().__init__(token, instance, proxies, verify)
resolved_url = url or IBM_QUANTUM_API_URL
self.channel = "ibm_quantum"
self.url = resolved_url
Expand Down Expand Up @@ -272,7 +250,6 @@ def __init__(
instance: Optional[str] = None,
proxies: Optional[ProxyConfiguration] = None,
verify: Optional[bool] = True,
channel_strategy: Optional[str] = None,
private_endpoint: Optional[bool] = False,
):
"""Account constructor.
Expand All @@ -283,10 +260,9 @@ def __init__(
instance: Service instance to use.
proxies: Proxy configuration.
verify: Whether to verify server's TLS certificate.
channel_strategy: Error mitigation strategy.
private_endpoint: Connect to private API URL.
"""
super().__init__(token, instance, proxies, verify, channel_strategy)
super().__init__(token, instance, proxies, verify)
resolved_url = url or IBM_CLOUD_API_URL
self.channel = "ibm_cloud"
self.url = resolved_url
Expand Down
2 changes: 0 additions & 2 deletions qiskit_ibm_runtime/accounts/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def save(
proxies: Optional[ProxyConfiguration] = None,
verify: Optional[bool] = None,
overwrite: Optional[bool] = False,
channel_strategy: Optional[str] = None,
set_as_default: Optional[bool] = None,
private_endpoint: Optional[bool] = False,
) -> None:
Expand All @@ -61,7 +60,6 @@ def save(
instance=instance,
proxies=proxies,
verify=verify,
channel_strategy=channel_strategy,
private_endpoint=private_endpoint,
)
return save_config(
Expand Down
17 changes: 2 additions & 15 deletions qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def program_run(
start_session: Optional[bool] = False,
session_time: Optional[int] = None,
private: Optional[bool] = False,
channel_strategy: Optional[str] = None,
) -> Dict:
"""Run the specified program.
Expand All @@ -78,7 +77,6 @@ def program_run(
start_session: Set to True to explicitly start a runtime session. Defaults to False.
session_time: Length of session in seconds.
private: Marks job as private.
channel_strategy: Error mitigation strategy.
Returns:
JSON response.
Expand All @@ -99,7 +97,6 @@ def program_run(
start_session=start_session,
session_time=session_time,
private=private,
channel_strategy=channel_strategy,
**hgp_dict,
)

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

def list_backends(
self, hgp: Optional[str] = None, channel_strategy: Optional[str] = None
) -> List[str]:
def list_backends(self, hgp: Optional[str] = None) -> List[str]:
"""Return IBM backends available for this service instance.
Args:
hgp: Filter by hub/group/project.
channel_strategy: Filter by channel strategy.
Returns:
IBM backends available for this service instance.
"""
return self._api.backends(hgp=hgp, channel_strategy=channel_strategy)["devices"]

def is_qctrl_enabled(self) -> bool:
"""Returns a boolean of whether or not the instance has q-ctrl enabled.
Returns:
Boolean value.
"""
return self._api.is_qctrl_enabled()
return self._api.backends(hgp=hgp)["devices"]

def backend_configuration(self, backend_name: str) -> Dict[str, Any]:
"""Return the configuration of the IBM backend.
Expand Down
17 changes: 0 additions & 17 deletions qiskit_ibm_runtime/api/rest/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def program_run(
start_session: Optional[bool] = False,
session_time: Optional[int] = None,
private: Optional[bool] = False,
channel_strategy: Optional[str] = None,
) -> Dict:
"""Execute the program.
Expand All @@ -96,7 +95,6 @@ def program_run(
start_session: Set to True to explicitly start a runtime session. Defaults to False.
session_time: Length of session in seconds.
private: Marks job as private.
channel_strategy: Error mitigation strategy.
Returns:
JSON response.
Expand Down Expand Up @@ -125,8 +123,6 @@ def program_run(
payload["hub"] = hub
payload["group"] = group
payload["project"] = project
if channel_strategy:
payload["channel_strategy"] = channel_strategy
if private:
payload["private"] = True
data = json.dumps(payload, cls=RuntimeEncoder)
Expand Down Expand Up @@ -216,14 +212,12 @@ def backends(
self,
hgp: Optional[str] = None,
timeout: Optional[float] = None,
channel_strategy: Optional[str] = None,
) -> Dict[str, List[str]]:
"""Return a list of IBM backends.
Args:
hgp: The service instance to use, only for ``ibm_quantum`` channel, in h/g/p format.
timeout: Number of seconds to wait for the request.
channel_strategy: Error mitigation strategy.
Returns:
JSON response.
Expand All @@ -232,19 +226,8 @@ def backends(
params = {}
if hgp:
params["provider"] = hgp
if channel_strategy:
params["channel_strategy"] = channel_strategy
return self.session.get(url, params=params, timeout=timeout).json()

def is_qctrl_enabled(self) -> bool:
"""Return boolean of whether or not the instance has q-ctrl enabled.
Returns:
Boolean value.
"""
url = self.get_url("cloud_instance")
return self.session.get(url).json().get("qctrl_enabled")

def usage(self) -> Dict[str, Any]:
"""Return monthly open plan usage information.
Expand Down
21 changes: 20 additions & 1 deletion qiskit_ibm_runtime/debug_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,26 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Functions and classes for debugging and analyzing qiskit-ibm-runtime jobs."""
"""
=======================================================
Debugging tools (:mod:`qiskit_ibm_runtime.debug_tools`)
=======================================================
.. currentmodule:: qiskit_ibm_runtime.debug_tools
The tools for debugging and analyzing qiskit-ibm-runtime jobs.
Classes
=======
.. autosummary::
:toctree: ../stubs/
Neat
NeatResult
NeatPubResult
"""

from .neat import Neat
from .neat_results import NeatPubResult, NeatResult
7 changes: 0 additions & 7 deletions qiskit_ibm_runtime/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from .options.estimator_options import EstimatorOptions
from .base_primitive import BasePrimitiveV2
from .utils.deprecation import issue_deprecation_msg
from .utils.qctrl import validate_v2 as qctrl_validate_v2
from .utils import validate_estimator_pubs

# pylint: disable=unused-import,cyclic-import
Expand Down Expand Up @@ -119,8 +118,6 @@ def __init__(
options: Estimator options, see :class:`EstimatorOptions` for detailed description.
Raises:
NotImplementedError: If "q-ctrl" channel strategy is used.
"""
BaseEstimatorV2.__init__(self)
Estimator.__init__(self)
Expand Down Expand Up @@ -167,10 +164,6 @@ def _validate_options(self, options: dict) -> None:
ValueError: if validation fails.
"""

if self._service._channel_strategy == "q-ctrl":
qctrl_validate_v2(options)
return

if (
options.get("resilience", {}).get("pec_mitigation", False) is True
and self._backend is not None
Expand Down
1 change: 0 additions & 1 deletion qiskit_ibm_runtime/fake_provider/local_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def __init__(self) -> None:
An instance of QiskitRuntimeService.
"""
self._channel_strategy = None

def backend(
self, name: str = None, instance: str = None # pylint: disable=unused-argument
Expand Down
Loading

0 comments on commit c86dd9c

Please sign in to comment.