Repository navigation
Expand file tree
/
Copy pathEval.java
More file actions
60 lines (53 loc) · 1.91 KB
/
Copy pathEval.java
File metadata and controls
60 lines (53 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package io.kestra.plugin.scripts.jython;
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.runners.RunContext;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@SuperBuilder
@ToString
@EqualsAndHashCode
@Getter
@NoArgsConstructor
@Schema(
title = "Execute Jython script",
description = "Deprecated; use `io.kestra.plugin.graalvm.js.Eval` or other GraalVM Eval tasks. Runs a rendered Jython script with bindings from the JVM Eval base; stdout/stderr not captured—log via `logger`."
)
@Plugin(
examples = {
@Example(
full = true,
code = """
id: jython_eval
namespace: company.team
tasks:
- id: eval
type: io.kestra.plugin.scripts.jython.Eval
outputs:
- out
- map
script: |
from io.kestra.core.models.executions.metrics import Counter
import tempfile
from java.io import File
logger.info('executionId: {}', runContext.render('{{ execution.id }}'))
runContext.metric(Counter.of('total', 666, 'name', 'bla'))
map = {'test': 'here'}
tempFile = tempfile.NamedTemporaryFile()
tempFile.write('555\\n666\\n')
out = runContext.storage().putFile(File(tempFile.name)
"""
)
}
)
@Deprecated
public class Eval extends io.kestra.plugin.scripts.jvm.Eval {
@Override
public Eval.Output run(RunContext runContext) throws Exception {
return this.run(runContext, "python");
}
}