MCPcopy Create free account
hub / github.com/StackStorm/st2 / _run_worker

Function _run_worker

st2actions/st2actions/cmd/actionrunner.py:64–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62
63
64def _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
93def _teardown():

Callers 1

mainFunction · 0.70

Calls 5

deregister_serviceFunction · 0.90
_setup_sigterm_handlerFunction · 0.70
startMethod · 0.45
waitMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected