Skip to content

Commit

Permalink
Add support for v2 provider interface (qiskit-community/qiskit-aqua#1270
Browse files Browse the repository at this point in the history
)

* Add support for v2 provider interface

In Qiskit#5086 the v2 provider interface is being added.
This starter interface is basically a drop in replacement for the v1
interface with 3 changes it's explicitly versioned at the object level,
Backend.run() can take in a circuit object, and Job objects can also be
async or sync. Eventually the interace will likely evolve towards a
model similar to what was initially done in Qiskit#4885.
This commit adds initial support for v2 provider backend objects, the
explicit type checking for BaseBackend objects is blocking the terra PR
from moving forward (because it switched BasicAer to use the v2
interface). This initial support just means accepting v2 Backend objects
in addition to v1 BaseBackend objects.

Depends on Qiskit#5086

* Fix import path

* fix style

Co-authored-by: Manoel Marques <manoel.marques@ibm.com>
  • Loading branch information
mtreinish and manoelmarques authored Oct 6, 2020
1 parent bd7d433 commit 273f461
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion qiskit/aqua/utils/run_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import numpy as np
from qiskit.providers import BaseBackend, JobStatus, JobError
from qiskit.providers import Backend
from qiskit.providers.jobstatus import JOB_FINAL_STATES
from qiskit.providers.basicaer import BasicAerJob
from qiskit.qobj import QasmQobj
Expand Down Expand Up @@ -218,7 +219,7 @@ def run_qobj(qobj, backend, qjob_config=None, backend_options=None,
backend_options = backend_options or {}
noise_config = noise_config or {}

if backend is None or not isinstance(backend, BaseBackend):
if backend is None or not isinstance(backend, (Backend, BaseBackend)):
raise ValueError('Backend is missing or not an instance of BaseBackend')

with_autorecover = not is_simulator_backend(backend)
Expand Down

0 comments on commit 273f461

Please sign in to comment.