ProcessTaskRunner ProcessTaskRunner

yaml
type: "io.kestra.core.models.tasks.runners.types.ProcessTaskRunner"

Task runner that executes a task as a subprocess on the Kestra host.

To access the task's working directory, use the Pebble expression or the WORKING_DIR environment variable. Input files and namespace files will be available in this directory.

To generate output files you can either use the outputFiles task's property and create a file with the same name in the task's working directory, or create any file in the output directory which can be accessed by the Pebble expression or the OUTPUT_DIR environment variables.

Note that when the Kestra Worker running this task is terminated, the process will be interrupted and re-created at worker restart.

Examples

Execute a Shell command.

yaml
id: new-shell
namespace: myteam

tasks:
  - id: shell
    type: io.kestra.plugin.scripts.shell.Commands
    taskRunner:
      type: io.kestra.core.models.tasks.runners.types.ProcessTaskRunner
    commands:
    - echo "Hello World"

Pass input files to the task, execute a Shell command, then retrieve output files.

yaml
id: new-shell-with-file
namespace: myteam

inputs:
  - id: file
    type: FILE

tasks:
  - id: shell
    type: io.kestra.plugin.scripts.shell.Commands
    inputFiles:
      data.txt: "{{inputs.file}}"
    outputFiles:
      - out.txt
    taskRunner:
      type: io.kestra.core.models.tasks.runners.types.ProcessTaskRunner
    commands:
    - cp {{workingDir}}/data.txt {{workingDir}}/out.txt