Closed marcorossi5 closed 2 months ago
For this point, I would like to suggest defining a syntax similar to https://docs.quantum.ibm.com/api/qiskit/0.19/qiskit.providers.ibmq.job.IBMQJob.
Just blocking within the library is never a great option, but sometimes you might want to return a handle that will execute in the same script, whenever it's ready, without blocking other possible actions.
The way to do this is to use an async
primitive:
https://docs.python.org/3/library/asyncio.html
Then, identifying jobs with a token, and being able to fetch results even in a separate script is a good idea as well (because the client might crash for whatever reason, but if you dispatched an expensive calculation you might still want to be able to retrieve the result).
For this point, I would like to suggest defining a syntax similar to https://docs.quantum.ibm.com/api/qiskit/0.19/qiskit.providers.ibmq.job.IBMQJob.
If we want to mimic the Qiskit interface, the run_circuit
function shouldn't return the result:
Indeed, it should return a job object. Could you please elaborate on a proposal about this?
I'm implementing something like the following
client: QiboClient = Client(token, url="http://localhost:8011/")
job: QiboJob= client.run_circuit(circuit, nshots=100, device="sim")
result: QiboJobResult = job.result()
print(result)
The job object is similar to this: https://docs.quantum.ibm.com/api/qiskit/0.19/qiskit.providers.ibmq.job.IBMQJob
At the moment I've thought about the following methods for the QiboJob class:
It will be available in a commit of the PR soon
The current
run_circuit
behavior is to wait online for the results.An alternative behavior is the client sends the request, the server answer success and the client immediately exits.
The user can see when the results are ready on the webapp user page. He can also download the files from browser by clicking a button there.