concierge/main.py

37 lines
692 B
Python
Raw Normal View History

import os
import signal
import sys
import time
# supervisord xml-rpc connection
2020-04-15 21:22:30 +02:00
from xmlrpc.client import ServerProxy
svd = ServerProxy('http://127.0.0.1:9001/RPC2')
identity = os.environ.get('CONCIERGE_IDENTITY', default="develop")
def sigterm_handler(signum, frame):
print("concierge shutting down.")
# if concierge dies, all tasks need to die as well!
sys.exit(0)
def loop(config):
while True:
# do stuff
print(svd.supervisor.getAllProcessInfo())
2020-04-15 21:22:30 +02:00
time.sleep(1)
2020-04-15 21:22:30 +02:00
def main():
# program setup
signal.signal(signal.SIGTERM, sigterm_handler)
2020-04-15 21:44:56 +02:00
# check connection to supervisord
print(svd.supervisor.getState())
loop()
2020-04-15 21:22:30 +02:00
2020-04-15 21:44:56 +02:00
main()