3
$\begingroup$

The IBMQ web interface shows both queue position and an approximate execution time for every pending job (see image below). Is there a way to retrieve this information via Qiskit? I know that qiskit.providers.ibmq.job.IBMQJob has a queue_position() method, but what about the approximate execution time?

Thanks in advance!

IBMQ Job table

$\endgroup$

3 Answers 3

3
$\begingroup$

If you're looking for the actual time spent on the device, time_taken mentioned by @KAJ226b is the right attribute.

If you're looking for the estimated job completion time, you can use the queue_info() method of IBMQJob. It gives you the estimated start/completion time, job priority, and queue position (if available).

$\endgroup$
1
  • $\begingroup$ QueueInfo.estimated_start_time is exactly what I was looking for. Perfect, thanks! $\endgroup$
    – smuecke
    Commented Jun 2, 2021 at 5:51
1
$\begingroup$

This should work:

backend=provider.get_backend('The backend that you used') #Example: 'ibmq_santiago' 
job = backend.retrieve_job('Put your JOB ID here') #You can get this on the ibmq web interface 
job_result = job.result()
job_approx_execution_time = job_result.time_taken 

Note for the Job ID, you can see and copy it from the ibmq web interface: enter image description here

Also make sure you use the same provider to extract your backend. This shouldn't be a problem if you only have one provider which is the case for most people. But there are cases where you have different providers, which essentially allocate the different machines you can use.

$\endgroup$
1
  • $\begingroup$ job_result.time_taken (apparently) does not exist anymore. It seems it has been replaced with job.metrics() under the "usage" key. Is it possible for you to update your answer please? :) $\endgroup$
    – Tristan Nemoz
    Commented Jan 9 at 13:17
0
$\begingroup$

For those looking to get up to date on this, as the approved answer will change over time, be sure to check the documentation that states this clearly:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.