-
Notifications
You must be signed in to change notification settings - Fork 165
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
Choose correct backend within a session #628
Conversation
Pull Request Test Coverage Report for Build 4246568333
💛 - Coveralls |
Test for this? It's not clear to me how this resolves the issue without a test. |
test/integration/test_session.py
Outdated
with Session(service=service, backend="statevector_simulator") as session: | ||
job = session.run(program_id="hello-world", options=options, inputs=inputs) | ||
self.assertEqual(backend, job.backend().name) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jyu00 my understanding is that in a scenario like this the backend passed in through options should be honored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, since the docstring says options
can be anything in RuntimeOptions
(which includes backend
). We should change that though since you can't have a session cross multiple backends.
qiskit_ibm_runtime/session.py
Outdated
if "backend" not in options: | ||
options["backend"] = self._backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you raise an exception if a session is already active, has a backend, and the backend passed in options
doesn't match.
qiskit_ibm_runtime/session.py
Outdated
3, | ||
) | ||
if ( | ||
self._session_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to compare session id here? If I do
session = Session(backend="foo")
session.run(options={"backend": "bar"})
^ this should fail because it's ambiguous which backend I really want.
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
Co-authored-by: Jessie Yu <jessieyu@us.ibm.com>
if self._backend and options["backend"] != self._backend: | ||
raise IBMInputValueError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no test coverage for this is there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added test case here #763
Summary
Details and comments
Fixes #627