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

Session.from_id unexpectedly changes the backend #1959

Open
dcanuto opened this issue Oct 3, 2024 · 1 comment
Open

Session.from_id unexpectedly changes the backend #1959

dcanuto opened this issue Oct 3, 2024 · 1 comment
Labels
bug Something isn't working server action Need actions from the server side

Comments

@dcanuto
Copy link

dcanuto commented Oct 3, 2024

Describe the bug

The Session.from_id method is returning a Session instance whose backend method returns a backend name different from the session whose ID was passed into from_id.

Steps to reproduce

from qiskit_ibm_runtime import QiskitRuntimeService, Session

service = QiskitRuntimeService(
    token="your_token", instance="your_instance", channel="ibm_cloud"
)

first_backend_name = "ibm_brisbane"

first_session = Session(backend=service.backend(first_backend_name), max_time=8 * 60 * 60)

second_backend_name = "ibm_fez"

second_session = Session(backend=service.backend(second_backend_name), max_time=8 * 60 * 60)

second_session_copy = Session.from_id(second_session.session_id, service)

print(second_session.backend()) # gives me ibm_fez
print(second_session_copy.backend()) # gives me ibm_brisbane (i.e., the backend from first_session)
assert second_session.session_id == second_sesssion_copy.session_id # no error thrown

Expected behavior

The second_session and second_session_copy should both return "ibm_fez" from their backend method.

Suggested solutions

Not sure, but perhaps there is a bug in the session_details method of the QiskitRuntimeService._api_client attribute (used here in Session.from_id)?

Additional Information

  • qiskit-ibm-runtime version: 0.28.0
  • Python version: 3.10.9
  • Operating system: MacOS Sonoma 14.6.1
@dcanuto dcanuto added the bug Something isn't working label Oct 3, 2024
@kt474
Copy link
Member

kt474 commented Oct 8, 2024

@dcanuto Thanks for reporting this. Looks like the session details response from the API doesn't return a backend so the first backend from the list of available backends is returned instead.

{'id': '4733121c-118f-4947-af83-dcc9c81a46bf', 'backend_name': '', 
'interactive_ttl': 60, 
'max_ttl': 28800, 'active_ttl': 28800, 
'state': 'open', 'accepting_jobs': True, 'mode': 'dedicated'}

I follow up with the server side.

@kt474 kt474 added the server action Need actions from the server side label Oct 8, 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 server action Need actions from the server side
Projects
None yet
Development

No branches or pull requests

2 participants