From e2e3c8977d310036f4c61bd7355bd4e0b8088b6c Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Mon, 29 Aug 2022 21:51:05 -0400 Subject: [PATCH 01/10] add options --- qiskit_ibm_runtime/options.py | 4 ++++ qiskit_ibm_runtime/qiskit_runtime_service.py | 5 +++-- releasenotes/notes/add-options-26c127fcd40623a5.yaml | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/add-options-26c127fcd40623a5.yaml diff --git a/qiskit_ibm_runtime/options.py b/qiskit_ibm_runtime/options.py index 10bd54342..c720dc641 100644 --- a/qiskit_ibm_runtime/options.py +++ b/qiskit_ibm_runtime/options.py @@ -197,6 +197,8 @@ class Options: Default: ``True``. """ + max_execution_time: int = None + job_tags: List[str] = None optimization_level: int = 1 resilience_level: int = 0 backend: str = None @@ -284,4 +286,6 @@ def _get_runtime_options(options: Dict) -> Dict: "backend_name": options.get("backend"), "log_level": options.get("log_level"), "image": experimental.get("image", None), + "job_tags": options.get("job_tags"), + "max_execution_time": options.get("max_execution_time"), } diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index 8b77025a0..c3e1a9008 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -938,8 +938,9 @@ def run( hgp=hgp_name, log_level=options.get("log_level"), session_id=session_id, - job_tags=job_tags, - max_execution_time=max_execution_time, + job_tags=job_tags or options.get("job_tags"), + max_execution_time=max_execution_time + or options.get("max_execution_time"), start_session=start_session, ) except RequestsApiError as ex: diff --git a/releasenotes/notes/add-options-26c127fcd40623a5.yaml b/releasenotes/notes/add-options-26c127fcd40623a5.yaml new file mode 100644 index 000000000..a43ad20bf --- /dev/null +++ b/releasenotes/notes/add-options-26c127fcd40623a5.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + ``job_tags`` and ``max_execution_time`` can now be passed into the `qiskit_ibm_runtime.Options` + class. From 8efc285888ed6cd15b595ad1b944b778d4fb8ce6 Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Wed, 31 Aug 2022 23:13:01 -0400 Subject: [PATCH 02/10] update docstrings and reno --- qiskit_ibm_runtime/options.py | 6 ++++++ qiskit_ibm_runtime/qiskit_runtime_service.py | 1 + qiskit_ibm_runtime/runtime_options.py | 10 +++++++++- releasenotes/notes/add-options-26c127fcd40623a5.yaml | 5 +++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/qiskit_ibm_runtime/options.py b/qiskit_ibm_runtime/options.py index 02140d53b..19f65bd6e 100644 --- a/qiskit_ibm_runtime/options.py +++ b/qiskit_ibm_runtime/options.py @@ -104,6 +104,12 @@ class Options: """Options for the primitive programs. Args: + max_execution_time: Maximum execution time in seconds. This overrides + the max_execution_time of the program and cannot exceed it. + + job_tags: Tags to be assigned to the job. The tags can subsequently be used + as a filter in the :meth:`jobs()` function call. + optimization_level: How much optimization to perform on the circuits. Higher levels generate more optimized circuits, at the expense of longer transpilation times. diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index 7189f8b75..0e9765575 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -860,6 +860,7 @@ def run( inputs: Program input parameters. These input values are passed to the runtime program. options: Runtime options that control the execution environment. + ``job_tags`` and ``max_execution_time`` can also be set here. * backend: target backend to run on. This is required for ``ibm_quantum`` runtime. * image: the runtime image used to execute the program, specified in diff --git a/qiskit_ibm_runtime/runtime_options.py b/qiskit_ibm_runtime/runtime_options.py index fe0c1dfc1..ab184291e 100644 --- a/qiskit_ibm_runtime/runtime_options.py +++ b/qiskit_ibm_runtime/runtime_options.py @@ -15,7 +15,7 @@ import re import logging from dataclasses import dataclass -from typing import Optional +from typing import Optional, List from qiskit.utils.deprecation import deprecate_arguments @@ -34,6 +34,8 @@ def __init__( backend: Optional[str] = None, image: Optional[str] = None, log_level: Optional[str] = None, + job_tags: Optional[List[str]] = None, + max_execution_time: Optional[int] = None ) -> None: """RuntimeOptions constructor. @@ -45,10 +47,16 @@ def __init__( log_level: logging level to set in the execution environment. The valid log levels are: ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR``, and ``CRITICAL``. The default level is ``WARNING``. + job_tags: Tags to be assigned to the job. The tags can subsequently be used + as a filter in the :meth:`jobs()` function call. + max_execution_time: Maximum execution time in seconds. This overrides + the max_execution_time of the program and cannot exceed it. """ self.backend = backend self.image = image self.log_level = log_level + self.job_tags = job_tags + self.max_execution_time = max_execution_time def validate(self, channel: str) -> None: """Validate options. diff --git a/releasenotes/notes/add-options-26c127fcd40623a5.yaml b/releasenotes/notes/add-options-26c127fcd40623a5.yaml index a43ad20bf..67f223198 100644 --- a/releasenotes/notes/add-options-26c127fcd40623a5.yaml +++ b/releasenotes/notes/add-options-26c127fcd40623a5.yaml @@ -1,5 +1,6 @@ --- upgrade: - | - ``job_tags`` and ``max_execution_time`` can now be passed into the `qiskit_ibm_runtime.Options` - class. + ``job_tags`` and ``max_execution_time`` can now be passed into + :class:`qiskit_ibm_runtime.Options`. :class:`qiskit_ibm_runtime.RuntimeOptions` + has also been updated to include these two parameters. From 15bb91f04c466b6dcb5591d58ac5f6851c01b20c Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Wed, 31 Aug 2022 23:16:02 -0400 Subject: [PATCH 03/10] fix lint --- qiskit_ibm_runtime/runtime_options.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_ibm_runtime/runtime_options.py b/qiskit_ibm_runtime/runtime_options.py index ab184291e..23d70c291 100644 --- a/qiskit_ibm_runtime/runtime_options.py +++ b/qiskit_ibm_runtime/runtime_options.py @@ -35,7 +35,7 @@ def __init__( image: Optional[str] = None, log_level: Optional[str] = None, job_tags: Optional[List[str]] = None, - max_execution_time: Optional[int] = None + max_execution_time: Optional[int] = None, ) -> None: """RuntimeOptions constructor. From 32076f3c5a6ad9ee635d56d1eb9bbf74ed4d4fe2 Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Thu, 8 Sep 2022 18:24:58 -0400 Subject: [PATCH 04/10] update docstrings --- qiskit_ibm_runtime/options.py | 7 ++++--- qiskit_ibm_runtime/qiskit_runtime_service.py | 4 ++-- qiskit_ibm_runtime/runtime_options.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/qiskit_ibm_runtime/options.py b/qiskit_ibm_runtime/options.py index 19f65bd6e..5e1d8c479 100644 --- a/qiskit_ibm_runtime/options.py +++ b/qiskit_ibm_runtime/options.py @@ -104,11 +104,12 @@ class Options: """Options for the primitive programs. Args: - max_execution_time: Maximum execution time in seconds. This overrides - the max_execution_time of the program and cannot exceed it. + max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. job_tags: Tags to be assigned to the job. The tags can subsequently be used - as a filter in the :meth:`jobs()` function call. + as a filter in the :meth:`qiskit_ibm_runtime.qiskit_runtime_service.jobs()` + function call. optimization_level: How much optimization to perform on the circuits. Higher levels generate more optimized circuits, diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index 0e9765575..aef9852ef 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -883,8 +883,8 @@ def run( session_id: Job ID of the first job in a runtime session. job_tags: Tags to be assigned to the job. The tags can subsequently be used as a filter in the :meth:`jobs()` function call. - max_execution_time: Maximum execution time in seconds. This overrides - the max_execution_time of the program and cannot exceed it. + max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. start_session: Set to True to explicitly start a runtime session. Defaults to False. Returns: diff --git a/qiskit_ibm_runtime/runtime_options.py b/qiskit_ibm_runtime/runtime_options.py index 23d70c291..abbc0fa20 100644 --- a/qiskit_ibm_runtime/runtime_options.py +++ b/qiskit_ibm_runtime/runtime_options.py @@ -49,8 +49,8 @@ def __init__( The default level is ``WARNING``. job_tags: Tags to be assigned to the job. The tags can subsequently be used as a filter in the :meth:`jobs()` function call. - max_execution_time: Maximum execution time in seconds. This overrides - the max_execution_time of the program and cannot exceed it. + max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. """ self.backend = backend self.image = image From eaeac765fee1b8146eab7cb53ff7c062a54e3660 Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 11:25:30 -0400 Subject: [PATCH 05/10] cleanup merge conflicts --- qiskit_ibm_runtime/ibm_backend.py | 6 ++++-- qiskit_ibm_runtime/options.py | 12 +++++------- qiskit_ibm_runtime/qiskit_runtime_service.py | 19 ++++++------------- qiskit_ibm_runtime/runtime_options.py | 13 +++++++++++++ qiskit_ibm_runtime/runtime_session.py | 1 - qiskit_ibm_runtime/session.py | 8 ++++---- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/qiskit_ibm_runtime/ibm_backend.py b/qiskit_ibm_runtime/ibm_backend.py index df71c6540..8d7f4f426 100644 --- a/qiskit_ibm_runtime/ibm_backend.py +++ b/qiskit_ibm_runtime/ibm_backend.py @@ -545,6 +545,10 @@ def run( """ # pylint: disable=arguments-differ options = {"backend_name": self.name} + if job_tags: + options["job_tags"] = job_tags + if max_execution_time: + options["max_execution_time"] = max_execution_time inputs = {"circuits": circuits} if shots: inputs["shots"] = shots @@ -573,8 +577,6 @@ def run( result_decoder=result_decoder, instance=instance, session_id=session_id, - job_tags=job_tags, - max_execution_time=max_execution_time, start_session=start_session, ) diff --git a/qiskit_ibm_runtime/options.py b/qiskit_ibm_runtime/options.py index 45ec42a53..3785cb815 100644 --- a/qiskit_ibm_runtime/options.py +++ b/qiskit_ibm_runtime/options.py @@ -160,6 +160,7 @@ class EnvironmentOptions: log_level: str = "WARNING" image: Optional[str] = None instance: Optional[str] = None + job_tags: Optional[List[str]] = None @_flexible @@ -168,13 +169,6 @@ class Options: """Options for the primitive programs. Args: - max_execution_time: Maximum execution time in seconds. If - a job exceeds this time limit, it is forcibly cancelled. - - job_tags: Tags to be assigned to the job. The tags can subsequently be used - as a filter in the :meth:`qiskit_ibm_runtime.qiskit_runtime_service.jobs()` - function call. - optimization_level: How much optimization to perform on the circuits. Higher levels generate more optimized circuits, at the expense of longer transpilation times. @@ -270,6 +264,10 @@ class Options: * instance: The hub/group/project to use, in that format. This is only supported for ``ibm_quantum`` channel. If ``None``, a hub/group/project that provides access to the target backend is randomly selected. + + * job_tags: Tags to be assigned to the job. The tags can subsequently be used + as a filter in the :meth:`qiskit_ibm_runtime.qiskit_runtime_service.jobs()` + function call. """ optimization_level: int = 1 diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index dbcdd5877..7718ad172 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -47,7 +47,6 @@ from .utils import RuntimeDecoder, to_base64_string, to_python_identifier from .utils.backend_decoder import configuration_from_server_data from .utils.hgp import to_instance_format, from_instance_format -from .utils.utils import validate_job_tags from .api.client_parameters import ClientParameters from .runtime_options import RuntimeOptions from .utils.deprecation import ( @@ -854,8 +853,6 @@ def run( result_decoder: Optional[Type[ResultDecoder]] = None, instance: Optional[str] = None, session_id: Optional[str] = None, - job_tags: Optional[List[str]] = None, - max_execution_time: Optional[int] = None, start_session: Optional[bool] = False, ) -> RuntimeJob: """Execute the runtime program. @@ -865,8 +862,6 @@ def run( inputs: Program input parameters. These input values are passed to the runtime program. options: Runtime options that control the execution environment. - ``job_tags`` and ``max_execution_time`` can also be set here. - * backend: target backend to run on. This is required for ``ibm_quantum`` runtime. * image: the runtime image used to execute the program, specified in the form of ``image_name:tag``. Not all accounts are @@ -874,6 +869,10 @@ def run( * log_level: logging level to set in the execution environment. The valid log levels are: ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR``, and ``CRITICAL``. The default level is ``WARNING``. + * job_tags: Tags to be assigned to the job. The tags can subsequently be used + as a filter in the :meth:`jobs()` function call. + * max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. callback: Callback function to be invoked for any interim results and final result. The callback function will receive 2 positional parameters: @@ -886,10 +885,6 @@ def run( instance: This is only supported for ``ibm_quantum`` runtime and is in the hub/group/project format. session_id: Job ID of the first job in a runtime session. - job_tags: Tags to be assigned to the job. The tags can subsequently be used - as a filter in the :meth:`jobs()` function call. - max_execution_time: Maximum execution time in seconds. If - a job exceeds this time limit, it is forcibly cancelled. start_session: Set to True to explicitly start a runtime session. Defaults to False. Returns: @@ -906,7 +901,6 @@ def run( DeprecationWarning, stacklevel=2, ) - validate_job_tags(job_tags, IBMInputValueError) qrt_options: RuntimeOptions = options if options is None: @@ -947,9 +941,8 @@ def run( hgp=hgp_name, log_level=qrt_options.log_level, session_id=session_id, - job_tags=job_tags or options.get("job_tags"), - max_execution_time=max_execution_time - or options.get("max_execution_time"), + job_tags=qrt_options.job_tags, + max_execution_time=qrt_options.max_execution_time, start_session=start_session, ) except RequestsApiError as ex: diff --git a/qiskit_ibm_runtime/runtime_options.py b/qiskit_ibm_runtime/runtime_options.py index 64334ad3a..9ef94c96a 100644 --- a/qiskit_ibm_runtime/runtime_options.py +++ b/qiskit_ibm_runtime/runtime_options.py @@ -21,6 +21,7 @@ from .exceptions import IBMInputValueError from .utils.deprecation import issue_deprecation_msg +from .utils.utils import validate_job_tags @dataclass(init=False) @@ -31,6 +32,8 @@ class RuntimeOptions: image: Optional[str] = None log_level: Optional[str] = None instance: Optional[str] = None + job_tags: Optional[List[str]] = None + max_execution_time: Optional[int] = None @deprecate_arguments({"backend_name": "backend"}) def __init__( @@ -39,6 +42,8 @@ def __init__( image: Optional[str] = None, log_level: Optional[str] = None, instance: Optional[str] = None, + job_tags: Optional[List[str]] = None, + max_execution_time: Optional[int] = None, ) -> None: """RuntimeOptions constructor. @@ -53,11 +58,17 @@ def __init__( instance: The hub/group/project to use, in that format. This is only supported for ``ibm_quantum`` channel. If ``None``, a hub/group/project that provides access to the target backend is randomly selected. + job_tags: Tags to be assigned to the job. The tags can subsequently be used + as a filter in the :meth:`jobs()` function call. + max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. """ self.backend = backend self.image = image self.log_level = log_level self.instance = instance + self.job_tags = job_tags + self.max_execution_time = max_execution_time def validate(self, channel: str) -> None: """Validate options. @@ -91,6 +102,8 @@ def validate(self, channel: str) -> None: f"{self.log_level} is not a valid log level. The valid log levels are: `DEBUG`, " f"`INFO`, `WARNING`, `ERROR`, and `CRITICAL`." ) + if self.job_tags: + validate_job_tags(self.job_tags, IBMInputValueError) @property def backend_name(self) -> str: diff --git a/qiskit_ibm_runtime/runtime_session.py b/qiskit_ibm_runtime/runtime_session.py index 62368a348..67d9bbad8 100644 --- a/qiskit_ibm_runtime/runtime_session.py +++ b/qiskit_ibm_runtime/runtime_session.py @@ -91,7 +91,6 @@ def _run(self, inputs: Union[Dict, ParameterNamespace]) -> RuntimeJob: inputs=inputs, session_id=self._session_id, start_session=self._start_session, - max_execution_time=self._max_time, ) @_active_session diff --git a/qiskit_ibm_runtime/session.py b/qiskit_ibm_runtime/session.py index 436ffab4c..97919ab36 100644 --- a/qiskit_ibm_runtime/session.py +++ b/qiskit_ibm_runtime/session.py @@ -133,13 +133,14 @@ def run( Returns: Submitted job. """ - # TODO: Cache data when server supports it. - # TODO: Do we really need to specify a None max time if session has started? - max_time = self._max_time if not self._session_id else None options = options or {} options["backend"] = self._backend + # TODO: Do we really need to specify a None max time if session has started? + max_time = self._max_time if not self._session_id else None + if max_time: + options["max_execution_time"] = max_time job = self._service.run( program_id=program_id, @@ -147,7 +148,6 @@ def run( inputs=inputs, session_id=self._session_id, start_session=self._session_id is None, - max_execution_time=max_time, callback=callback, result_decoder=result_decoder, ) From 5cc1fd558ffde6afe73f2f4331d26c98065558ae Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 11:43:21 -0400 Subject: [PATCH 06/10] fix docs build --- qiskit_ibm_runtime/qiskit_runtime_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index 7718ad172..67cece4d0 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -862,6 +862,7 @@ def run( inputs: Program input parameters. These input values are passed to the runtime program. options: Runtime options that control the execution environment. + * backend: target backend to run on. This is required for ``ibm_quantum`` runtime. * image: the runtime image used to execute the program, specified in the form of ``image_name:tag``. Not all accounts are From a1afacf3dc89af703e3fc0b7750e9c5a03eed27c Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 12:02:48 -0400 Subject: [PATCH 07/10] fix unit tests --- test/program.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/program.py b/test/program.py index 7804f81e1..e4fc4af72 100644 --- a/test/program.py +++ b/test/program.py @@ -86,7 +86,13 @@ def run_program( ): """Run a program.""" backend_name = backend_name if backend_name is not None else "common_backend" - options = {"backend": backend_name, "image": image, "log_level": log_level} + options = { + "backend": backend_name, + "image": image, + "log_level": log_level, + "job_tags": job_tags, + "max_execution_time": max_execution_time, + } if final_status is not None: service._api_client.set_final_status(final_status) elif job_classes: @@ -99,8 +105,6 @@ def run_program( inputs=inputs, result_decoder=decoder, instance=instance, - job_tags=job_tags, - max_execution_time=max_execution_time, session_id=session_id, ) job._creation_date = datetime.now(timezone.utc) From 00fad2225c13256773191f7efac85cad7831d4bb Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 15:42:49 -0400 Subject: [PATCH 08/10] add max_execution_time to 1st lvl --- qiskit_ibm_runtime/options.py | 6 +++++- qiskit_ibm_runtime/qiskit_runtime_service.py | 4 +++- releasenotes/notes/add-options-26c127fcd40623a5.yaml | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/qiskit_ibm_runtime/options.py b/qiskit_ibm_runtime/options.py index 3785cb815..77d7676a2 100644 --- a/qiskit_ibm_runtime/options.py +++ b/qiskit_ibm_runtime/options.py @@ -169,6 +169,9 @@ class Options: """Options for the primitive programs. Args: + max_execution_time: Maximum execution time in seconds. If + a job exceeds this time limit, it is forcibly cancelled. + optimization_level: How much optimization to perform on the circuits. Higher levels generate more optimized circuits, at the expense of longer transpilation times. @@ -270,6 +273,7 @@ class Options: function call. """ + max_execution_time: int = None optimization_level: int = 1 resilience_level: int = 0 transpilation: Union[TranspilationOptions, Dict] = field( @@ -349,7 +353,7 @@ def _get_runtime_options(options: Dict) -> Dict: for fld in fields(RuntimeOptions): if fld.name in environment: out[fld.name] = environment[fld.name] - + out["max_execution_time"] = options.get("max_execution_time") return out def _merge_options(self, new_options: Optional[Dict] = None) -> Dict: diff --git a/qiskit_ibm_runtime/qiskit_runtime_service.py b/qiskit_ibm_runtime/qiskit_runtime_service.py index 67cece4d0..3a9a68bfd 100644 --- a/qiskit_ibm_runtime/qiskit_runtime_service.py +++ b/qiskit_ibm_runtime/qiskit_runtime_service.py @@ -928,7 +928,9 @@ def run( hgp_name = None if self._channel == "ibm_quantum": # Find the right hgp - hgp = self._get_hgp(instance=instance, backend_name=qrt_options.backend) + hgp = self._get_hgp( + instance=qrt_options.instance, backend_name=qrt_options.backend + ) backend = hgp.backend(qrt_options.backend) hgp_name = hgp.name diff --git a/releasenotes/notes/add-options-26c127fcd40623a5.yaml b/releasenotes/notes/add-options-26c127fcd40623a5.yaml index 67f223198..dc5754fba 100644 --- a/releasenotes/notes/add-options-26c127fcd40623a5.yaml +++ b/releasenotes/notes/add-options-26c127fcd40623a5.yaml @@ -1,6 +1,6 @@ --- upgrade: - | - ``job_tags`` and ``max_execution_time`` can now be passed into - :class:`qiskit_ibm_runtime.Options`. :class:`qiskit_ibm_runtime.RuntimeOptions` - has also been updated to include these two parameters. + The :class:`qiskit_ibm_runtime.Options` class now accepts + ``max_execution_time`` as a first level option and ``job_tags`` as an option under `environment`. + :class:`qiskit_ibm_runtime.RuntimeOptions` has also been updated to include these two parameters. From 96226f953fd2cb21e252de632684314e9179fec3 Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 15:46:29 -0400 Subject: [PATCH 09/10] fix integration --- test/ibm_test_case.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/ibm_test_case.py b/test/ibm_test_case.py index 971e1ce1b..6ce6db1df 100644 --- a/test/ibm_test_case.py +++ b/test/ibm_test_case.py @@ -203,13 +203,12 @@ def _run_program( backend_name = ( backend if backend is not None else self.sim_backends[service.channel] ) - options = {"backend": backend_name, "log_level": log_level} + options = {"backend": backend_name, "log_level": log_level,'job_tags': job_tags, + 'max_execution_time': max_execution_time} job = service.run( program_id=pid, inputs=inputs, options=options, - job_tags=job_tags, - max_execution_time=max_execution_time, session_id=session_id, callback=callback, start_session=start_session, From 2fc4e657db7e9e82f55e34edd0bb25c369171b41 Mon Sep 17 00:00:00 2001 From: kevin-tian <kevin.tian@ibm.com> Date: Tue, 4 Oct 2022 15:54:02 -0400 Subject: [PATCH 10/10] fix lint --- test/ibm_test_case.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/ibm_test_case.py b/test/ibm_test_case.py index 6ce6db1df..6fe0cb16b 100644 --- a/test/ibm_test_case.py +++ b/test/ibm_test_case.py @@ -203,8 +203,12 @@ def _run_program( backend_name = ( backend if backend is not None else self.sim_backends[service.channel] ) - options = {"backend": backend_name, "log_level": log_level,'job_tags': job_tags, - 'max_execution_time': max_execution_time} + options = { + "backend": backend_name, + "log_level": log_level, + "job_tags": job_tags, + "max_execution_time": max_execution_time, + } job = service.run( program_id=pid, inputs=inputs,