GraalVM Eval

GraalVM Eval

Certified

Execute inline JavaScript with GraalVM

Runs inline JavaScript inside the task JVM via GraalVM. Access runContext, logger, and rendered variables from the bindings; declare names in outputs to return them.

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

Execute a JavaScript script using the GraalVM scripting engine.

yaml
id: evalJs
namespace: company.team

tasks:
  - id: evalJs
    type: io.kestra.plugin.graalvm.js.Eval
    outputs:
      - out
      - map
    script: |
      (function() {
        var Counter = Java.type('io.kestra.core.models.executions.metrics.Counter');
        var File = Java.type('java.io.File');
        var FileOutputStream = Java.type('java.io.FileOutputStream');
        logger.info('Task started');
        runContext.metric(Counter.of('total', 666, 'name', 'bla'));
        map = {'test': 'here'};
        var tempFile = runContext.workingDir().createTempFile().toFile();
        var output = new FileOutputStream(tempFile);
        output.write([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]);
        out = runContext.storage().putFile(tempFile);
        return {"map": map, "out": out};
      })
Properties

Script body to execute

Template-rendered source code run by GraalVM in the selected language; flow variables are resolved 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 JavaScript script, such as the number of processed records or computed results.