Execute a Python script using the GraalVM scripting engine.

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

The script to evaluate

SubType string

Python modules to add into the Python module path.

The key is the name of the module file, the value is the content of the module file an internal storage URI

SubType string

A List of outputs variables that will be usable in outputs.

The captured outputs as declared on the outputs task property.