GraalVM Eval

GraalVM Eval

Certified

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.

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

Execute a Ruby script using the GraalVM scripting engine.

yaml
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 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 Ruby script, such as the number of processed records or computed results.