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

Feature/time sequencer python #156

Open
wants to merge 5 commits into
base: rolling
Choose a base branch
from

Conversation

justagist
Copy link

Add simplified python implementation for TimeSequencer filter.

@justagist justagist requested a review from gbiggs as a code owner November 21, 2024 12:51
Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Thanks for the contribution!

I have left some feedback to consider here.

Comment on lines +407 to +408
if self.queue_size != 0 and len(self.messages) > self.queue_size:
del self.messages[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this correctly, I think that it should be documented that a queue_size == 0 means that there is effectively an unlimited queue.

Comment on lines 377 to 379
self.update_timer = self.node.create_timer(
self.update_rate.nanoseconds / 1e9, self.dispatch
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this spins a timer up, I think it would make sense to also have a corresponding shutdown function to clean up resources:

def shutdown(self):
        self.update_timer.cancel()
        self.node.destroy_timer(self.update_timer)

delay = Duration(seconds=delay)
if not isinstance(update_rate, Duration):
update_rate = Duration(seconds=update_rate)
self.delay = delay
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add types to member variables

)
return None

def dispatch(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider prefixing this with a single _ to mark that it's for internal use only.

raise RuntimeError("Already connected to an input filter.")
self.incoming_connection = input_filter.registerCallback(self.add)

def add(self, msg):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also underscore here for internal function

@sloretz sloretz assigned mjcarroll and unassigned mjcarroll Dec 13, 2024
@sloretz sloretz added the more-information-needed Further information is required label Dec 13, 2024
@justagist justagist requested a review from mjcarroll December 16, 2024 19:24
@justagist
Copy link
Author

Thanks @mjcarroll for reviewing, and apologies for the late response. I've made the changes as you suggested. Let me know if you would like me to address anything further.

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justagist justagist requested a review from ahcorde December 24, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more-information-needed Further information is required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants