Fix the forking problem in the buildserver.

This commit is contained in:
yackob03 2013-10-29 14:42:16 -04:00
parent c91b40f356
commit 7f17c6da24

View file

@ -146,7 +146,15 @@ build = {
pool = ThreadPool(1)
def start_build(resource_url, tag_name, acccess_token):
@app.before_first_request
def start_build():
resource_url = os.environ['RESOURCE_URL']
tag_name = os.environ['TAG']
acccess_token = os.environ['TOKEN']
logger.debug('Starting job with resource url: %s tag: %s and token: %s' %
(resource_url, tag_name, acccess_token))
# Save the token
host = re.match(r'([a-z0-9.:]+)/.+/.+$', tag_name)
if host:
@ -201,13 +209,4 @@ def health_check():
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
resource_url = os.environ['RESOURCE_URL']
tag_name = os.environ['TAG']
acccess_token = os.environ['TOKEN']
logger.debug('Starting job with resource url: %s tag: %s and token: %s' %
(resource_url, tag_name, acccess_token))
start_build(resource_url, tag_name, acccess_token)
app.run(host='0.0.0.0', port=5002)