Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Stop using basic aer internal private attributes (#1554)
Browse files Browse the repository at this point in the history
* Stop using basic aer internal private attributes

This commit fixes the usage of internal only explicitly private
attributes of basicaer's job class. These look they were used to
manually create a job id which was manually set ahead of time despite
still being a random uuid and then launching a simulation from that
constructed job object. Which is both the incorrect order to run a
simulation (runs generate jobs, not the other way around) but also
served no functional purpose. This commit removes this as this is a
blocker for Qiskit/qiskit#5218 which is upgrading the basic aer
provider to use the latest versioned provider interface which removes
all of those private methods and also moves to a synchronous execution
model.

* Fix lint

* Update run_circuits.py

Fix copyright

Co-authored-by: Steve Wood <40241007+woodsp-ibm@users.noreply.github.com>
  • Loading branch information
mtreinish and woodsp-ibm authored Mar 18, 2021
1 parent 372f498 commit 7229dd1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions qiskit/aqua/utils/run_circuits.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
# (C) Copyright IBM 2018, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
Expand All @@ -24,7 +24,6 @@
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit.providers import Backend, BaseBackend, JobStatus, JobError, BaseJob
from qiskit.providers.jobstatus import JOB_FINAL_STATES
from qiskit.providers.basicaer import BasicAerJob
from qiskit.result import Result
from qiskit.qobj import QasmQobj
from qiskit.exceptions import QiskitError
Expand Down Expand Up @@ -374,10 +373,7 @@ def run_on_backend(backend: Union[Backend, BaseBackend],
qobj.config.noise_model = noise_config['noise_model']
job = backend.run(qobj, validate=False)
elif is_basicaer_provider(backend):
job_id = str(uuid.uuid4())
backend._set_options(qobj_config=qobj.config, **backend_options)
job = BasicAerJob(backend, job_id, backend._run_job, qobj)
job._future = job._executor.submit(job._fn, job._job_id, job._qobj)
job = backend.run(qobj, **backend_options)
else:
logger.info(
"Can't skip qobj validation for the %s provider.",
Expand Down

0 comments on commit 7229dd1

Please sign in to comment.