Skip to content

Commit

Permalink
fix(dbt): Revert duration to property v1 to avoid duration parsing ex…
Browse files Browse the repository at this point in the history
…ception

#159
  • Loading branch information
mgabelle committed Nov 26, 2024
1 parent e16a901 commit c0b752c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/main/java/io/kestra/plugin/dbt/cloud/CheckStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.property.Property;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
Expand Down Expand Up @@ -77,14 +78,16 @@ public class CheckStatus extends AbstractDbtCloud implements RunnableTask<CheckS
@Schema(
title = "Specify how often the task should poll for the job status."
)
@PluginProperty(dynamic = true)
@Builder.Default
Property<Duration> pollFrequency = Property.of(Duration.ofSeconds(5));
Duration pollFrequency = Duration.ofSeconds(5);

@Schema(
title = "The maximum duration the task should poll for the job completion."
)
@PluginProperty(dynamic = true)
@Builder.Default
Property<Duration> maxDuration = Property.of(Duration.ofMinutes(60));
Duration maxDuration = Duration.ofMinutes(60);

@Builder.Default
@Schema(
Expand Down Expand Up @@ -139,8 +142,8 @@ public CheckStatus.Output run(RunContext runContext) throws Exception {

return null;
}),
this.pollFrequency.as(runContext, Duration.class),
this.maxDuration.as(runContext, Duration.class)
this.pollFrequency,
this.maxDuration
);

// final response
Expand Down Expand Up @@ -212,7 +215,7 @@ private Optional<RunResponse> fetchRunResponse(RunContext runContext, Long id, B
))
),
Argument.of(RunResponse.class),
maxDuration.as(runContext, Duration.class)
maxDuration
)
.getBody();
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/io/kestra/plugin/dbt/cloud/TriggerRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.annotations.PluginProperty;
import io.kestra.core.models.property.Property;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
Expand Down Expand Up @@ -126,14 +127,16 @@ public class TriggerRun extends AbstractDbtCloud implements RunnableTask<Trigger
@Schema(
title = "Specify frequency for job state check API calls."
)
@PluginProperty(dynamic = true)
@Builder.Default
Property<Duration> pollFrequency = Property.of(Duration.ofSeconds(5));
Duration pollFrequency = Duration.ofSeconds(5);

@Schema(
title = "The maximum total wait duration."
)
@PluginProperty(dynamic = true)
@Builder.Default
Property<Duration> maxDuration = Property.of(Duration.ofMinutes(60));
Duration maxDuration = Duration.ofMinutes(60);

@Builder.Default
@Schema(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void run() throws Exception {
.runId(Property.of(runOutput.getRunId().toString()))
.token(Property.of(this.token))
.accountId(Property.of(this.accountId))
.maxDuration(Property.of(Duration.ofMinutes(60)))
.maxDuration(Duration.ofMinutes(60))
.parseRunResults(Property.of(false))
.build();

Expand Down

0 comments on commit c0b752c

Please sign in to comment.