GraalVM Eval

GraalVM Eval

Certified

Execute inline Python with GraalVM

Runs inline Python inside the task JVM via GraalVM. Access runContext, logger, and rendered variables from the bindings; declare names in outputs to return them. Allows file I/O and host class access restricted to java.* and io.kestra.core.models.*. Optional modules preload Python files from content or kestra:// URIs onto the module path.

yaml
type: io.kestra.plugin.graalvm.python.Eval

Parse a downloaded JSON and update one of its fields.

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

Execute a Python script using the GraalVM scripting engine.

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}

Define a Python module, then execute a script that imports this module using the GraalVM scripting engine.

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 body to execute

Template-rendered source code run by GraalVM in the selected language; flow variables are resolved before execution

Inline Python modules to preload

Map of filename to module content or a kestra:// URI; files are written to a temporary module path before execution

SubTypestring

Names of script outputs

Rendered list of member names to pull from the evaluated value or bindings and expose as task outputs

Reference (ref) of the pluginDefaults to apply to this task.

The captured outputs as declared on the outputs task property

Result of the evaluated expression

Unitcount

Tracks a user defined numeric value emitted from the Python script, such as the number of processed records or computed results.