()
| 62 | |
| 63 | |
| 64 | def _run_worker(): |
| 65 | LOG.info("(PID=%s) Worker started.", os.getpid()) |
| 66 | |
| 67 | action_worker = worker.get_worker() |
| 68 | _setup_sigterm_handler(action_worker) |
| 69 | try: |
| 70 | action_worker.start() |
| 71 | action_worker.wait() |
| 72 | except (KeyboardInterrupt, SystemExit): |
| 73 | LOG.info("(PID=%s) Worker stopped.", os.getpid()) |
| 74 | |
| 75 | errors = False |
| 76 | |
| 77 | try: |
| 78 | deregister_service(service=ACTIONRUNNER) |
| 79 | action_worker.shutdown() |
| 80 | except: |
| 81 | LOG.exception("Unable to shutdown worker.") |
| 82 | errors = True |
| 83 | |
| 84 | if errors: |
| 85 | return 1 |
| 86 | except: |
| 87 | LOG.exception("(PID=%s) Worker unexpectedly stopped.", os.getpid()) |
| 88 | return 1 |
| 89 | |
| 90 | return 0 |
| 91 | |
| 92 | |
| 93 | def _teardown(): |
no test coverage detected