Skip to content

Commit

Permalink
Merge branch 'main' into job-state-field
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 committed Mar 7, 2022
2 parents ad2e84e + ad1f1dd commit 8f13b04
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = '0.1.0'
release = '0.2.0'

# -- General configuration ---------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.. release-notes:: Release Notes
:branch: main
2 changes: 1 addition & 1 deletion qiskit_ibm_runtime/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.2.0
3 changes: 2 additions & 1 deletion qiskit_ibm_runtime/runtime_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ def wait_for_final_state(self, timeout: Optional[float] = None) -> None:
"""
if self._state["status"] not in JOB_FINAL_STATES and not self._is_streaming():
self._ws_client_future = self._executor.submit(self._start_websocket_client)
self._ws_client_future.result(timeout)
if self._is_streaming():
self._ws_client_future.result(timeout)
self.status()

def stream_results(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Fixed a bug where :meth:`qiskit_ibm_runtime.RuntimeJob.wait_for_final_state`
would result in a NoneType error if the job already completed and
:meth:`qiskit_ibm_runtime.RuntimeJob.status` was called beforehand.
12 changes: 11 additions & 1 deletion test/integration/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import random
import time

from qiskit.providers.jobstatus import JobStatus
from qiskit.providers.jobstatus import JOB_FINAL_STATES, JobStatus
from qiskit.test.decorators import slow_test

from qiskit_ibm_runtime.constants import API_TO_JOB_ERROR_MESSAGE
Expand Down Expand Up @@ -220,6 +220,16 @@ def test_wait_for_final_state(self, service):
job.wait_for_final_state()
self.assertEqual(JobStatus.DONE, job.status())

@run_integration_test
def test_wait_for_final_state_after_job_status(self, service):
"""Test wait for final state on a completed job when the status is updated first."""
job = self._run_program(service)
status = job.status()
while status not in JOB_FINAL_STATES:
status = job.status()
job.wait_for_final_state()
self.assertEqual(JobStatus.DONE, job.status())

@run_integration_test
def test_job_creation_date(self, service):
"""Test job creation date."""
Expand Down

0 comments on commit 8f13b04

Please sign in to comment.