Repository navigation
Conversation
…3-stream-client # Conflicts: # tests/contrib/streams/test_redis.py
…3-stream-client # Conflicts: # temporalio/contrib/streams/_buffered.py # tests/contrib/streams/test_activity_handles.py
Owner
Author
|
Closing as stale. This layer is folded into the v5 tip, #365, and the upstream review uses a fresh series instead. Plan: https://www.notion.so/4048fc567738814990b7c796ac28fe3f |
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.
What changed?
This PR adds
StreamClient,ClientStreamandClientTopic.StreamClient(client)is an object over the Temporal client.await create(Events, *, id, retention=None, auto_close=None, backend=None)creates a Stream that the client owns.get_handle(Events, *, id)andworkflow_stream(handle, Events, *, name=None)make no call. A Workflow handle with no first run id makes one Describe call on the Stream's first use, which calls that start together share. With nobackend=, a create uses the plugin markeddefault=True, or else the first one. A backend name that no client plugin has raisesStreamUnsupportedErrorbefore any call.get_handleandworkflow_streamalso takebackend=, so a client reaches a Stream of its second backend.subscribe(*topics, from_offset=None, wait_new_records=True, prefixes=())yieldsRecord,SupersededandClosed, and each Record decodes with its Topic's type from the definition. It has no idle end.create_wait=waits for a Stream that nobody created yet, such as the Stream of a Workflow that just started. EachClientStreamwrites as its own Producer. AClientStreamdecoded from a payload has no client, and its calls ask forStreamClient.get_handle.Why?
S64 and S75: the client calls are methods on an object over the client, not free functions or methods of the core client.
How did you test it?
tests/contrib/streams/test_stream_client.py: unit tests on a fake extension for the backend check, a decoded handle and the one Describe call, and live tests on the memory Store and on a scratchredis-serverfor a client Stream that a Workflow writes to, reads from an offset, by Topic and by prefix, a Workflow's Stream read withcreate_wait,auto_close, an unresolved handle in comparisons and hashes, and the default backend.pyright,mypy,basedpyright,pydocstyle,ruff.