1
$\begingroup$

I am executing a quantum circuit on an IBM quantum device and I need to start a timer as soon as the job in the queue starts running. I have already used:

result = job.result() 
execution_time = result.time_taken

but in this particular case what I need is more like a "signal", like a variable that is switched on as soon as the queue is over and causes the timer to start. I tried using the job status but it didn't seem to work.

$\endgroup$
1
$\begingroup$

result.time_taken is the execution time. There is also job.time_per_step() that gives you the timestamps of each step of the job's life cycle.

If you're looking to set some variable locally in your program, the best you can do is probably use job status. job.wait_for_final_state() supports a callback function that you can use to set the variable when status changes.

$\endgroup$
2
  • $\begingroup$ Do these functions provide any more information than is given in the run details on the IBMQ webpage? $\endgroup$ – thespaceman Dec 2 '20 at 22:28
  • $\begingroup$ If by more information you meant more fine grained break down of the process (e.g. each validation step), then no. $\endgroup$ – jyu00 Dec 3 '20 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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