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

check api compatibility when entering a client context #15252

Merged
merged 6 commits into from
Sep 6, 2024

Conversation

jakekaplan
Copy link
Contributor

@jakekaplan jakekaplan commented Sep 5, 2024

When entering a SyncClientContext or AsyncClientContext for the first time, check if the client and server are compatible.

This PR defines compatibility as both the client and server must be on the same major version. The goal of this pr is specifically to flag incompatibility between 2.x and 3.x clients and servers (in both directions). I'm very open to changing this in anyway that makes it more useful and future proof for the direction of the package.

Copy link

codspeed-hq bot commented Sep 5, 2024

CodSpeed Performance Report

Merging #15252 will not alter performance

Comparing check-server-api-version (d72c4fc) with main (2b994af)

Summary

✅ 3 untouched benchmarks

@@ -210,6 +210,7 @@ def __enter__(self):
self._context_stack += 1
if self._context_stack == 1:
self.client.__enter__()
self.client.api_compatible()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This and below seemed like the best place to put this so that it only called once

@jakekaplan jakekaplan marked this pull request as ready for review September 5, 2024 22:29
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

one request on method name change, otherwise this LGTM!

src/prefect/client/orchestration.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

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

lgtm!

@cicdw cicdw merged commit c9fb300 into main Sep 6, 2024
30 checks passed
@cicdw cicdw deleted the check-server-api-version branch September 6, 2024 01:46
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.

3 participants