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

Better handle KeyboardInterrupts in optional service greenlets #80

Closed
MJJoyce opened this issue Jul 12, 2018 · 0 comments
Closed

Better handle KeyboardInterrupts in optional service greenlets #80

MJJoyce opened this issue Jul 12, 2018 · 0 comments
Assignees

Comments

@MJJoyce
Copy link
Member

MJJoyce commented Jul 12, 2018

Our current implementation for the telemetry monitoring and data archiving (being developed in #79) services doesn't handle KeyboardInterrupt exceptions with the most grace. If one of the services is active when the interrupt is received a stack trace is dumped by the greenlet before the services shutdown. As such, the logs are full of stack traces / errors even when the GUI is shut down nominally and this isn't particularly user friendly.

It would be great if we could handle this in a cleaner way.

@MJJoyce MJJoyce self-assigned this Jul 12, 2018
MJJoyce added a commit that referenced this issue Jul 12, 2018
Add optional data archiving support. Users can enable data archiving via
ait.gui.enable_data_archiving() prior to calling ait.gui.wait(). By
default InfluxDB will be used but an optional argument can be set when
calling enable_data_archiving() to choose a different class.

Update greenlet handling for monitoring and data archive tasks so that
exits via Ctrl-C are cleaner. Greenlet functions are now wrapped in
gevent.util.wrap_errors so that KeyboardInterrupt exceptions are
returned instead of raised. This allows us to avoid stack traces being
printed when killing the GUI.

Greenlet tracking has been changed from individual global variables to a
list of greenlet instances. Clean up code has been updated with this
change as well.

The ait.gui.wait function has been updated to use gevent.joinall if one
or more of the optional services (data archiving or telemetry monitoring
at the moment) are in use. This gives us a bit more control over how we
handle greenlets that have returned and how exceptions are raised. If
the optional services aren't being used we default to gevent.wait
instead.
lorsposto pushed a commit that referenced this issue Jul 16, 2018
* Issue #79 and #80 - Data archiving and better interrupt handling

Add optional data archiving support. Users can enable data archiving via
ait.gui.enable_data_archiving() prior to calling ait.gui.wait(). By
default InfluxDB will be used but an optional argument can be set when
calling enable_data_archiving() to choose a different class.

Update greenlet handling for monitoring and data archive tasks so that
exits via Ctrl-C are cleaner. Greenlet functions are now wrapped in
gevent.util.wrap_errors so that KeyboardInterrupt exceptions are
returned instead of raised. This allows us to avoid stack traces being
printed when killing the GUI.

Greenlet tracking has been changed from individual global variables to a
list of greenlet instances. Clean up code has been updated with this
change as well.

The ait.gui.wait function has been updated to use gevent.joinall if one
or more of the optional services (data archiving or telemetry monitoring
at the moment) are in use. This gives us a bit more control over how we
handle greenlets that have returned and how exceptions are raised. If
the optional services aren't being used we default to gevent.wait
instead.

* - Fix except block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant