Skip to content

Commit

Permalink
Fixing AerJob::status() method to deal with Python's Future (#1215)
Browse files Browse the repository at this point in the history
* Fixing AerJob::status() method to deal with Python's Future
PENDING state
  • Loading branch information
atilag committed Nov 5, 2018
1 parent 9d603f1 commit 8a25a01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -61,6 +61,7 @@ Fixed
- Fixed horizontal spacing when drawing barriers before CCNOT gates in latex
circuit plots (#1051)
- Use case insensitive matching when comparing premium account URLs. (#1102)
- Fixed AerJob status when the submitted Job is in a PENDING state. (#1215)

Removed
-------
Expand Down
8 changes: 6 additions & 2 deletions qiskit/backends/aer/aerjob.py
Expand Up @@ -114,8 +114,12 @@ def status(self):
elif self._future.done():
_status = JobStatus.DONE if self._future.exception() is None else JobStatus.ERROR
else:
raise JobError('Unexpected behavior of {0}'.format(
self.__class__.__name__))
# Note: There is an undocumented Future state: PENDING, that seems to show up when
# the job is enqueued, waiting for someone to pick it up. We need to deal with this
# state but there's no public API for it, so we are assuming that if the job is not
# in any of the previous states, is PENDING, ergo INITIALIZING for us.
_status = JobStatus.INITIALIZING

return _status

def backend_name(self):
Expand Down

0 comments on commit 8a25a01

Please sign in to comment.