diff options
author | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-04-03 21:36:57 -0400 |
---|---|---|
committer | Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com> | 2019-04-04 08:09:16 -0400 |
commit | 0007063cc856483e36dd49718dea5dda80ed6809 (patch) | |
tree | f97d43008e4f0d816a8041b02e5d986cc5f3557e /ms/blueprintsprocessor/modules/services/execution-service | |
parent | a2a21cd7a80c3ff3b754d7a4e47fc48f45ff2312 (diff) |
Improve step data access.
Change-Id: I3917905b1e38cebcb26e4422784a5553e2dbac9f
Issue-ID: CCSDK-1127
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/execution-service')
2 files changed, 15 insertions, 13 deletions
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index 14feb28bf..12f6bc47f 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -22,14 +22,14 @@ import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.Status +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData import org.onap.ccsdk.cds.controllerblueprints.common.api.EventType import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.asObjectNode +import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.getAsString import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService -import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory /** @@ -57,8 +57,13 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic override suspend fun prepareRequestNB(executionRequest: ExecutionServiceInput): ExecutionServiceInput { checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" } + checkNotNull(executionRequest.stepData) { "failed to get step info" } - check(stepName.isNotEmpty()) { "failed to assign step name" } + // Get the Step Name and Step Inputs + this.stepName = executionRequest.stepData!!.name + this.operationInputs = executionRequest.stepData!!.properties + + checkNotEmpty(stepName) { "failed to get step name from step data" } this.executionServiceInput = executionRequest @@ -70,13 +75,6 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic log.info("preparing request id($processId) for workflow($workflowName) step($stepName)") - val stepInputs = bluePrintRuntimeService.get("$stepName-step-inputs") - ?: JacksonUtils.objectMapper.createObjectNode() - - stepInputs.fields().forEach { - this.operationInputs[it.key] = it.value - } - nodeTemplateName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE) check(nodeTemplateName.isNotEmpty()) { "couldn't get NodeTemplate name for step($stepName)" } @@ -104,7 +102,11 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic val stepOutputs = bluePrintRuntimeService .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) - bluePrintRuntimeService.put("$stepName-step-outputs", stepOutputs.asObjectNode()) + val stepOutputData = StepData().apply { + name = stepName + properties = stepOutputs + } + executionServiceOutput.stepData = stepOutputData // Set the Default Step Status status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name } catch (e: Exception) { diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt index 586888bab..814054804 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/BlueprintJythonService.kt @@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode import org.apache.commons.io.FilenameUtils import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException -import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmptyOrThrow +import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintFunctionNode import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintContext @@ -100,7 +100,7 @@ class BlueprintJythonService(val pythonExecutorProperty: PythonExecutorProperty, val content: String? = bluePrintRuntimeService.resolveNodeTemplateArtifact(nodeTemplateName, artifactName) - checkNotEmptyOrThrow(content, "artifact ($artifactName) content is empty") + checkNotEmpty(content){ "artifact ($artifactName) content is empty"} val pythonPath: MutableList<String> = operationAssignment.implementation?.dependencies ?: arrayListOf() pythonPath.add(blueprintBasePath) |