diff options
author | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-09-10 00:24:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-09-10 00:24:59 +0000 |
commit | 98a00a5e3fac8b2ea7a23b8265fb5d70a8b9d35f (patch) | |
tree | 98a5b290bbf2e3155b72f0a8ad47f27960431245 /ms | |
parent | ea30ce882465f8e48e076fb5d057c9e07c6ec601 (diff) | |
parent | 3a80a2a714f97a90f53edb048b5b88e8fc8077ec (diff) |
Merge "Revert "Use ProcessPool rather than ThreadPool Executor""
Diffstat (limited to 'ms')
-rwxr-xr-x | ms/command-executor/pom.xml | 5 | ||||
-rw-r--r-- | ms/command-executor/src/main/python/command_executor_handler.py | 7 | ||||
-rw-r--r-- | ms/command-executor/src/main/python/server.py | 5 | ||||
-rw-r--r-- | ms/command-executor/src/main/python/utils.py | 1 |
4 files changed, 8 insertions, 10 deletions
diff --git a/ms/command-executor/pom.xml b/ms/command-executor/pom.xml index e99c4ecb2..5a73fa0af 100755 --- a/ms/command-executor/pom.xml +++ b/ms/command-executor/pom.xml @@ -14,8 +14,7 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.onap.ccsdk.cds</groupId> @@ -35,7 +34,7 @@ <docker.verbose>true</docker.verbose> <ccsdk.project.version>${project.version}</ccsdk.project.version> <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> - <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> </properties> <build> 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 abea4d411..972dad627 100644 --- a/ms/command-executor/src/main/python/command_executor_handler.py +++ b/ms/command-executor/src/main/python/command_executor_handler.py @@ -35,7 +35,6 @@ 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' @@ -61,6 +60,7 @@ class CommandExecutorHandler(): results.append(f.read()) f.close() + # deactivate_venv(blueprint_id) return True def execute_command(self, request, results): @@ -73,7 +73,6 @@ 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: @@ -171,8 +170,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: diff --git a/ms/command-executor/src/main/python/server.py b/ms/command-executor/src/main/python/server.py index 0ed3d3266..453d751b2 100644 --- a/ms/command-executor/src/main/python/server.py +++ b/ms/command-executor/src/main/python/server.py @@ -1,4 +1,5 @@ -# !/usr/bin/python + +#!/usr/bin/python # # Copyright (C) 2019 Bell Canada. @@ -42,7 +43,7 @@ def serve(): 'Access denied!') server = grpc.server( - futures.ProcessPoolExecutor(), + futures.ThreadPoolExecutor(max_workers=10), interceptors=(header_validator,)) CommandExecutor_pb2_grpc.add_CommandExecutorServiceServicer_to_server( diff --git a/ms/command-executor/src/main/python/utils.py b/ms/command-executor/src/main/python/utils.py index 4314b287d..dc5d0089f 100644 --- a/ms/command-executor/src/main/python/utils.py +++ b/ms/command-executor/src/main/python/utils.py @@ -17,7 +17,6 @@ from google.protobuf.timestamp_pb2 import Timestamp import proto.CommandExecutor_pb2 as CommandExecutor_pb2 - def get_blueprint_id(request): blueprint_name = request.identifiers.blueprintName blueprint_version = request.identifiers.blueprintVersion |