Skip to content
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

Add History stream #4554

Merged
merged 3 commits into from
Aug 25, 2020
Merged

Add History stream #4554

merged 3 commits into from
Aug 25, 2020

Conversation

jonmmease
Copy link
Collaborator

Overview

This PR adds a History stream type. History stream instances wrap another stream and collect a history of the values taken on by that stream. This list of states is as the values property

Motivation

A follow-on PR will refactor link_selections to be based on Derived (#4532) and History streams, making it possible for uncollate (See #4551) to extract the linked streams from result of link_selections.

But, this is a simple and generally useful stream type, so I wanted to split it out into its own PR.

Example Usage

Val = Stream.define("Val", v=0.0)
history = History(val)
prihnt(history.contents)
{"values": [{"v": 1.0}]}
# Perform a few updates on val stream
val.event(v=2.0)
val.event(v=3.0)
print(history.contents)
{"values": [{"v": 1.0}, {"v": 2.0}, {"v": 3.0}]}
history.clear_history()
print(history.contents)
{"values": []}

@jlstevens
Copy link
Contributor

Seems like an uncontroversial addition to me! Happy to merge when you think it is ready.

@jonmmease
Copy link
Collaborator Author

It's ready on my end. Thanks @jlstevens

@philippjfr philippjfr merged commit cf57b88 into master Aug 25, 2020
@philippjfr philippjfr deleted the history_stream branch April 25, 2022 14:39
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants