Skip to content

Commit

Permalink
Fast forward experimental-0.2 to the latest main (#1248)
Browse files Browse the repository at this point in the history
* Migrate fake backends from `qiskit.providers.fake_provider` (#1140)

* Migrate fake provider

* fix lint

* Only migrate backends and fake_provider file to minimize duplication

* Add reno

* Update snippet to use runtime service

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>

* Fix BYOB job results bytes typing issue  (#1220)

* try/except raw result truncation

* catch typeError

* revert try/except, use response.text

* update unit test

* Fix fake backends integration test (#1225)

* Clean up/fix integration test

* Update test case

* Fix black

* Added deprecation warning when using qiskitrc file (#1219)

* Added deprecation warning when using qiskitrc file

* Fixed bug whereby deprecation warnings cause failure for all 'qiskit*' modules. Changed warning to deprecation warning.

* Release note

* Small grammer fix

* black

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>

* Update session.from_id() (#1163)

* update session.from_id()

* add deprecation warning

* add reno

* Prepare release 0.15.0 (#1226)

* Update main branch 0.16.0 (#1227)

* Revert `Session.from_id 0.15.0` changes   (#1229)

* Revert "Update session.from_id() (#1163)"

This reverts commit 8fa0472.

* add reno

* Prepare release 0.15.1 (#1230)

* Update main branch to 0.16.0 again (#1232)

* Remove all code related to custom programs (#1192)

* initial removal

* cleanup more files

* move result_decoder

* fix lint

* update unit tests

* update integration tests

* more docs changes

* release note

* fix path

---------

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Make sessions thread safe (#1196)

* Make sessions thread safe.

The lock prevents other threads from sending new jobs to the service
only if the session hasnot been setup yet. I.e.: when sending the
first "session starter job", or root job. After this happens, the code
is left unlocked to allow threads to access the service concurrently.

Error handling is needed to ensure the lock is always released.

* Allow multiple sessions to execute simultaneously

* Make session test more deterministic

---------

Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Instance & channel_strategy validation  (#1233)

* compare cloud instance with channel strategy

* fix unit tests

* error wording

---------

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>

* Prepare release 0.16.1 (#1239)

* release notes

* fix release

* update to 0.17 (#1240)

* Stop referring to qiskit.org in API docs (#1242)

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
Co-authored-by: Kevin Tian <kevin.tian@ibm.com>
Co-authored-by: merav-aharoni <merav@il.ibm.com>
Co-authored-by: Salvador de la Puente González <neo.salvador@gmail.com>
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
  • Loading branch information
6 people authored Dec 1, 2023
1 parent 4cfb83e commit 2a39617
Show file tree
Hide file tree
Showing 285 changed files with 4,217 additions and 2,175 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mypy:
mypy --module qiskit_ibm_runtime --package test

style:
black --check qiskit_ibm_runtime setup.py test docs/tutorials program_source
black --check qiskit_ibm_runtime setup.py test docs/tutorials

unit-test:
python -m unittest discover --verbose --top-level-directory . --start-directory test/unit
Expand All @@ -40,4 +40,4 @@ unit-test-coverage:
coverage lcov

black:
black qiskit_ibm_runtime setup.py test docs/tutorials program_source
black qiskit_ibm_runtime setup.py test docs/tutorials
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.14.1'
release = '0.17.0'

docs_url_prefix = "ecosystem/ibm-runtime"

Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#########################################
Qiskit Runtime 0.14.0 documentation
Qiskit Runtime 0.16.1 documentation
#########################################

Overview
Expand Down Expand Up @@ -32,7 +32,7 @@ This primitive takes circuits as input and returns a quasi-probability distribut

**Error suppression / mitigation**

While building a fault-tolerant quantum computation is the ultimate goal, at present, calculations performed on near-term quantum computers are susceptible to noise. Qiskit Runtime offers several methods for preventing errors before they occur (error suppression techniques) and dealing with those that do occur (error mitigation techniques).
While building a fault-tolerant quantum computation is the ultimate goal, at present, calculations performed on near-term quantum computers are susceptible to noise. Qiskit Runtime offers several methods for preventing errors before they occur (error suppression techniques) and dealing with those that do occur (error mitigation techniques).

**Session**

Expand Down
13 changes: 2 additions & 11 deletions docs/migrate/migrate-setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ The module from which the classes are imported has changed. The following table
* - ``qiskit.providers.ibmq.runtime.RuntimeJob``
- ``qiskit_ibm_runtime.RuntimeJob``
-
* - ``qiskit.providers.ibmq.runtime.RuntimeProgram``
- ``qiskit_ibm_runtime.RuntimeProgram``
-
* - ``qiskit.providers.ibmq.runtime.UserMessenger``
- ``qiskit_ibm_runtime.program.UserMessenger``
- Notice the new location, in ``qiskit_ibm_runtime.program``
* - ``qiskit.providers.ibmq.runtime.ProgramBackend``
- ``qiskit_ibm_runtime.program.ProgramBackend``
- Notice the new location, in ``qiskit_ibm_runtime.program``
* - ``qiskit.providers.ibmq.runtime.ResultDecoder``
- ``qiskit_ibm_runtime.program.ResultDecoder``
- Notice the new location, in ``qiskit_ibm_runtime.program``
- ``qiskit_ibm_runtime.utils.ResultDecoder``
- Notice the new location, in ``qiskit_ibm_runtime.utils``
* - ``qiskit.providers.ibmq.runtime.RuntimeEncoder``
- ``qiskit_ibm_runtime.RuntimeEncoder``
-
Expand Down
23 changes: 0 additions & 23 deletions program_source/circuit_runner/circuit_runner.json

This file was deleted.

68 changes: 0 additions & 68 deletions program_source/circuit_runner/circuit_runner.py

This file was deleted.

5 changes: 0 additions & 5 deletions program_source/version.py

This file was deleted.

2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.14.1
0.17.0
13 changes: 0 additions & 13 deletions qiskit_ibm_runtime/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ def result_callback(job_id, result):
job = Sampler(backend).run(ReferenceCircuits.bell(), callback=result_callback)
print(job.result())
.. dropdown:: Uploading a program
:animate: fade-in-slide-down
Authorized users can upload their custom Qiskit Runtime programs.
A Qiskit Runtime program is a piece of Python
code and its metadata that takes certain inputs, performs
quantum and maybe classical processing, and returns the results.
Files related to writing a runtime program are in the
``qiskit_ibm_runtime/program`` directory.
Classes
==========================
Expand All @@ -165,8 +155,6 @@ def result_callback(job_id, result):
Session
IBMBackend
RuntimeJob
RuntimeProgram
ParameterNamespace
RuntimeOptions
RuntimeEncoder
RuntimeDecoder
Expand All @@ -178,7 +166,6 @@ def result_callback(job_id, result):
from .qiskit_runtime_service import QiskitRuntimeService
from .ibm_backend import IBMBackend
from .runtime_job import RuntimeJob
from .runtime_program import RuntimeProgram, ParameterNamespace
from .runtime_options import RuntimeOptions
from .utils.json import RuntimeEncoder, RuntimeDecoder
from .session import Session # pylint: disable=cyclic-import
Expand Down
8 changes: 8 additions & 0 deletions qiskit_ibm_runtime/accounts/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import os
import ast
from typing import Optional, Dict

from qiskit_ibm_provider.proxies import ProxyConfiguration

from qiskit_ibm_runtime.utils.deprecation import issue_deprecation_msg
from .exceptions import AccountNotFoundError
from .account import Account, ChannelType
from .storage import save_config, read_config, delete_config, read_qiskitrc
Expand Down Expand Up @@ -195,6 +197,12 @@ def get(
return Account.from_saved_format(all_config[account_name])

if os.path.isfile(_QISKITRC_CONFIG_FILE):
issue_deprecation_msg(
msg="Use of the ~/.qiskit/qiskitrc.json file is deprecated.",
version="0.15.0",
remedy="Please use the ~/.qiskit/qiskit-ibm.json file instead.",
period="1 month",
)
return cls._from_qiskitrc_file()

raise AccountNotFoundError("Unable to find account.")
Expand Down
110 changes: 2 additions & 108 deletions qiskit_ibm_runtime/api/clients/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,74 +47,6 @@ def __init__(
)
self._api = Runtime(self._session)

def list_programs(self, limit: int = None, skip: int = None) -> Dict[str, Any]:
"""Return a list of runtime programs.
Args:
limit: The number of programs to return.
skip: The number of programs to skip.
Returns:
A list of runtime programs.
"""
return self._api.list_programs(limit, skip)

def program_create(
self,
program_data: str,
name: str,
description: str,
max_execution_time: int,
is_public: Optional[bool] = False,
spec: Optional[Dict] = None,
) -> Dict:
"""Create a new program.
Args:
name: Name of the program.
program_data: Program data (base64 encoded).
description: Program description.
max_execution_time: Maximum execution time.
is_public: Whether the program should be public.
spec: Backend requirements, parameters, interim results, return values, etc.
Returns:
Server response.
"""
return self._api.create_program(
program_data=program_data,
name=name,
description=description,
max_execution_time=max_execution_time,
is_public=is_public,
spec=spec,
)

def program_get(self, program_id: str) -> Dict:
"""Return a specific program.
Args:
program_id: Program ID.
Returns:
Program information.
"""
return self._api.program(program_id).get()

def set_program_visibility(self, program_id: str, public: bool) -> None:
"""Sets a program's visibility.
Args:
program_id: Program ID.
public: If ``True``, make the program visible to all.
If ``False``, make the program visible to just your account.
"""
if public:
self._api.program(program_id).make_public()
else:
self._api.program(program_id).make_private()

def program_run(
self,
program_id: str,
Expand Down Expand Up @@ -168,44 +100,6 @@ def program_run(
**hgp_dict,
)

def program_delete(self, program_id: str) -> None:
"""Delete the specified program.
Args:
program_id: Program ID.
"""
self._api.program(program_id).delete()

def program_update(
self,
program_id: str,
program_data: str = None,
name: str = None,
description: str = None,
max_execution_time: int = None,
spec: Optional[Dict] = None,
) -> None:
"""Update a program.
Args:
program_id: Program ID.
program_data: Program data (base64 encoded).
name: Name of the program.
description: Program description.
max_execution_time: Maximum execution time.
spec: Backend requirements, parameters, interim results, return values, etc.
"""
if program_data:
self._api.program(program_id).update_data(program_data)

if any([name, description, max_execution_time, spec]):
self._api.program(program_id).update_metadata(
name=name,
description=description,
max_execution_time=max_execution_time,
spec=spec,
)

def job_get(self, job_id: str, exclude_params: bool = None) -> Dict:
"""Get job data.
Expand Down Expand Up @@ -374,13 +268,13 @@ def list_backends(
"""
return self._api.backends(hgp=hgp, channel_strategy=channel_strategy)["devices"]

def cloud_instance(self) -> bool:
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.cloud_instance()
return self._api.is_qctrl_enabled()

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

0 comments on commit 2a39617

Please sign in to comment.