get_sequencer_state() takes timeout in minutes, and there is a flaw in it's implementation.
Description
There are two problems with the get_sequencer_state()
method in qblox_instruments.native.generic_func.py
:
- It takes timeout in integer minutes. This forces the
wait_done(timeout_sec)
method in quantify to force a minimum timeout of 1 minute unnecessarily. - The method assumes that actually getting the sequencer state does not take any time. This leads to much longer wait times than 1 minute for a timeout.
What is the current behavior?
If a long experiment is set up in quantify (say 1 hour) by mistake, and then the user waits for the experiment to finish using wait_done(timeout_sec = 10)
, there is an error only after over 3 minutes that the sequencer did not stop in 1 minute.
What is the expected behavior?
There should be an error thrown after 10 seconds.
Possible fixes
- Without breaking any code, we can change the timeout argument in the
get_sequencer_state
method to accept a float. This allows a setting of a shorter timeout. - The code can be changed to calculate elapsed time using the
time.time()
.
Steps to reproduce
- Start an experiment in quantify using the qblox backend that is long.
- Try waiting until it is done with a short timeout.
sched = Schedule("Basic sequencing", repetitions=2**31) # The schedule will be played repeatedly 2^31 times
pi_pulse = sched.add(X(qubit=transmon.name))
sched.add_resource(ClockResource(name="q0.01", freq=5e9))
compiler = SerialCompiler(name="compiler")
compiled_sched = compiler.compile(
schedule=sched, config=quantum_device.generate_compilation_config()
)
instrument_coordinator.prepare(compiled_sched)
instrument_coordinator.start()
instrument_coordinator.wait_done(timeout_sec=10) # This will take more than 3 minutes to throw an error.
Relevant logs, screenshots and/or outputs
Related Git repositories
https://gitlab.com/quantify-os/quantify-scheduler