Skip to content

Commit

Permalink
refactor: use runContext non-deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jun 21, 2024
1 parent fc69d37 commit 8718fdd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/kestra/plugin/spark/AbstractSubmit.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private Map<String, String> envs(RunContext runContext) throws IllegalVariableEv
}

protected String tempFile(RunContext runContext, String name, String url) throws IOException, IllegalVariableEvaluationException, URISyntaxException {
File file = runContext.resolve(Path.of(runContext.render(name))).toFile();
File file = runContext.workingDir().resolve(Path.of(runContext.render(name))).toFile();

try (FileOutputStream fileOutputStream = new FileOutputStream(file)) {
URI from = new URI(runContext.render(url));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/kestra/plugin/spark/PythonSubmit.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class PythonSubmit extends AbstractSubmit {

@Override
protected void configure(RunContext runContext, SparkLauncher spark) throws Exception {
Path path = runContext.tempFile(".py");
Path path = runContext.workingDir().createTempFile(".py");
try (FileWriter fileWriter = new FileWriter(path.toFile())) {
IOUtils.write(runContext.render(this.mainScript), fileWriter);
fileWriter.flush();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/kestra/plugin/spark/RSubmit.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class RSubmit extends AbstractSubmit {

@Override
protected void configure(RunContext runContext, SparkLauncher spark) throws Exception {
Path path = runContext.tempFile(".R");
Path path = runContext.workingDir().createTempFile(".R");
try (FileWriter fileWriter = new FileWriter(path.toFile())) {
IOUtils.write(runContext.render(this.mainScript), fileWriter);
fileWriter.flush();
Expand Down

0 comments on commit 8718fdd

Please sign in to comment.