Commit 90efdf36 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: hack to let supervisord start before runner

parent 69de2cbc
...@@ -13,6 +13,7 @@ from slapos.runner.process import setHandler ...@@ -13,6 +13,7 @@ from slapos.runner.process import setHandler
import sys import sys
from slapos.runner.utils import runInstanceWithLock from slapos.runner.utils import runInstanceWithLock
from slapos.runner.views import * from slapos.runner.views import *
import time
TRUE_VALUES = (1, '1', True, 'true', 'True') TRUE_VALUES = (1, '1', True, 'true', 'True')
...@@ -130,11 +131,19 @@ def serve(config): ...@@ -130,11 +131,19 @@ def serve(config):
app.logger.addHandler(config.logger) app.logger.addHandler(config.logger)
app.logger.info('Running slapgrid...') app.logger.info('Running slapgrid...')
if app.config['auto_deploy_instance'] in TRUE_VALUES: if app.config['auto_deploy_instance'] in TRUE_VALUES:
runInstanceWithLock(app.config) import thread
# XXX-Nicolas: Hack to be sure that supervisord has started
# before any communication with it, so that gunicorn doesn't exit
thread.start_new_thread(waitForRun, (app.config,))
config.logger.info('Done.') config.logger.info('Done.')
app.wsgi_app = ProxyFix(app.wsgi_app) app.wsgi_app = ProxyFix(app.wsgi_app)
def waitForRun(config):
time.sleep(3)
runInstanceWithLock(config)
def getUpdatedParameter(self, var): def getUpdatedParameter(self, var):
configuration_parser = ConfigParser.SafeConfigParser() configuration_parser = ConfigParser.SafeConfigParser()
configuration_file_path = os.path.abspath(os.getenv('RUNNER_CONFIG')) configuration_file_path = os.path.abspath(os.getenv('RUNNER_CONFIG'))
......
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