From: peusterm Date: Tue, 23 Aug 2016 09:11:12 +0000 (+0200) Subject: Ensure that the dummy GK server is never blocked even if a container stops. X-Git-Tag: v3.1~66^2 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=e66edf774d84b1bcc0975b34a21e9565528ba42c;p=osm%2Fvim-emu.git Ensure that the dummy GK server is never blocked even if a container stops. --- diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 55191b2..7ae3522 100755 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -38,6 +38,7 @@ import uuid import hashlib import zipfile import yaml +import threading from docker import Client as DockerClient from flask import Flask, request import flask_restful as fr @@ -332,8 +333,11 @@ class Service(object): for env_var in env: if "SON_EMU_CMD=" in env_var: cmd = str(env_var.split("=")[1]) - LOG.info("Executing entrypoint script in %r: %r" % (vnfi.name, cmd)) - vnfi.cmdPrint(cmd) + LOG.info("Executing entry point script in %r: %r" % (vnfi.name, cmd)) + # execute command in new thread to ensure that GK is not blocked by VNF + t = threading.Thread(target=vnfi.cmdPrint, args=(cmd,)) + t.daemon = True + t.start() def _unpack_service_package(self): """