Repository navigation
[gremlin-python] [1/4] Add async HTTP streaming transport, AsyncResultSet, and GraphBinaryV4 stream reader - #3725
Open
masterhugo wants to merge 1 commit into
Open
masterhugo wants to merge 1 commit into
masterhugo wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3725 +/- ##
============================================
+ Coverage 76.35% 77.54% +1.18%
============================================
Files 1012 32 -980
Lines 60341 7805 -52536
Branches 7075 0 -7075
============================================
- Hits 46076 6052 -40024
+ Misses 11548 1425 -10123
+ Partials 2717 328 -2389 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
masterhugo
force-pushed
the
feature/tp4-async-pr1-transport
branch
from
October 20, 2026 00:36
60886f4 to
a3381f0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary (Part 1 of 4: Native
asyncioforgremlin-python4.0)This is PR 1 of 4 introducing native
asynciosupport togremlin-pythonfor TinkerPop 4.0 over HTTP streaming, withoutnest_asyncio, backgroundThreadPoolExecutorpools, or per-connection private event loops (asyncio.new_event_loop()).Why native
asynciowithoutnest_asyncio?Currently,
AiohttpHTTPTransportcreates a private event loop per connection and drivesaiohttpsynchronously viarun_until_complete(). When called from inside an already-running event loop (FastAPI/uvloop, Jupyter notebooks, async AWS Lambda handlers), it fails withRuntimeError: Cannot run the event loop while another loop is running, andnest_asynciocannot patch Cython-based loops likeuvloop.What is included in PR 1 (Foundation layer)
gremlin_python/driver/aiohttp/async_transport.py:AsyncBufferedStream: sliding-windowbytearraybuffer overaiohttp.ClientResponse.contentwithcheckpoint(),restore(),compact(),fill_more(), andread_exactly(). Translatesaiohttp.ServerTimeoutErrorintoReadTimeoutError.AsyncAiohttpHTTPTransport: nativeaiohttp.ClientSessiontransport bound directly toasyncio.get_running_loop().gremlin_python/driver/async_resultset.py:AsyncResultSet: single-item streaming result set supportingawait rs.one()(returning_EXHAUSTEDon stream end soNoneresult items are preserved),await rs.all(), andasync for item in rs, usingasyncio.wait(..., return_when=FIRST_COMPLETED)instead of polling loops.gremlin_python/driver/serializer.py:GraphBinarySerializersV4.deserialize_async_response_stream(stream)to incrementally decode GraphBinary v4 (0x84) objects and end-of-stream trailers across arbitrary HTTP chunk boundaries.tests/unit/driver/test_async_http_streaming.py:AsyncResultSet,AsyncBufferedStream,deserialize_async_response_stream(including 2-byte chunk fragmentation across object/trailer boundaries), andAsyncAiohttpHTTPTransport.Roadmap of the 4-PR Series
AsyncBufferedStream,AsyncAiohttpHTTPTransport,AsyncResultSet,deserialize_async_response_streamAsyncConnection&AsyncClient(asyncio.Queueconnection pool)AsyncDriverRemoteConnection&AsyncGraphTraversal(async_traversal())AsyncTransaction(g.tx(),execute_in_tx), integration tests, examples, and documentation