Commit 1f5e7a3f authored by Sebastien Robin's avatar Sebastien Robin

save memory by stopping supervisor

between to test suite launch, it is not needed to keep
supervidor running. This allows to save memory usage
parent f1727fa7
...@@ -67,6 +67,18 @@ def getInputOutputFileList(config, command_name): ...@@ -67,6 +67,18 @@ def getInputOutputFileList(config, command_name):
slapos_controler = None slapos_controler = None
def killPreviousRun(process_group_pid_set, supervisord_pid_file):
for pgpid in process_group_pid_set:
try:
os.killpg(pgpid, signal.SIGTERM)
except:
pass
try:
if os.path.exists(supervisord_pid_file):
os.kill(int(open(supervisord_pid_file).read().strip()), signal.SIGTERM)
except:
pass
def run(args): def run(args):
config = args[0] config = args[0]
slapgrid = None slapgrid = None
...@@ -118,11 +130,7 @@ branch = %(branch)s ...@@ -118,11 +130,7 @@ branch = %(branch)s
while True: while True:
# kill processes from previous loop if any # kill processes from previous loop if any
try: try:
for pgpid in process_group_pid_set: killPreviousRun(process_group_pid_set, supervisord_pid_file)
try:
os.killpg(pgpid, signal.SIGTERM)
except:
pass
process_group_pid_set.clear() process_group_pid_set.clear()
full_revision_list = [] full_revision_list = []
# Make sure we have local repository # Make sure we have local repository
...@@ -233,13 +241,4 @@ branch = %(branch)s ...@@ -233,13 +241,4 @@ branch = %(branch)s
# groups working only in POSIX compilant systems # groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phase # Exceptions are swallowed during cleanup phase
print "going to kill %r" % (process_group_pid_set,) print "going to kill %r" % (process_group_pid_set,)
for pgpid in process_group_pid_set: killPreviousRun(process_group_pid_set, supervisord_pid_file)
try:
os.killpg(pgpid, signal.SIGTERM)
except:
pass
try:
if os.path.exists(supervisord_pid_file):
os.kill(int(open(supervisord_pid_file).read().strip()), signal.SIGTERM)
except:
pass
\ No newline at end of file
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