Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Changed
- Classical algorithms renamed, former names deprecated (#851)
- Chemistry process algorithm result returns result object, lines, dict return deprecated (#861)
- Measurement error mitigation supports different output orders on same qubits (#865)
- If ibmq-provider is used and job limit is reached, `run_circuit` now waits for a previous job
to finish before submitting the next one. (#906)

Removed
-------
Expand Down
23 changes: 17 additions & 6 deletions qiskit/aqua/utils/run_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
from qiskit.providers.jobstatus import JOB_FINAL_STATES
from qiskit.providers.basicaer import BasicAerJob
from qiskit.qobj import QasmQobj
from qiskit.exceptions import QiskitError
from qiskit.aqua.aqua_error import AquaError
from qiskit.aqua.utils.backend_utils import (is_aer_provider,
is_basicaer_provider,
is_simulator_backend,
is_local_backend)
is_local_backend,
is_ibmq_provider)

MAX_CIRCUITS_PER_JOB = os.environ.get('QISKIT_AQUA_MAX_CIRCUITS_PER_JOB', None)
MAX_GATES_PER_JOB = os.environ.get('QISKIT_AQUA_MAX_GATES_PER_JOB', None)
Expand Down Expand Up @@ -134,15 +136,24 @@ def _maybe_split_qobj_by_gates(qobjs, qobj):
def _safe_submit_qobj(qobj, backend, backend_options, noise_config, skip_qobj_validation):
# assure get job ids
while True:
job = run_on_backend(backend, qobj, backend_options=backend_options,
noise_config=noise_config,
skip_qobj_validation=skip_qobj_validation)
try:
job = run_on_backend(backend, qobj, backend_options=backend_options,
noise_config=noise_config,
skip_qobj_validation=skip_qobj_validation)
job_id = job.job_id()
break
except JobError as ex:
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id."
except QiskitError as ex:
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id. "
"Terra job error: %s ", ex)
if is_ibmq_provider(backend) and 'Error code: 3458' in str(ex):
# TODO Use IBMQBackendJobLimitError when new IBM Q provider is released.
oldest_running = backend.jobs(limit=1, descending=False,
status=['QUEUED', 'VALIDATING', 'RUNNING'])
if oldest_running:
oldest_running = oldest_running[0]
logger.warning("Job limit reached, waiting for job %s to finish "
"before submitting the next one.", oldest_running.job_id())
oldest_running.wait_for_final_state(timeout=300)
except Exception as ex: # pylint: disable=broad-except
logger.warning("FAILURE: Can not get job id, Resubmit the qobj to get job id."
"Error: %s ", ex)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
qiskit-terra>=0.11.0
qiskit-terra>=0.13.0
qiskit-ignis>=0.2.0
scipy>=1.0
sympy>=1.3
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Qiskit Finance, Qiskit Machine Learning and Qiskit Optimization to experiment with real-world applications to quantum computing."""

requirements = [
"qiskit-terra>=0.11.0",
"qiskit-terra>=0.13.0",
"qiskit-ignis>=0.2.0",
"scipy>=1.0",
"sympy>=1.3",
Expand Down