Add support to command to execute for remote python 98/85498/1
authorAlexis de Talhouët <adetalhouet89@gmail.com>
Tue, 16 Apr 2019 16:13:32 +0000 (12:13 -0400)
committerAlexis de Talhouët <adetalhouet89@gmail.com>
Tue, 16 Apr 2019 16:13:32 +0000 (12:13 -0400)
Change-Id: I043ea301faf87fb487204180a3294de0a76d3543
Issue-ID: CCSDK-1164
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Scripts/python/SamplePython.py
components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt

index d7002cd..cd63f00 100644 (file)
                   "description": "Dynamic Json Content or DSL Json reference.",
                   "required": false,
                   "type": "json"
+                },
+                "command": {
+                  "description": "Command to execute.",
+                  "required": true,
+                  "type": "string"
                 }
               }
             }
index 7c27901..4649114 100644 (file)
@@ -65,6 +65,9 @@
                   "dependencies": [
                     "pyaml"
                   ]
+                },
+                "inputs": {
+                  "command": "python SamplePython.py blah"
                 }
               }
             }
index 9c3c90b..99a4dd8 100644 (file)
               "description": "Dynamic Json Content or DSL Json reference.",
               "required": false,
               "type": "json"
+            },
+            "command": {
+              "description": "Command to execute.",
+              "required": true,
+              "type": "string"
             }
           }
         }
index a243f44..6437cdf 100644 (file)
@@ -46,6 +46,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
     companion object {
         const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector"
         const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
+        const val INPUT_COMMAND = "command"
     }
 
     override suspend fun processNB(executionRequest: ExecutionServiceInput) {
@@ -73,9 +74,10 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
 
         val endPointSelector = getOperationInput(INPUT_ENDPOINT_SELECTOR)
         val dynamicProperties = getOperationInput(INPUT_DYNAMIC_PROPERTIES)
+        val command = getOperationInput(INPUT_COMMAND).asText()
 
         // TODO("Python execution command and Resolve some expressions with dynamic properties")
-        val scriptCommand = pythonScript.absolutePath
+        val scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
 
         val dependencies = operationAssignment.implementation?.dependencies