
GraalVM Eval
CertifiedExecute inline JavaScript with GraalVM
GraalVM Eval
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.
type: io.kestra.plugin.graalvm.js.EvalExamples
Execute a JavaScript script using the GraalVM scripting engine.
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 *Requiredstring
Script body to execute
Template-rendered source code run by GraalVM in the selected language; flow variables are resolved before execution
outputs array
Names of script outputs
Rendered list of member names to pull from the evaluated value or bindings and expose as task outputs
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
Outputs
outputs object
The captured outputs as declared on the outputs task property
result object
Result of the evaluated expression
Metrics
records counter
countTracks a user defined numeric value emitted from the JavaScript script, such as the number of processed records or computed results.