2 * Copyright © 2017-2018 AT&T Intellectual Property.
4 * Modifications Copyright © 2019 IBM, Bell Canada.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package org.onap.ccsdk.cds.blueprintsprocessor.services.execution.scripts
21 import org.springframework.beans.factory.annotation.Value
22 import org.springframework.boot.context.properties.EnableConfigurationProperties
23 import org.springframework.context.annotation.ComponentScan
24 import org.springframework.context.annotation.Configuration
30 @EnableConfigurationProperties
31 open class PythonExecutorConfiguration
34 open class PythonExecutorProperty {
35 @Value("\${blueprints.processor.functions.python.executor.executionPath}")
36 lateinit var executionPath: String
37 @Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
38 lateinit var modulePaths: List<String>
41 class PythonExecutorConstants {
43 const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
47 open class BluePrintPython(executablePath: String, blueprintPythonPlatform: MutableList<String>,
48 val argv: MutableList<String>){
49 lateinit var moduleName: String
50 lateinit var pythonClassName: String
51 lateinit var content: String
52 var props: Properties = Properties()
55 // Build up the python.path
56 val sb = StringBuilder()
57 sb.append(System.getProperty("java.class.path"))
59 for (p in blueprintPythonPlatform) {
60 sb.append(File.pathSeparator).append(p)
63 props["python.import.site"] = "true"
64 props.setProperty("python.path", sb.toString())
65 props.setProperty("python.verbose", "error")
66 props.setProperty("python.executable", executablePath)