Skip to content

Commit

Permalink
Remove all code related to custom programs (#1192)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
kt474 and jyu00 authored Nov 28, 2023
1 parent c8eb7c9 commit ea7872b
Show file tree
Hide file tree
Showing 36 changed files with 50 additions and 2,165 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
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
19 changes: 0 additions & 19 deletions program_source/__init__.py

This file was deleted.

15 changes: 0 additions & 15 deletions program_source/circuit_runner/__init__.py

This file was deleted.

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.

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 @@ -177,7 +165,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
106 changes: 0 additions & 106 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
Loading

0 comments on commit ea7872b

Please sign in to comment.