Commit 35afff13 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: mini-library added to control supervisord processes

parent 303acb03
import time
import xmlrpclib
from supervisor import childutils
# This mini-library is used to communicate with supervisord process
# It aims to replace the file "process.py"
# For the moment, we keep both for compatibility
def isRunning(config, process):
server = xmlrpclib.Server(config['supervisord_server'])
state = server.supervisor.getProcessInfo(process)['state']
return (True if state == 20 else False)
def returnCode(config, process):
server = xmlrpclib.Server(config['supervisord_server'])
code = server.supervisor.getProcessInfo(process)['exitstatus']
return code
def runProcess(config, process):
server = xmlrpclib.Server(config['supervisord_server'])
server.supervisor.startProcess(process)
def runProcesses(config, processes):
server = xmlrpclib.Server(config['supervisord_server'])
for proc in processes:
server.supervisor.startProcess(proc)
waitForProcessEnd(proc)
def waitForProcessEnd(config, process):
server = xmlrpclib.Server(config['supervisord_server'])
while True:
state = server.supervisor.getProcessInfo(process)['state']
if state == 20:
time.sleep(5)
return False
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment