Asynchronous check of `QPUExecuteResponse` status
Hello everyone!
This regards the latest pyquil v3 major update. Thanks for your amazing work on this new release.
Issue Description
Under pyQuil v2, it was possible to obtain the status of a submitted job using QAM.status, yielding one of "connected", "loaded", "running" or "done". In pyQuil v3, the QAM workflow was changed to using QAM.execute to get a handle, and QAM.get_result to get the result given a handle.
Is there a way to check the status of a handle, or a non-blocking alternative to get_result?
Proposed Solution
Add a status method to the QAM abstract base class:
@abstractmethod
def get_status(self, execute_response: T) -> str:
...
Implementing this for QVM would be trivial, as the computation is done synchronously anyways. For QPU, it seems RPCQ should support asynchronous calls. It might be enough to change the flag wait=True of GetBuffersRequest in QPU._get_buffers (in pyquil/api/_qpu.py line 201).
I am not familiar with what RPCQ returns with the wait=False flag, but if you think this would work I could give it a try.
I look forward to hearing from you.