(action_worker)
| 39 | |
| 40 | |
| 41 | def _setup_sigterm_handler(action_worker): |
| 42 | def sigterm_handler(signum=None, frame=None): |
| 43 | # This will cause SystemExit to be throw and allow for component cleanup. |
| 44 | action_worker.kill() |
| 45 | |
| 46 | # Register a SIGTERM signal handler which calls sys.exit which causes SystemExit to |
| 47 | # be thrown. We catch SystemExit and handle cleanup there. |
| 48 | signal.signal(signal.SIGTERM, sigterm_handler) |
| 49 | |
| 50 | |
| 51 | def _setup(): |