-
Notifications
You must be signed in to change notification settings - Fork 12
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
subt.main: add TimeoutMonitor #373
base: master
Are you sure you want to change the base?
Conversation
subt/main.py
Outdated
pass | ||
|
||
|
||
class TimeoutMonitor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would vote for separate file (main.py
is too big already) ... and maybe it is generic enough that we want it in osgar.lib
? Or monitors??
subt/main.py
Outdated
|
||
def __exit__(self, exc_type, exc_val, exc_tb): | ||
self.robot.unregister(self.handle) | ||
if exc_val is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would check that the type matches to TimeoutEx
ec3f108
to
9385c25
Compare
My plan with this PR is to add usage of the TimeoutMonitor. I'd like to test it in Virtual world, but for that I need to do some fixes first. So I would mark this "on hold" until then. |
9385c25
to
476bbc6
Compare
I see that we already had monitors implemented! I also see implementation of your comment where you catch exceptions in the exit |
Well... yet, but you didn't want to merge it until it is used as well. I didn't get to use it since I was hunting the bigger problems in virtual. So it is waiting here until I get to it again. |
I needed monitors for external "locomotive" project, where I use osgar pypi installation - maybe it would be nice if this would be directly part of osgar and not SubT? Also Moon needed monitors ...maybe part of larger refactoring, including |
Implement part of #369 by providing
TimeoutMonitor
class. Example usage is intest_subt.py
. Having this context manager allows adding timeout to any function that periodicaly callsupdate()
inside.