-
Notifications
You must be signed in to change notification settings - Fork 3
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
interoperability with asyncio (part 3): refactor with aiohttp #176
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
achille-roussel
added
enhancement
New feature or request
breaking change
Breaking change that will be disruptive to programs that depended on them
labels
Jun 12, 2024
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
achille-roussel
force-pushed
the
aiohttp-2
branch
from
June 14, 2024 23:41
f54119c
to
b4e2db4
Compare
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
…hon 3.8 Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
…s are skipped on 3.8/3.9 Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
support both asyncio and blocking modes with different abstractions
chriso
approved these changes
Jun 19, 2024
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.
Nice work 👏🏻
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking change
Breaking change that will be disruptive to programs that depended on them
enhancement
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #175, this PR refactors the dispatch-py internals to use asyncio across the board, and only convert between blocking and async modes at interface boundaries.
Overall, this PR does not modify the public API much, but mostly enables to key changes:
(these were previously discussed in part 2)
Waiting on dispatched function results
I have added a temporary
disaptch.sdk.v1.DispatchService/Wait
endpoint -- which is very much experimental at this point and only used in tests -- to allow retrieving the result of dispatched function calls. Along with this change, the SDK is now detecting whether a dispatch function is called (and awaited) from an external client or within the a dispatch execution context. When the former is true, the/Wait
endpoint is used to wait for the result of the function call.I want to emphasize that it's still very much experimental, I want to make sure the model works well end-to-end before committing to an API in https://github.com/dispatchrun/dispatch-proto.
Testing dispatch functions
This PR does not yet deliver on this front, but it makes great progress by adding a generic
dispatch.test.TestCase
test suite that is used to exercise testing of all integrations with FastAPI, Flask, aiohttp, http.server, etc...One blocker to finishing this work is the inability to pickle cell objects, which are implicitly generated by Python when local variables are referenced from multiple scopes, and happens in constructs like the following:
(
echo
exists in the local scopes oftest_call_nested_function_with_result
andecho2
)These blockers prevent finishing the rewrite of tests in
test_fastapi.py::TestCoroutine
intodispatch.test.TestCase
, which also prevents removing thegrpcio
andhttpx
dependencies, and deleting all the gRPC codegen.