Refactor streaming interfaces and protocols to support new features#641
Merged
Refactor streaming interfaces and protocols to support new features#641
Conversation
The StreamProducer can now work without a mapping of topics to Stores. When a Store is not assigned to a topic, the stream object is sent directly inside the event. Thus, there are now two new object events: NewObjectEvent for when the object is included directly, and NewObjectKeyEvent for when the object is located in a Store. The StreamProducer/StreamConsumer now support both types of Publisher/Subscriber pairs, event-based and message-based, depending on what granularity the shim implementation wants access to.
14189e6 to
8c25979
Compare
The _EventInfo became a little confusing with union types after adding the different kinds of new object events, so I removed that in the StreamConsumer. This did require moving some metadata from the EventBatch to the specific event types, but this probably makes more sense with some metadata only applying to certain types anyways.
8c25979 to
5d16f19
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.
Description
This is a refactor of the interfaces and protocols in
proxystore.streamto support these two high-level features:Storewhich is useful for small objects or shims that want to do their own data management.To achieve these goals, the following changes were made:
PublisherandSubscriberare now union types ofEventPublisher | MessagePublisherandEventSubscriber | MessageSubscriber, respectively.StreamProducerandStreamConsumerare compatible with both types of shim protocols.EventPublisher/EventSubscribersend/receiveEventBatchobjects directly so they can implement more granular control over transfer, serialization, etc. This will be useful for @ValHayot's mofka integration.MessagePublisher/MessageSubscriberare equivalent to the old protocols; they send/receive already serialized byte-string messages. These are easier to implement, and represent the exisitng shims provided inproxystore.stream.shims.NewObjectEventandNewObjectKeyEvent.NewObjectEventcontains the data and metadata directly in the event.NewObjectKeyEventcontains the metadata and the key corresponding to an object in aStore.StreamProducerwas configured to separate metadata and data using aStore. Topics with an associatedStorewill produceNewObjectKeyEventand topics without an associateStore(or defaultStore) will produceNewObjectEvent.The following breaking changes were made:
storesparameter ofStoreProduceris now keyword-only.Publisher/Subscribershims will need to update their method signatures (Publisher.send()is nowMessagePublisher.send_message()andMessageSubscribermust implementnext_message()).Note that the
proxystore.streammodule is marked as experimental so breaking changes in patch versions is acceptable.Fixes N/A
Type of Change
Testing
Expanded unit tests to cover new configurations.
Pull Request Checklist
Please confirm the PR meets the following requirements.
pre-commit(e.g., mypy, ruff, etc.).