-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Regenerate QuantumEngineService gRPC client libraries with GAPIC #7500
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
Conversation
4b927e3 to
f810bb0
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7500 +/- ##
==========================================
- Coverage 98.68% 97.53% -1.15%
==========================================
Files 1093 1095 +2
Lines 97112 98934 +1822
==========================================
+ Hits 95837 96498 +661
- Misses 1275 2436 +1161 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ce89603 to
02a62fb
Compare
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
8043d44 to
7fa76b0
Compare
|
The regenerated RPC clients were additionally tested locally with a colab which successfully sent jobs to the production QuantumEngineService and retrieved results. |
9c36fd9 to
2470042
Compare
|
@hoisinberg Thank you for this work. Some best-practices related requests:
Sorry for the hassle! |
Is this a comment about what the PR does, or an instruction to maintainers, or something else? |
2470042 to
a7028de
Compare
| from cirq_google.cloud.quantum import gapic_version as package_version | ||
|
|
||
| __version__ = package_version.__version__ | ||
|
|
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.
Is this generated or written? If written consider taking it out. The gapic_version.__version__ is currently a placeholder at 0.0.0 so there is no information.
Also this module is a part of the cirq-google package which has its own version at cirq_google.__version__. I don't see a reason to define and maintain a separate version value here.
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.
It is generated, though I can update that version number if you like. Perhaps to have it reference cirq_google.__version__?
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.
Please delete it. It is not there in the main so there is no way any code needs it.
| # temporary: allow name changes of keyword arguments in quantum engine interfaces to stabilize | ||
| 'docs/simulate/virtual_engine_interface.ipynb', |
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.
Make sure to do a follow-up PR where this is moved to the NOTEBOOKS_DEPENDING_ON_UNRELEASED_FEATURES list above. Also, it would be better to leave the updates of concepts.ipynb and virtual_engine_interface.ipynb for that PR, so they would not be mixed up with generated code.
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.
Unfortunately these notebook tests would fail without the updates I added. I've assigned myself this issue for the follow-up PR.
| start_time: datetime.datetime, | ||
| end_time: datetime.datetime, | ||
| whitelisted_users: list[str] | None = None, | ||
| allowlisted_users: list[str] | None = None, |
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 we deprecate the old argument name instead?
If this is a generated code or if you are sure this is basically unused, it is OK to keep it as is. In general the preferred way of changing argument name is to support the old argument with a DeprecationWarning and delete it in a second-next release.
PS: Please see the deprecated_parameter decorator to help with that.
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.
This argument here is not auto-generated, however later in this function (line 262) it is copied into the allowlisted_users field of a QuantumReservation proto. That field was renamed from whitelisted_users in 2023 and it looks like this is the first time anyone has attempted to publish that change to cirq-google. Since QuantumReservation.whitelisted_users has already been gone for so long and users have not encountered issues, I believe this change should be safe.
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.
If feasible, please deprecate instead of remove the whitelisted_users argument. Also please see inline suggestions.
It is nearly all auto-generated. The only manual changes I added were to address CI breakages:
|
Add deprecation warning to `create_reservation` and `update_reservation`.
Add deprecation warning to `create_reservation_async` and `update_reservation_async`.
Add deprecation warning to `create_reservation` and `update_reservation`.
* Deprecate whitelisted_users in the AbstractLocalProcessor class * Deprecate whitelisted_users in the EngineClient class * Deprecate whitelisted_users in the EngineProcessor class * Address mypy warning on untyped functions
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 have added deprecation support for the old whitelisted_users arguments in the manually written classes, which should be less disruptive for possible users (09ff1d5).
LGTM on my part. I am holding on with merge in case you have some comments or suggestions.
…7527) #7500 modified the `quantum_run_stream` method definition by changing the `timeout` argument from `timeout: float | None = None` to `timeout: float | object = gapic_v1.method.DEFAULT`. Setting `timeout=None` is interpreted as having no timeout at all, whereas `timeout=gapic_v1.method.DEFAULT` uses the framework-supplied default value of 60s. For bidirectional streams, the `timeout` is used to set the lifetime of the entire stream, causing batches of jobs which cumulatively take more than 60s to fail with `DEADLINE_EXCEEDED` errors. This change sets `timout=None` explicitly, restoring the behavior previously obtained via the default argument.
This PR contains changes made by re-running the GAPIC code generators for the QuantumEngineService, using the Google-internal proto definitions as input. Generated changes include:
QuantumEngineService.GetQuantumProcessorConfig, along with the associated request and response objectswhitelisted_users->allowlisted_usersIn addition to the automated tests, I also verified that the updated RPC clients work by creating a colab which used the updated
cirq_googlelibrary to send jobs to the production QuantumEngineService.