-
Notifications
You must be signed in to change notification settings - Fork 178
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
perf(robot-server): Discriminate command unions #14286
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## edge #14286 +/- ##
==========================================
+ Coverage 67.96% 68.08% +0.12%
==========================================
Files 2467 2509 +42
Lines 70000 71445 +1445
Branches 8868 9063 +195
==========================================
+ Hits 47573 48645 +1072
- Misses 20356 20689 +333
- Partials 2071 2111 +40
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Maybe this will fix CI?
Are the changes made to the command schema compatible with the |
Yep, changes to |
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.
Looks great, glad we could finally get to this with the Python updates
Closes RSS-128. * Update command unions. * Update stateless command unions. * Work around Pydantic bug. * Fix names and docstrings for union workarounds. * Update tests. * Update command schema.
Overview
Now that we have Pydantic 1.9, we can close RSS-128. This dramatically improves error reporting when you misspell something in a Protocol Engine command, and it also improves performance anywhere we're parsing Protocol Engine commands.
Test Plan
For "this doesn't break anything," I'm mostly leaning on integration tests.
typing.Annotated
usage hasn't broken anything across Python versions.For improved error reporting:
POST /runs/commands
POST /maintenance_runs/commands
POST /commands
For improved performance:
POST /runs
with a JSON protocol. Seems ~20-30% better.tests/integration/http_api/persistence/test_compatibility.py
goes from ~23s to ~16s.Changelog
commandType
field. See the Pydantic documentation: https://docs.pydantic.dev/1.10/usage/types/#discriminated-unions-aka-tagged-unionspydantic.Generic
model. To work around this, I unfortunately had to make some non-generic duplicates of ourRequestModel
, which is unfortunate.Review requests
pydantic.Generic
thing?Risk assessment
Low—if this broke anything, I think integration tests would cover it, unless there's weirdness across Python versions.