Repository navigation
Conversation
…k/v4/p27-examples
…k/v4/p27-examples
…k/v4/p27-examples
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 one complete, runnable example for each section of the Brook streams API proposal, in
tests/contrib/streams/examples/.Each file has the definition, the Workflow, the Activities, the Worker setup and the client code, and a module docstring that names its proposal section.
README.mdmaps each section to its file. The Nexus examples are a later stage, so they have no file.ui_backend_reads.py:StreamClient.workflow_stream,subscribewith Topics andcreate_wait, andRecord,SupersededandClosedhandling.resume_from_offset.py: a Reader of aname=Stream that savesoffset + 1and resumes withfrom_offset.client_creates_stream.py:StreamClient.createwithid,retentionandauto_close, the Stream passed to a Workflow as data, and the creator's close.agent_publishes_turns.py:create_stream, awaitedpublish(*values),close_with_run, and an Activity input object that carries the Stream.activity_streams_tokens.py:ActivityStreamwith awaited publish andBufferedPublisher, and a sync Activity withSyncActivityStream.turn_scoped_stream.py: one Stream per turn withname=andasync with, and an index Stream passed through continue-as-new.worker_setup.py:RedisStreamPluginon the client,name=anddefault=,MemoryStreamPluginfor tests, andcreate_stream_nowaitandpublish_nowaitin@workflow.init.Why?
Moe asked for full examples that match the proposal. Running them in CI keeps them from going stale.
How did you test it?
test_examples.pyruns each example end to end on the memory Store and on a scratchredis-server, against the stock dev server.pytest tests/contrib/streamsandpoe lintpass.