Skip to content
This repository was archived by the owner on Jul 28, 2023. 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
11 changes: 10 additions & 1 deletion qiskit/providers/ibmq/job/ibmqjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,21 @@ def qobj(self):
def properties(self):
"""Return the backend properties for this job.

The properties might not be available if the job hasn't completed,
in which case None is returned.

Returns:
BackendProperties: the backend properties used for this job.
BackendProperties: the backend properties used for this job, or None if
properties are not available.
"""
self._wait_for_submission()

properties = self._api.job_properties(job_id=self.job_id())

# Backend properties of a job might not be available if the job hasn't
# completed. This is to ensure the properties returned are up to date.
Comment thread
diego-plan9 marked this conversation as resolved.
if not properties:
return None
return BackendProperties.from_dict(properties)

# pylint: disable=arguments-differ
Expand Down
11 changes: 11 additions & 0 deletions test/ibmq/test_ibmq_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,17 @@ def test_error_message_qasm(self, qe_token, qe_url):
message = job_sim.error_message()
self.assertIn('Job resulted in the following QASM status(es): ', message)

@slow_test
@requires_qe_access
def test_running_job_properties(self, qe_token, qe_url):
"""Test fetching properties of a running job."""
IBMQ.enable_account(qe_token, qe_url)
backend = least_busy(IBMQ.backends(simulator=False))
Comment thread
diego-plan9 marked this conversation as resolved.

qobj = assemble(transpile(self._qc, backend=backend), backend=backend)
job = backend.run(qobj)
_ = job.properties()


def _bell_circuit():
qr = QuantumRegister(2, 'q')
Expand Down