Skip to content

Commit

Permalink
fix(node): new method input files (#150)
Browse files Browse the repository at this point in the history
* fix(node): new method input files

* fix(python): new method input files
  • Loading branch information
Skraye authored Jun 3, 2024
1 parent 157ffc6 commit 7468490
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ protected Map<String, String> finalInputFiles(RunContext runContext) throws IOEx
return map;
}

@Override
protected Map<String, String> finalInputFiles(RunContext runContext, Map<String, Object> additionalVar) throws IOException, IllegalVariableEvaluationException {
Map<String, String> map = super.finalInputFiles(runContext, additionalVar);

map.put("kestra.js", IOUtils.toString(
Objects.requireNonNull(Node.class.getClassLoader().getResourceAsStream("kestra.js")),
Charsets.UTF_8
));

return map;
}

@Override
public io.kestra.core.tasks.scripts.ScriptOutput run(RunContext runContext) throws Exception {
Map<String, String> finalInputFiles = this.finalInputFiles(runContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

import com.google.common.base.Charsets;
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.SuperBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
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.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import lombok.experimental.SuperBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.util.*;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

import static io.kestra.core.utils.Rethrow.throwSupplier;

Expand Down Expand Up @@ -172,6 +172,19 @@ protected Map<String, String> finalInputFiles(RunContext runContext) throws IOEx
return map;
}

@Override
protected Map<String, String> finalInputFiles(RunContext runContext, Map<String, Object> additionalVar) throws IOException, IllegalVariableEvaluationException {
Map<String, String> map = super.finalInputFiles(runContext, additionalVar);

map.put("kestra.py", IOUtils.toString(
Objects.requireNonNull(Python.class.getClassLoader().getResourceAsStream(
"kestra.py")),
Charsets.UTF_8
));

return map;
}

@Override
public ScriptOutput run(RunContext runContext) throws Exception {
Map<String, String> finalInputFiles = this.finalInputFiles(runContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ abstract public class AbstractBash extends Task {
)
@PluginProperty
@NotNull
@NotEmpty
protected RunnerType runner = RunnerType.PROCESS;

@Schema(
Expand Down

0 comments on commit 7468490

Please sign in to comment.