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
26 import java.util.Properties
30 @EnableConfigurationProperties
31 open class PythonExecutorConfiguration
34 open class PythonExecutorProperty {
36 @Value("\${blueprints.processor.functions.python.executor.executionPath}")
37 lateinit var executionPath: String
38 @Value("#{'\${blueprints.processor.functions.python.executor.modulePaths}'.split(',')}")
39 lateinit var modulePaths: List<String>
42 class PythonExecutorConstants {
44 const val INPUT_INSTANCE_DEPENDENCIES = "instance-dependencies"
48 open class BluePrintPython(
49 executablePath: String,
50 blueprintPythonPlatform: MutableList<String>,
51 val argv: MutableList<String>
54 lateinit var moduleName: String
55 lateinit var pythonClassName: String
56 lateinit var content: String
57 var props: Properties = Properties()
60 // Build up the python.path
61 val sb = StringBuilder()
62 sb.append(System.getProperty("java.class.path"))
64 for (p in blueprintPythonPlatform) {
65 sb.append(File.pathSeparator).append(p)
68 props["python.import.site"] = "true"
69 props.setProperty("python.path", sb.toString())
70 props.setProperty("python.verbose", "error")
71 props.setProperty("python.executable", executablePath)