Skip to content

Commit

Permalink
refactor: migrate clickhouse cli to dynamic properties (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgabelle authored Jan 2, 2025
1 parent 72c8eff commit 8594ce2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,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.*;
import io.kestra.core.models.tasks.runners.ScriptService;
import io.kestra.core.models.tasks.runners.TaskRunner;
Expand Down Expand Up @@ -92,18 +93,20 @@ public class ClickHouseLocalCLI extends Task implements RunnableTask<ScriptOutpu

private Object inputFiles;

private List<String> outputFiles;
private Property<List<String>> outputFiles;

@Override
public ScriptOutput run(RunContext runContext) throws Exception {
var renderedOutputFiles = runContext.render(this.outputFiles).asList(String.class);

return new CommandsWrapper(runContext)
.withWarningOnStdErr(true)
.withTaskRunner(this.taskRunner)
.withContainerImage(this.containerImage)
.withEnv(Optional.ofNullable(env).orElse(new HashMap<>()))
.withNamespaceFiles(namespaceFiles)
.withInputFiles(inputFiles)
.withOutputFiles(outputFiles)
.withOutputFiles(renderedOutputFiles.isEmpty() ? null : renderedOutputFiles)
.withCommands(
ScriptService.scriptCommands(
List.of("clickhouse-local"),
Expand Down

0 comments on commit 8594ce2

Please sign in to comment.