airflow.providers.standard.sensors.bash

Module Contents

Classes

BashSensor

Executes a bash command/script.

class airflow.providers.standard.sensors.bash.BashSensor(*, bash_command, env=None, output_encoding='utf-8', retry_exit_code=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Executes a bash command/script.

Return True if and only if the return code is 0.

Parameters
  • bash_command – The command, set of commands or reference to a bash script (must be ‘.sh’) to be executed.

  • env – If env is not None, it must be a mapping that defines the environment variables for the new process; these are used instead of inheriting the current process environment, which is the default behavior. (templated)

  • output_encoding – output encoding of bash command.

  • retry_exit_code (int | None) – If task exits with this code, treat the sensor as not-yet-complete and retry the check later according to the usual retry/timeout settings. Any other non-zero return code will be treated as an error, and cause the sensor to fail. If set to None (the default), any non-zero exit code will cause a retry and the task will never raise an error except on time-out.

See also

For more information on how to use this sensor,take a look at the guide: BashSensor

template_fields: collections.abc.Sequence[str] = ('bash_command', 'env')[source]
poke(context)[source]

Execute the bash command in a temporary directory.

Was this entry helpful?