()
| 62 | |
| 63 | |
| 64 | def _run_worker(): |
| 65 | LOG.info("(PID=%s) TimerEngine started.", os.getpid()) |
| 66 | |
| 67 | timer = None |
| 68 | |
| 69 | try: |
| 70 | timer_thread = None |
| 71 | if cfg.CONF.timer.enable or cfg.CONF.timersengine.enable: |
| 72 | local_tz = ( |
| 73 | cfg.CONF.timer.local_timezone or cfg.CONF.timersengine.local_timezone |
| 74 | ) |
| 75 | timer = St2Timer(local_timezone=local_tz) |
| 76 | timer_thread = concurrency.spawn(_kickoff_timer, timer) |
| 77 | LOG.info(TIMER_ENABLED_LOG_LINE) |
| 78 | return timer_thread.wait() |
| 79 | else: |
| 80 | LOG.info(TIMER_DISABLED_LOG_LINE) |
| 81 | except (KeyboardInterrupt, SystemExit): |
| 82 | LOG.info("(PID=%s) TimerEngine stopped.", os.getpid()) |
| 83 | deregister_service(TIMER_ENGINE) |
| 84 | except: |
| 85 | LOG.exception("(PID:%s) TimerEngine quit due to exception.", os.getpid()) |
| 86 | return 1 |
| 87 | finally: |
| 88 | if timer: |
| 89 | timer.cleanup() |
| 90 | |
| 91 | return 0 |
| 92 | |
| 93 | |
| 94 | def main(): |
no test coverage detected