Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
provider.run_circuits now takes a backend_name instead of Backend o…
Browse files Browse the repository at this point in the history
…bject (#173) (#1067)

* run_circuits now takes a backend_name instead of Backend object

* Fix lint

* Update releasenotes/notes/upgrade-run-circuits-backend-name-0dfce7eb558f224f.yaml

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

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

Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
  • Loading branch information
rathishcholarajan and jyu00 authored Oct 27, 2021
1 parent 2301963 commit 4c27380
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 3 additions & 5 deletions qiskit/providers/ibmq/accountprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from qiskit.providers.models import (QasmBackendConfiguration,
PulseBackendConfiguration)
from qiskit.circuit import QuantumCircuit
from qiskit.providers.backend import BackendV1 as Backend
from qiskit.providers.basebackend import BaseBackend
from qiskit.transpiler import Layout
from qiskit.providers.ibmq.runtime import runtime_job # pylint: disable=unused-import
from qiskit.providers.ibmq import ibmqfactory # pylint: disable=unused-import
Expand Down Expand Up @@ -221,7 +219,7 @@ def _discover_remote_backends(self, timeout: Optional[float] = None) -> Dict[str
def run_circuits(
self,
circuits: Union[QuantumCircuit, List[QuantumCircuit]],
backend: Union[Backend, BaseBackend],
backend_name: str,
shots: Optional[int] = None,
initial_layout: Optional[Union[Layout, Dict, List]] = None,
layout_method: Optional[str] = None,
Expand All @@ -245,7 +243,7 @@ def run_circuits(
Args:
circuits: Circuit(s) to execute.
backend: Backend to execute circuits on.
backend_name: Name of the backend to execute circuits on.
Transpiler options are automatically grabbed from backend configuration
and properties unless otherwise specified.
Expand Down Expand Up @@ -316,7 +314,7 @@ def run_circuits(
if use_measure_esp is not None:
inputs['use_measure_esp'] = use_measure_esp

options = {'backend_name': backend.name()}
options = {'backend_name': backend_name}
return self.runtime.run('circuit-runner', options=options, inputs=inputs,
result_decoder=RunnerResult)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
upgrade:
- |
:meth:`qiskit.providers.ibmq.AccountProvider.run_circuits` method now takes a `backend_name`
parameter, which is a string, instead of `backend`, which is a ``Backend`` object.
4 changes: 2 additions & 2 deletions test/ibmq/runtime/test_runtime_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,9 @@ def test_logout(self):
_ = self._run_program()

def test_run_circuit(self):
"""Test run_circuit"""
"""Test run_circuits"""
job = self.provider.run_circuits(
ReferenceCircuits.bell(), backend=self.backend, shots=100)
ReferenceCircuits.bell(), backend_name=self.backend.name(), shots=100)
counts = job.result().get_counts()
self.assertEqual(100, sum(counts.values()))

Expand Down

0 comments on commit 4c27380

Please sign in to comment.