aboutsummaryrefslogtreecommitdiffstats
path: root/ms/command-executor/src/main/python/command_executor_handler.py
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-09-02 14:36:25 -0400
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-09-03 13:03:22 +0000
commitcd29a05ccd4279d7fb740d03bbeee6a0839b287e (patch)
treeb8784a8162807da0d87ca80663659fbdbaa043dd /ms/command-executor/src/main/python/command_executor_handler.py
parent240f25e7fd15209cf298f640bb856793854fa32f (diff)
Use ProcessPool rather than ThreadPool Executor
Change-Id: I66a800bf30cabce35123b0ac24b3b3e00eef6026 Issue-ID: CCSDK-1681 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'ms/command-executor/src/main/python/command_executor_handler.py')
-rw-r--r--ms/command-executor/src/main/python/command_executor_handler.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/ms/command-executor/src/main/python/command_executor_handler.py b/ms/command-executor/src/main/python/command_executor_handler.py
index 972dad627..abea4d411 100644
--- a/ms/command-executor/src/main/python/command_executor_handler.py
+++ b/ms/command-executor/src/main/python/command_executor_handler.py
@@ -35,6 +35,7 @@ class CommandExecutorHandler():
self.request = request
self.logger = logging.getLogger(self.__class__.__name__)
self.blueprint_id = utils.get_blueprint_id(request)
+ # FIXME parameterize path
self.venv_home = '/opt/app/onap/blueprints/deploy/' + self.blueprint_id
self.installed = self.venv_home + '/.installed'
@@ -60,7 +61,6 @@ class CommandExecutorHandler():
results.append(f.read())
f.close()
- # deactivate_venv(blueprint_id)
return True
def execute_command(self, request, results):
@@ -73,6 +73,7 @@ class CommandExecutorHandler():
if "ansible-playbook" in request.command:
cmd = cmd + "; " + request.command + " -e 'ansible_python_interpreter=" + self.venv_home + "/bin/python'"
else:
+ # we append the properties as last agr to the script
cmd = cmd + "; " + request.command + " " + re.escape(MessageToJson(request.properties))
try:
@@ -170,8 +171,8 @@ class CommandExecutorHandler():
path = "%s/bin/activate_this.py" % self.venv_home
try:
- exec (open(path).read(), {'__file__': path})
- exec (fixpathenvvar)
+ exec(open(path).read(), {'__file__': path})
+ exec(fixpathenvvar)
self.logger.info("Running with PATH : {}".format(os.environ['PATH']))
return True
except Exception as err: