unable to shut down green thread pool executor from within a periodics on_failure callback
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
futurist |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I'm trying to terminate a service[1] upon a periodics unrecoverable error through the on_failure callback. However, I'm unable to shut_down() the green thread pool executor:
(venv) jahoda:
DEBUG:Periodics Test Service:starting service
INFO:Periodics Test Service:Service running... Press CTRL+C to terminate.
DEBUG:futurist.
DEBUG:Periodics Test Service:Cleaning up
DEBUG:futurist.
DEBUG:Periodics Test Service:Cleaning up
WARNING:Periodics Test Service:Bad luck!
ERROR:Periodics Test Service:Callable <function clean_up at 0x10ec2e488> periodic, 10) encountered exc (<class 'RuntimeError'>, RuntimeError(
DEBUG:Periodics Test Service:stopping service
DEBUG:Periodics Test Service:stopping worker
DEBUG:Periodics Test Service:shutting down executor
ERROR:futurist.
DEBUG:futurist.
+------
| Name | Runs | Failures | Successes | Stop Requested | Average elapsed | Average elapsed waiting |
+------
| __main__.clean_up | 2 | 1 | 1 | False | 0.0002s | 0.0005s |
+------
DEBUG:Periodics Test Service:stopping service
INFO:Periodics Test Service:Service sys.exit() time
(venv) jahoda:
Esp. see the error log:
ERROR:futurist.
I'm no longer seeing this error when testing the example:
$ ./test.py periodics: Stopped running 1 callbacks: ------- ------+ ------+ ------- ---+--- ------- -+----- ------- ----+-- ------- ------- -+----- ------- ------- ------+ ------- ------+ ------+ ------- ---+--- ------- -+----- ------- ----+-- ------- ------- -+----- ------- ------- ------+ ------- ------+ ------+ ------- ---+--- ------- -+----- ------- ----+-- ------- ------- -+----- ------- ------- ------+
DEBUG:Periodics Test Service:starting service
INFO:Periodics Test Service:Service running... Press CTRL+C to terminate.
^CDEBUG:Periodics Test Service:stopping service
DEBUG:Periodics Test Service:stopping worker
DEBUG:Periodics Test Service:shutting down executor
DEBUG:futurist.
+------
| Name | Runs | Failures | Successes | Stop Requested | Average elapsed | Average elapsed waiting |
+------
| __main__.clean_up | 0 | 0 | 0 | False | . | . |
+------
INFO:Periodics Test Service:Service sys.exit() time
I'm taking that to mean this is fixed. If you find otherwise feel free to reopen it though.