R CommandsTrigger

R CommandsTrigger

Certified

Trigger a flow when R commands match a condition

Polls by running R commands in a container (default image 'r-base') and starts the flow when their result matches the condition.

yaml
type: io.kestra.plugin.scripts.r.CommandsTrigger

Trigger when an R command fails.

yaml
id: r_commands_trigger
namespace: company.team

triggers:
  - id: on_fail
    type: io.kestra.plugin.scripts.r.CommandsTrigger
    interval: PT5S
    exitCondition: "exit 1"
    commands:
      - Rscript -e 'stop("boom")'

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Triggered with exitCode={{ trigger.exitCode }} (condition={{ trigger.condition }})"
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-script-r --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

For Kestra CLI, replace LATEST with a specific version or version range to pin the plugin version.

Properties
SubTypestring

R commands to execute

Commands executed in order on each poll.

Condition to match

Condition evaluated after execution.

Supported forms:

  • 'exit N'
  • regex / substring matched against vars + logs
Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Defaultr-base

Docker image used to execute the commands

Container image used by the underlying Commands task to run R commands. Defaults to 'r-base'.

Defaulttrue

Edge trigger mode

When true (default), emit only on a transition from not matching to matching, so a condition that stays true does not fire on every poll. The previous result is kept in the namespace KV store, keyed by flow and trigger id. When false, emit on every poll that matches.

DefaultPT1M
Formatduration

Check interval

Interval between polling evaluations.

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Rendered condition

Rendered value of the exitCondition property for this poll.

Commands exit code

Exit code returned by the R process (may be null if not available).

Formatdate-time

Poll timestamp

Timestamp when this trigger evaluation occurred.

Commands vars

Vars produced by the task (e.g. via ::{"outputs": {...}}:: convention). This is the main structured way to evaluate non-exit conditions on successful runs.