forked from RedHatInsights/astro-virtual-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_actions.py
45 lines (27 loc) · 779 Bytes
/
run_actions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import signal
import sys
from prometheus_client import start_http_server
from threading import Event
from common import logging
from common.config import app
from rasa_sdk.__main__ import main as rasa_sdk_main
logger = None
event = Event()
def start_prometheus():
start_http_server(app.prometheus_port)
def handle_signal(signal, frame):
event.set()
signal.signal(signal.SIGTERM, handle_signal)
def main():
global logger
logger = logging.initialize_logging()
logger.info("Starting Astro")
app.log_config()
if app.prometheus is True:
start_prometheus()
# Use ACTIONS_PORT when set
if app.actions_port:
sys.argv.extend(["--port", str(app.actions_port)])
rasa_sdk_main()
if __name__ == "__main__":
main()