| Conditions | 8 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | import eventlet |
||
| 27 | def _run_worker(): |
||
| 28 | LOG.info('(PID=%s) Worker started.', os.getpid()) |
||
| 29 | |||
| 30 | components = [ |
||
| 31 | scheduler.get_scheduler(), |
||
| 32 | worker.get_worker() |
||
| 33 | ] |
||
| 34 | |||
| 35 | try: |
||
| 36 | for component in components: |
||
| 37 | component.start() |
||
| 38 | |||
| 39 | for component in components: |
||
| 40 | component.wait() |
||
| 41 | except (KeyboardInterrupt, SystemExit): |
||
| 42 | LOG.info('(PID=%s) Worker stopped.', os.getpid()) |
||
| 43 | |||
| 44 | errors = False |
||
| 45 | |||
| 46 | for component in components: |
||
| 47 | try: |
||
| 48 | component.shutdown() |
||
| 49 | except: |
||
| 50 | LOG.exception('Unable to shutdown %s.', component.__class__.__name__) |
||
| 51 | errors = True |
||
| 52 | |||
| 53 | if errors: |
||
| 54 | return 1 |
||
| 55 | except: |
||
| 56 | LOG.exception('(PID=%s) Worker unexpectedly stopped.', os.getpid()) |
||
| 57 | return 1 |
||
| 58 | |||
| 59 | return 0 |
||
| 60 | |||
| 77 |