
GraalVM Eval
CertifiedExecute inline Ruby with GraalVM
GraalVM Eval
Execute inline Ruby with GraalVM
Runs inline Ruby inside the task JVM via GraalVM. Import runContext, logger, and rendered variables with Polyglot.import; declare names in outputs to return them.
type: io.kestra.plugin.graalvm.ruby.EvalExamples
Execute a Ruby script using the GraalVM scripting engine.
id: evalRuby
namespace: company.team
tasks:
- id: evalRuby
type: io.kestra.plugin.graalvm.ruby.Eval
outputs:
- map
- out
script: |
Counter = Java.type('io.kestra.core.models.executions.metrics.Counter')
FileOutputStream = Java.type('java.io.FileOutputStream')
# all variables must be imported before use
logger = Polyglot.import('logger')
runContext = Polyglot.import('runContext')
logger.info('Task started')
runContext.metric(Counter.of('total', 666, 'name', 'bla'))
map = {test: 'here'}
tempFile = runContext.workingDir().createTempFile().toFile()
output = FileOutputStream.new(tempFile)
output.write('Hello World'.bytes)
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 Ruby script, such as the number of processed records or computed results.