Skip to content

Commit d4065a6

Browse files
committed
feat: deprecate all Eval and FileTransform task
They have better replacements inside the GraalVM plugin Part-of: #3424
1 parent 72254c2 commit d4065a6

File tree

10 files changed

+50
-30
lines changed

10 files changed

+50
-30
lines changed

plugin-script-groovy/src/main/java/io/kestra/plugin/scripts/groovy/Eval.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,32 @@
1313
@Getter
1414
@NoArgsConstructor
1515
@Schema(
16-
title = "Execute a Groovy script."
16+
title = "Execute a Groovy script.",
17+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.js.Eval`, `io.kestra.plugin.graalvm.python.Eval` or `io.kestra.plugin.graalvm.ruby.Eval` instead."
1718
)
1819
@Plugin(
1920
examples = {
2021
@Example(
2122
full = true,
2223
title = "Make an API call and pass request body to a Groovy script.",
23-
code = """
24+
code = """
2425
id: api_request_to_groovy
2526
namespace: company.team
26-
27+
2728
tasks:
2829
- id: request
2930
type: io.kestra.plugin.core.http.Request
3031
uri: "https://dummyjson.com/products/1"
31-
32+
3233
- id: groovy
3334
type: io.kestra.plugin.scripts.groovy.Eval
3435
script: |
3536
logger.info('{{ outputs.request.body }}')
36-
37+
3738
- id: download
3839
type: io.kestra.plugin.core.http.Download
3940
uri: "https://dummyjson.com/products/1"
40-
41+
4142
- id: run_context_groovy
4243
type: io.kestra.plugin.scripts.groovy.Eval
4344
script: |
@@ -46,7 +47,7 @@
4647
InputStream istream = runContext.storage().getFile(uri)
4748
logger.info('Content: {}', istream.text)
4849
"""
49-
),
50+
),
5051
@Example(
5152
code = """
5253
id: groovy_eval
@@ -60,20 +61,21 @@
6061
- map
6162
script: |
6263
import io.kestra.core.models.executions.metrics.Counter
63-
64+
6465
logger.info('executionId: {}', runContext.render('{{ execution.id }}'))
6566
runContext.metric(Counter.of('total', 666, 'name', 'bla'))
66-
67+
6768
map = Map.of('test', 'here')
6869
File tempFile = runContext.workingDir().createTempFile().toFile()
6970
var output = new FileOutputStream(tempFile)
7071
output.write('555\\n666\\n'.getBytes())
71-
72+
7273
out = runContext.storage().putFile(tempFile
7374
"""
7475
)
7576
}
7677
)
78+
@Deprecated
7779
public class Eval extends io.kestra.plugin.scripts.jvm.Eval {
7880
@Override
7981
public Eval.Output run(RunContext runContext) throws Exception {

plugin-script-groovy/src/main/java/io/kestra/plugin/scripts/groovy/FileTransform.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.kestra.plugin.scripts.groovy;
22

3+
import io.swagger.v3.oas.annotations.media.Schema;
34
import lombok.EqualsAndHashCode;
45
import lombok.Getter;
56
import lombok.NoArgsConstructor;
@@ -17,6 +18,10 @@
1718
@EqualsAndHashCode
1819
@Getter
1920
@NoArgsConstructor
21+
@Schema(
22+
title = "Transform an ION file from Kestra's internal storage with a Groovy script.",
23+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.js.FileTransform`, `io.kestra.plugin.graalvm.python.FileTransform` or `io.kestra.plugin.graalvm.ruby.FileTransform` instead."
24+
)
2025
@Plugin(
2126
examples = {
2227
@Example(
@@ -29,14 +34,14 @@
2934
inputs:
3035
- id: file
3136
type: FILE
32-
37+
3338
tasks:
3439
- id: file_transform
3540
type: io.kestra.plugin.scripts.groovy.FileTransform
3641
from: "{{ inputs.file }}"
3742
script: |
3843
logger.info('row: {}', row)
39-
44+
4045
if (row.get('name') == 'richard') {
4146
row = null
4247
} else {
@@ -82,7 +87,7 @@
8287
from: "{{ inputs.json }}"
8388
script: |
8489
logger.info('row: {}', row)
85-
90+
8691
if (row.get('name') == 'richard') {
8792
row = null
8893
} else {
@@ -96,28 +101,29 @@
96101
code = """
97102
id: json_transform_using_jackson
98103
namespace: company.team
99-
104+
100105
tasks:
101106
- id: file_transform
102107
type: io.kestra.plugin.scripts.groovy.FileTransform
103108
from: "[{"name":"John Doe", "age":99, "embedded":{"foo":"bar"}}]"
104109
script: |
105110
import com.fasterxml.jackson.*
106-
111+
107112
def mapper = new databind.ObjectMapper();
108113
def jsonStr = mapper.writeValueAsString(row);
109114
logger.info('input in json str: {}', jsonStr)
110-
115+
111116
def typeRef = new core.type.TypeReference<HashMap<String,Object>>() {};
112-
117+
113118
data = mapper.readValue(jsonStr, typeRef);
114-
119+
115120
logger.info('json object: {}', data);
116121
logger.info('embedded field: {}', data.embedded.foo)
117122
"""
118123
)
119124
}
120125
)
126+
@Deprecated
121127
public class FileTransform extends io.kestra.plugin.scripts.jvm.FileTransform {
122128
@Override
123129
public Output run(RunContext runContext) throws Exception {

plugin-script-jython/src/main/java/io/kestra/plugin/scripts/jython/Eval.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
@Getter
1414
@NoArgsConstructor
1515
@Schema(
16-
title = "Execute a Jython script."
16+
title = "Execute a Jython script.",
17+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.js.Eval` instead."
1718
)
1819
@Plugin(
1920
examples = {
@@ -33,19 +34,20 @@
3334
from io.kestra.core.models.executions.metrics import Counter
3435
import tempfile
3536
from java.io import File
36-
37+
3738
logger.info('executionId: {}', runContext.render('{{ execution.id }}'))
3839
runContext.metric(Counter.of('total', 666, 'name', 'bla'))
39-
40+
4041
map = {'test': 'here'}
4142
tempFile = tempfile.NamedTemporaryFile()
4243
tempFile.write('555\\n666\\n')
43-
44+
4445
out = runContext.storage().putFile(File(tempFile.name)
4546
"""
4647
)
4748
}
4849
)
50+
@Deprecated
4951
public class Eval extends io.kestra.plugin.scripts.jvm.Eval {
5052
@Override
5153
public Eval.Output run(RunContext runContext) throws Exception {

plugin-script-jython/src/main/java/io/kestra/plugin/scripts/jython/FileTransform.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
@Getter
2020
@NoArgsConstructor
2121
@Schema(
22-
title = "Transform an ION file from Kestra's internal storage with a Jython script."
22+
title = "Transform an ION file from Kestra's internal storage with a Jython script.",
23+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.python.FileTransform` instead."
2324
)
2425
@Plugin(
2526
examples = {
@@ -128,6 +129,7 @@
128129
)
129130
}
130131
)
132+
@Deprecated
131133
public class FileTransform extends io.kestra.plugin.scripts.jvm.FileTransform {
132134
@Override
133135
public Output run(RunContext runContext) throws Exception {

plugin-script-nashorn/src/main/java/io/kestra/plugin/scripts/nashorn/Eval.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
@Getter
1414
@NoArgsConstructor
1515
@Schema(
16-
title = "Execute a Nashorn (JavaScript) script."
16+
title = "Execute a Nashorn (JavaScript) script.",
17+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.js.Eval` instead."
1718
)
1819
@Plugin(
1920
examples = {
@@ -33,20 +34,21 @@
3334
var Counter = Java.type('io.kestra.core.models.executions.metrics.Counter');
3435
var File = Java.type('java.io.File');
3536
var FileOutputStream = Java.type('java.io.FileOutputStream');
36-
37+
3738
logger.info('executionId: {}', runContext.render('{{ execution.id }}'));
3839
runContext.metric(Counter.of('total', 666, 'name', 'bla'));
39-
40+
4041
map = {'test': 'here'}
4142
var tempFile = runContext.workingDir().createTempFile().toFile()
4243
var output = new FileOutputStream(tempFile)
4344
output.write('555\\n666\\n'.getBytes())
44-
45+
4546
out = runContext.storage().putFile(tempFile)"
4647
"""
4748
)
4849
}
4950
)
51+
@Deprecated
5052
public class Eval extends io.kestra.plugin.scripts.jvm.Eval {
5153
@Override
5254
public Eval.Output run(RunContext runContext) throws Exception {

plugin-script-nashorn/src/main/java/io/kestra/plugin/scripts/nashorn/FileTransform.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
@Getter
1818
@NoArgsConstructor
1919
@Schema(
20-
title = "Transform an ION file from Kestra's internal storage with a Nashorn (JavaScript) script."
20+
title = "Transform an ION file from Kestra's internal storage with a Nashorn (JavaScript) script.",
21+
description = "This task is deprecated, please use `io.kestra.plugin.graalvm.js.FileTransform` instead."
2122
)
2223
@Plugin(
2324
examples = {
@@ -34,7 +35,7 @@
3435
from: "{{ outputs['avro-to-gcs'] }}"
3536
script: |
3637
logger.info('row: {}', row)
37-
38+
3839
if (row['name'] === 'richard') {
3940
row = null
4041
} else {
@@ -75,7 +76,7 @@
7576
from: "[{\"name":\"jane\"}, {\"name\":\"richard\"}]"
7677
script: |
7778
logger.info('row: {}', row)
78-
79+
7980
if (row['name'] === 'richard') {
8081
row = null
8182
} else {
@@ -85,6 +86,7 @@
8586
)
8687
}
8788
)
89+
@Deprecated
8890
public class FileTransform extends io.kestra.plugin.scripts.jvm.FileTransform {
8991
@Override
9092
public Output run(RunContext runContext) throws Exception {

plugin-script/src/main/java/io/kestra/plugin/scripts/jvm/AbstractJvmScript.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@EqualsAndHashCode
1515
@Getter
1616
@NoArgsConstructor
17+
@Deprecated
1718
public abstract class AbstractJvmScript extends Task {
1819
@Schema(
1920
title = "A full script."

plugin-script/src/main/java/io/kestra/plugin/scripts/jvm/Eval.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"\n" +
3131
"The stdOut & stdErr is not captured, so you must use `logger`.\n"
3232
)
33+
@Deprecated
3334
public abstract class Eval extends AbstractJvmScript implements RunnableTask<Eval.Output> {
3435
@Schema(
3536
title = "A list of output variables that will be usable in outputs."

plugin-script/src/main/java/io/kestra/plugin/scripts/jvm/FileTransform.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"If you set the `row` to `null`, the row will be skipped.\n" +
4343
"You can create a variable `rows` to return multiple rows for a single `row`.\n"
4444
)
45+
@Deprecated
4546
public abstract class FileTransform extends AbstractJvmScript implements RunnableTask<FileTransform.Output> {
4647
@NotNull
4748
@Schema(

plugin-script/src/main/java/io/kestra/plugin/scripts/jvm/ScriptEngineService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.util.function.Supplier;
1010
import javax.script.*;
1111

12+
@Deprecated
1213
public abstract class ScriptEngineService {
1314
public static CompiledScript scripts(RunContext runContext, String engineName, String script, ClassLoader classLoader) throws ScriptException {
1415
Logger logger = runContext.logger();

0 commit comments

Comments
 (0)