From 273290a67a102a6b2da7cfc5407871c52fa126ee Mon Sep 17 00:00:00 2001 From: Oleg Mitsura Date: Tue, 30 Jun 2020 08:46:35 -0400 Subject: RemoteAnsibleExecutor delay vs Thread.sleep bug Issue-ID: CCSDK-2505 Signed-off-by: Oleg Mitsura Change-Id: I0115a484c61169f2cc031553ecd664796aff6bf8 --- .../functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ms/blueprintsprocessor/functions/ansible-awx-executor/src') diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt index 6f994edab..1e70cdd9e 100644 --- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt +++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutor.kt @@ -20,6 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.ansible.executor import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.databind.node.TextNode +import kotlinx.coroutines.delay import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BluePrintRestLibPropertyService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService @@ -172,7 +173,7 @@ open class ComponentRemoteAnsibleExecutor( * its execution. Finally, it retrieves the job results via the stdout api. * The status and output attributes are populated in the process. */ - private fun runJobTemplateOnAWX( + private suspend fun runJobTemplateOnAWX( awxClient: BlueprintWebClientService, job_template_name: String?, jtId: String, @@ -210,7 +211,7 @@ open class ComponentRemoteAnsibleExecutor( val jobLaunched: JsonNode = mapper.readTree(response.body) jobStatus = jobLaunched.at("/status").asText() jobEndTime = jobLaunched.at("/finished").asText() - Thread.sleep(checkDelay) + delay(checkDelay) } log.info("Execution of job template $job_template_name in job #$jobId finished with status ($jobStatus) for requestId $processId") -- cgit 1.2.3-korg