aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2020-03-31 04:29:40 -0400
committerOleg Mitsura <oleg.mitsura@amdocs.com>2020-03-31 04:29:40 -0400
commit6227c809d094e9d5de961c0274a39560cfa812a1 (patch)
treecaacb7d8aca306420014ce01026c89447bc41b00
parent383f847e97275e59542b0ed54b40cb18cc034d88 (diff)
better err msg on failures during timeouts.
Issue-ID: CCSDK-2039 Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: Ic76d024bffbf91d3056227c5533a9fd8e1b2d80b
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt12
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt3
2 files changed, 8 insertions, 7 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 96b7cc0cc..51c01df45 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -88,8 +88,6 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val dynamicProperties = getOptionalOperationInput(INPUT_DYNAMIC_PROPERTIES)
val packages = getOptionalOperationInput(INPUT_PACKAGES)?.returnNullIfMissing()
- val argsNode = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
-
// This prevents unescaping values, as well as quoting the each parameter, in order to allow for spaces in values
val args = getOptionalOperationInput(INPUT_ARGUMENT_PROPERTIES)?.returnNullIfMissing()
?.rootFieldsToMap()?.toSortedMap()?.values?.joinToString(" ") { formatNestedJsonNode(it) }
@@ -147,9 +145,10 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG,"".asJsonPrimitive());
}
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val grpcErrMsg = "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId)."
+ val componentLevelWarningMsg = if (timeout < envPrepTimeout) "Note: component-level timeout ($timeout) is shorter than env-prepare timeout ($envPrepTimeout). " else ""
+ val grpcErrMsg = "Command failed during env. preparation... timeout($envPrepTimeout) requestId ($processId). $componentLevelWarningMsg"
setAttribute(ATTRIBUTE_PREPARE_ENV_LOG, grpcErrMsg.asJsonPrimitive())
- setNodeOutputErrors(status = grpcErrMsg, message = "${grpcEx.status}".asJsonPrimitive())
+ setNodeOutputErrors(status = grpcErrMsg, message = "{code=\"${grpcEx.status.code}\", description=\"${grpcEx.status.description}\", cause=\"${grpcEx.status.cause?.message}\"}".asJsonPrimitive())
log.error(grpcErrMsg, grpcEx)
addError(grpcErrMsg)
} catch (e: Exception) {
@@ -194,11 +193,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
remoteExecutionOutput.payload)
}
} catch (timeoutEx: TimeoutCancellationException) {
- val timeoutErrMsg = "Command executor timed out executing after $executionTimeout seconds requestId ($processId)"
+ val componentLevelWarningMsg = if (timeout < executionTimeout) "Note: component-level timeout ($timeout) is shorter than execution timeout ($executionTimeout). " else ""
+ val timeoutErrMsg = "Command executor execution timeout. DetailedMessage: (${timeoutEx.message}) requestId ($processId). $componentLevelWarningMsg"
setNodeOutputErrors(status = timeoutErrMsg, message = "".asJsonPrimitive())
log.error(timeoutErrMsg, timeoutEx)
} catch (grpcEx: io.grpc.StatusRuntimeException) {
- val timeoutErrMsg = "Command executor timed out executing after $executionTimeout seconds requestId ($processId)"
+ val timeoutErrMsg = "Command executor failed to execute requestId ($processId) error (${grpcEx.status.cause?.message})"
setNodeOutputErrors(status = timeoutErrMsg, message = "".asJsonPrimitive())
log.error("Command executor time out during GRPC call", grpcEx)
} catch (e: Exception) {
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 7a0f167fa..6e3d04a24 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
@@ -49,6 +49,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
lateinit var operationName: String
lateinit var nodeTemplateName: String
var timeout: Int = 180
+ val timeoutDeltaInMillis = 100L
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun getName(): String {
@@ -124,7 +125,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
override suspend fun applyNB(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
try {
prepareRequestNB(executionServiceInput)
- withTimeout(timeout * 1000L) {
+ withTimeout(timeout * 1000L + timeoutDeltaInMillis) {
log.debug("DEBUG::: AbstractComponentFunction.withTimeout section $timeout seconds")
processNB(executionServiceInput)
}