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

[MovingWindow] Add a trigger that fires after having received a fixed number of samples #967

Open
matthias-wende-frequenz opened this issue Jun 10, 2024 · 7 comments · May be fixed by #1159
Assignees
Labels
part:data-pipeline Affects the data pipeline type:enhancement New feature or enhancement visitble to users
Milestone

Comments

@matthias-wende-frequenz
Copy link
Contributor

What's needed?

Currently there is no clean way to wait until the MovingWindow got updated with a certain number of samples.
This feature has been requested in the past and there has been an initial implemented attempt #387.

This feature has been requested again now by @cwasicki.

Proposed solution

Introduce an asynchronous wait_for_samples method that returns once the requested number of new samples has been stored in the MovingWindow.

Use cases

Alternatives and workarounds

No response

Additional context

No response

@cwasicki
Copy link
Collaborator

It would be great if this could be part of v1.0 since we are still working around this with sleep calls. What was the issue with the implementation in the PR that was mentioned above?

FYI @phillip-wenig-frequenz

@llucax
Copy link
Contributor

llucax commented Jan 28, 2025

It think it should not be hard to implement using a condition. Just add a wait method that calls cond.wait() and then each time a sample is received increment an internal counter and call cond.notify_all() once the desired number was reached. Probably even an event could be enough.

There was an attempt using a channel to communicate when the samples were received, but I'm not sure that complexity is needed, if we need a receiver, we can use (an expose) an Event receiver instead.

@matthias-wende-frequenz
Copy link
Contributor Author

Actually Channels could be seen as a convenience wrapper on top of condition objects.

@matthias-wende-frequenz
Copy link
Contributor Author

It would be great if this could be part of v1.0 since we are still working around this with sleep calls. What was the issue with the implementation in the PR that was mentioned above?

AFAIR there is no issue. Someone has to pick it up.

@shsms shsms modified the milestones: post-v1.0, v1.0.0-rc1600 Jan 30, 2025
@shsms
Copy link
Contributor

shsms commented Jan 30, 2025

I can pick this up next week if no one is already looking into this.

@cwasicki
Copy link
Collaborator

That would be great, I am pretty sure that no one is on it yet.

@shsms shsms linked a pull request Feb 4, 2025 that will close this issue
@shsms
Copy link
Contributor

shsms commented Feb 4, 2025

#1159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part:data-pipeline Affects the data pipeline type:enhancement New feature or enhancement visitble to users
Projects
Status: To do
4 participants