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

fix: do not allow to pass A&B custom options to backend.run() #56

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

gschurck
Copy link
Contributor

@gschurck gschurck commented Nov 7, 2024

The Alice & Bob custom options of Processors like average_nb_photons are not allowed for backend.run() with local provider because they will be ignored. They should be passed to get_backend() instead.

@gschurck gschurck changed the title fix: do not allow to pass average_nb_photons option to backend.run() fix: do not allow to pass average_nb_photons option to backend.run() Nov 7, 2024
@gschurck gschurck force-pushed the fix/run-nbar-override branch 3 times, most recently from b8cec9c to 21df443 Compare November 7, 2024 15:13
@gschurck gschurck self-assigned this Nov 7, 2024
@gschurck gschurck force-pushed the fix/run-nbar-override branch 4 times, most recently from 739db20 to 6c2b1b4 Compare November 7, 2024 15:54
@gschurck gschurck force-pushed the fix/run-nbar-override branch 2 times, most recently from 6837aba to d4f5d87 Compare November 20, 2024 13:47
@gschurck gschurck changed the title fix: do not allow to pass average_nb_photons option to backend.run() fix: do not allow to pass A&B custom options to backend.run() Nov 20, 2024
The Alice & Bob custom options of Processors like average_nb_photons are
not allowed for backend.run() with local provider because they will be
ignored. They should be passed to get_backend() instead.
@gschurck gschurck force-pushed the fix/run-nbar-override branch from d4f5d87 to e20cbac Compare November 20, 2024 13:51
@gschurck gschurck requested review from sbrieuc and alxthm November 20, 2024 14:04
Copy link
Collaborator

@alxthm alxthm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! it would be nice if qiskit itself raised an error when specifying unsupported options to the execution backend .run method, but I don't see a way to do it (with the AerSimulator for instance)

This seems like an easy and simple safeguard to catch at least some mistakes

@gschurck
Copy link
Contributor Author

gschurck commented Nov 21, 2024

Yes, it's the simpler workaround I think. I chose to get the parameters dynamically from the processor function, so we don't have to maintain a string list of the parameters that could become out of sync. I didn't know if it was better to do it in __init__() or in run(), but at least here it runs this code only when needed.

@gschurck gschurck merged commit b2e9368 into main Nov 21, 2024
16 checks passed
@gschurck gschurck deleted the fix/run-nbar-override branch November 21, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants