This plugin is currently in beta. While it is considered safe for use, please be aware that its API could change in ways that are not compatible with earlier versions in future releases, or it might become unsupported.
Execute a Python script using the GraalVM scripting engine.
type: "io.kestra.plugin.graalvm.python.Eval"
Parse a downloaded JSON and update one of its fields.
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
Execute a Python script using the GraalVM scripting engine.
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}
Define a Python module, then execute a script that imports this module using the GraalVM scripting engine.
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"))
YES
The script to evaluate
YES
Python modules to add into the Python module path.
The key is the name of the module file, the value is the content of the module file an internal storage URI
YES
A List of outputs variables that will be usable in outputs.
The captured outputs as declared on the outputs
task property.