Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sampler.run blocks for first job in session to complete if no backend was specified #1165

Closed
mriedem opened this issue Oct 20, 2023 · 1 comment · Fixed by #1170
Closed
Assignees
Labels
bug Something isn't working

Comments

@mriedem
Copy link
Contributor

mriedem commented Oct 20, 2023

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
@mriedem mriedem added the bug Something isn't working label Oct 20, 2023
@kt474 kt474 self-assigned this Oct 24, 2023
@kt474 kt474 reopened this Dec 7, 2023
@kt474
Copy link
Member

kt474 commented Mar 1, 2024

Closing this, backend will be required on the cloud channel in a future release

@kt474 kt474 closed this as completed Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants