From 088b9c2e8e33d55be8b308a77dd81d6db3a536dc Mon Sep 17 00:00:00 2001 From: Mathieu Gabelle Date: Wed, 23 Oct 2024 10:25:26 +0200 Subject: [PATCH] fix: property v2 for duration in Azure Data Factory --- .../plugin/azure/datafactory/CreateRun.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/kestra/plugin/azure/datafactory/CreateRun.java b/src/main/java/io/kestra/plugin/azure/datafactory/CreateRun.java index 8b94cae..0ce6365 100644 --- a/src/main/java/io/kestra/plugin/azure/datafactory/CreateRun.java +++ b/src/main/java/io/kestra/plugin/azure/datafactory/CreateRun.java @@ -113,6 +113,20 @@ public class CreateRun extends AbstractAzureIdentityConnection implements Runnab @Builder.Default private Property wait = Property.of(Boolean.TRUE); + @Schema( + title = "Wait until completion duration", + description = "Maximum duration to wait for the pipeline to resolve. After this time the task will time out" + ) + @Builder.Default + private Property waitUntilCompletion = Property.of(Duration.ofHours(1L)); + + @Schema( + title = "Completion check interval", + description = "The frequency with which the task checks whether the pipeline has completed." + ) + @Builder.Default + private final Property completionCheckInterval = Property.of(Duration.ofSeconds(5L)); + @Override public CreateRun.Output run(RunContext runContext) throws Exception { Logger logger = runContext.logger(); @@ -151,6 +165,8 @@ public CreateRun.Output run(RunContext runContext) throws Exception { .runId(runId) .build(); } + final Duration completionCheckIntervalRendered = runContext.render(completionCheckInterval, Duration.class); + final Duration waitUntilCompletionRendered = runContext.render(waitUntilCompletion, Duration.class); final AtomicReference runningPipelineResponse = new AtomicReference<>(); try { @@ -163,7 +179,7 @@ public CreateRun.Output run(RunContext runContext) throws Exception { } return PIPELINE_SUCCEEDED_STATUS.equals(runStatus); - }, COMPLETION_CHECK_INTERVAL, WAIT_UNTIL_COMPLETION); + }, completionCheckIntervalRendered, waitUntilCompletionRendered); } catch (TimeoutException | RuntimeException e) { logger.error("Pipeline '{}' with runId '{} finished with status '{}'", pipelineName, runId, runningPipelineResponse.get().status()); throw new RuntimeException(runningPipelineResponse.get().message());