Eval
yaml
type: "io.kestra.plugin.graalvm.python.eval"
Examples
yaml
id: parse_json_data
namespace: company.team
tasks:
- id: download
type: io.kestra.plugin.core.http.Download
uri: http://xkcd.com/info.0.json
- id: graal
type: io.kestra.plugin.graalvm.python.Eval
outputs:
- data
script: |
data = {{ read(outputs.download.uri )}}
data["next_month"] = int(data["month"]) + 1
yaml
id: evalPython
namespace: company.team
tasks:
- id: evalPython
type: io.kestra.plugin.graalvm.python.Eval
outputs:
- out
- map
script: |
import java
import java.io.File as File
import java.io.FileOutputStream as FileOutputStream
# types other than one coming from the Java SDK must be defined this way
Counter = java.type("io.kestra.core.models.executions.metrics.Counter")
logger.info('Task started')
runContext.metric(Counter.of('total', 666, 'name', 'bla'))
map = {'test': 'here'}
tempFile = runContext.workingDir().createTempFile().toFile()
output = FileOutputStream(tempFile)
output.write('Hello World'.encode('utf-8'))
out = runContext.storage().putFile(tempFile)
{"map": map, "out": out}
yaml
id: evalPython
namespace: company.team
tasks:
- id: evalPython
type: io.kestra.plugin.graalvm.python.Eval
modules:
hello.py: |
def hello(name):
return("Hello " + name)
script: |
import hello
logger.info(hello.hello("Kestra"))
Properties
script *Requiredstring
modules object
SubType string
outputs array
SubType string