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

make re-usable TypeAdapter instances for client schemas #16089

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

zzstoatzz
Copy link
Collaborator

@zzstoatzz zzstoatzz commented Nov 22, 2024

moves creation of type adapters out of client method impls

related to #15047

uses defer_build as pointed out by adam below

Copy link

codspeed-hq bot commented Nov 22, 2024

CodSpeed Performance Report

Merging #16089 will not alter performance

Comparing make-less-adapters (b442d2d) with main (b1c44cf)

Summary

✅ 3 untouched benchmarks

@zzstoatzz
Copy link
Collaborator Author

zzstoatzz commented Nov 22, 2024

Merging #16089 will degrade performances by 11.69%

this does makes sense, since we're making all of the adapters at import time, but I think this is worth it

@zzstoatzz zzstoatzz requested a review from aaazzam November 22, 2024 19:57
@zzstoatzz zzstoatzz marked this pull request as ready for review November 22, 2024 19:57
@zzstoatzz zzstoatzz changed the title stop remaking core schemas make re-usable TypeAdapter instances for client schemas Nov 22, 2024
@zzstoatzz zzstoatzz marked this pull request as draft November 22, 2024 19:58
@aaazzam
Copy link
Collaborator

aaazzam commented Nov 24, 2024

@zzstoatzz zzstoatzz self-assigned this Nov 25, 2024
@zzstoatzz zzstoatzz force-pushed the make-less-adapters branch 2 times, most recently from 7654e26 to c2420ee Compare December 9, 2024 17:22
@zzstoatzz zzstoatzz added the development Tech debt, refactors, CI, tests, and other related work. label Dec 9, 2024
@zzstoatzz zzstoatzz marked this pull request as ready for review December 9, 2024 17:36
@zzstoatzz zzstoatzz added the performance Related to an optimization or performance improvement label Dec 12, 2024
@zzstoatzz zzstoatzz force-pushed the make-less-adapters branch 2 times, most recently from 3e06bdb to db7bfe8 Compare December 13, 2024 07:04
Comment on lines +178 to +181
BaseResult.model_rebuild()
ResultRecordMetadata.model_rebuild()

State.model_rebuild()
Copy link
Member

Choose a reason for hiding this comment

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

We do this in prefect.main too. Do we need to rebuild again here? Or is there a way that we could conditionally rebuild?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if I don't then I get errors like this

FAILED tests/client/test_prefect_client.py::test_set_then_read_flow_run_state - pydantic.errors.PydanticUndefinedAnnotation: name 'State' is not defined

though I agree it seems like it shouldn't be needed 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ill make a discussion to investigate this

@zzstoatzz zzstoatzz merged commit 49a6101 into main Dec 13, 2024
37 checks passed
@zzstoatzz zzstoatzz deleted the make-less-adapters branch December 13, 2024 21:49
zzstoatzz added a commit that referenced this pull request Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Tech debt, refactors, CI, tests, and other related work. performance Related to an optimization or performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants