airflow.sensors.filesystem

Module Contents

Classes

FileSensor

Waits for a file or folder to land in a filesystem.

class airflow.sensors.filesystem.FileSensor(*, filepath, fs_conn_id='fs_default', recursive=False, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), start_from_trigger=False, trigger_kwargs=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Waits for a file or folder to land in a filesystem.

If the path given is a directory then this sensor will only return true if any files exist inside it (either directly, or within a subdirectory)

Parameters
  • fs_conn_id – reference to the File (path) connection id

  • filepath – File or folder name (relative to the base path set within the connection), can be a glob.

  • recursive – when set to True, enables recursive directory matching behavior of ** in glob filepath parameter. Defaults to False.

  • deferrable (bool) – If waiting for completion, whether to defer the task until done, default is False.

  • start_from_trigger (bool) – Start the task directly from the triggerer without going into the worker.

  • trigger_kwargs (dict[str, Any] | None) – The keyword arguments passed to the trigger when start_from_trigger is set to True during dynamic task mapping. This argument is not used in standard usage.

See also

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

template_fields: Sequence[str] = ('filepath',)[source]
ui_color = '#91818a'[source]
start_trigger_args[source]
start_from_trigger = False[source]
path()[source]
poke(context)[source]

Override when deriving this class.

execute(context)[source]

Derive when creating an operator.

Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

execute_complete(context, event=None)[source]

Was this entry helpful?