I am trying to execute qiskit runtime jobs on simulators and real machines and I would like to extract information about the time taken to execute each runtime job. Since using python time.time()
method will include also queueing time, which I would like to exclude, I thought about checking on time_taken
attribute of the RuntimeJob
. To this end, I found this code:
job = provider.runtime.run(program_id='...', inputs=inputs, options=options)
job_id = job.job_id()
job_info = backend.retrieve_job(job_id)
And my plan was to use the time_taken
attribute, as I have seen in many other threads.
However, I get the following error:
File "/usr/local/lib/python3.9/dist-packages/qiskit/providers/ibmq/ibmqbackendservice.py", line 484, in retrieve_job
raise IBMQBackendApiError('Failed to get job {}: {}'
qiskit.providers.ibmq.exceptions.IBMQBackendApiError: "Failed to get job c8s4h14o112vg1vn8ed0: '404 Client Error: Not Found for url: https://api-qcon.quantum-computing.ibm.com/api/Network/.../main/Jobs/c8s4h14o112vg1vn8ed0/v/1. Job not found., Error code: 3250.'
I checked the id in the IBM quantum service web interface, and the job_id
is the same. I do not understand what I am doing wrong. Is there something I am missing?
Until now, that's the best I could do, but I am sure there is a better way:
job = provider.runtime.run(program_id='x', inputs=inputs, options=options)
while job.status() != JobStatus.RUNNING:
pass
start = time.time()
res = job.result()
end = time.time()
Thanks a lot for your attention and Best Regards!
job = provider.runtime.job('JOB_ID')
See more details here: quantumcomputing.stackexchange.com/questions/23637/… $\endgroup$