2
$\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 Answer 1

2
$\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$ Dec 2, 2020 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, 2020 at 14:33

Your Answer

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

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