-
Notifications
You must be signed in to change notification settings - Fork 185
Description
Describe the bug
Using the ibm_cloud channel, I create a Session without a backend specified to let the server pick the backend.
I run a Sampler job using:
service = QiskitRuntimeService(
channel="ibm_cloud",
token=os.getenv('IBM_CLOUD_API_KEY'),
instance=os.getenv('IBM_CLOUD_CRN'),
url=os.getenv('IBM_CLOUD_URL', "https://test.cloud.ibm.com"))
session = Session(service=service)
options = Options(
resilience_level=0,
execution=dict(shots=1)
)
sampler = Sampler(options=options, session=session)
job = sampler.run(ReferenceCircuits.bell())
The run()
call blocks until the job is complete. This blocks me from being able to submit more jobs in the same session in batch mode.
Steps to reproduce
See above.
Expected behavior
Sampler.run()
should return once I've submitted the job and not block waiting for the backend to be determined once the first job in the session is complete.
Suggested solutions
I believe the relevant code is here:
https://github.com/Qiskit/qiskit-ibm-runtime/blob/0.12.2/qiskit_ibm_runtime/session.py#L178
That job.backend()
call is blocking when no backend is specified when creating the session:
https://github.com/Qiskit/qiskit-ibm-runtime/blob/0.12.2/qiskit_ibm_runtime/runtime_job.py#L258-L259
Maybe pass a timeout
value of 0 and handle RuntimeJobTimeoutError
and just leave backend unset in the Session instance?
Additional Information
- qiskit-ibm-runtime version: 0.12.2
- Python version: 3.8
- Operating system: Ubuntu Focal