airflow.providers.standard.triggers.file¶
Attributes¶
Classes¶
A trigger that fires exactly once after it finds the requested file or folder. |
|
A trigger that fires exactly once after it finds the requested file and then delete the file. |
|
Fire once when |
Module Contents¶
- class airflow.providers.standard.triggers.file.FileTrigger(filepath, recursive=False, poke_interval=5.0, **kwargs)[source]¶
Bases:
airflow.triggers.base.BaseTriggerA trigger that fires exactly once after it finds the requested file or folder.
- Parameters:
filepath (str) – File or folder name (relative to the base path set within the connection), can be a glob.
recursive (bool) – when set to
True, enables recursive directory matching behavior of**in glob filepath parameter. Defaults toFalse.poke_interval (float) – Time that the job should wait in between each try
- class airflow.providers.standard.triggers.file.FileDeleteTrigger(filepath, poke_interval=5.0, **kwargs)[source]¶
Bases:
airflow.triggers.base.BaseEventTriggerA trigger that fires exactly once after it finds the requested file and then delete the file.
The difference between
FileTriggerandFileDeleteTriggerisFileDeleteTriggercan only find a specific file.- Parameters:
- class airflow.providers.standard.triggers.file.DirectoryFileDeleteTrigger(*, directory, filename, poke_interval=5.0)[source]¶
Bases:
airflow.triggers.base.BaseEventTriggerFire once when
filenameappears indirectory, then delete it.Functionally equivalent to
FileDeleteTriggerfor a single file, but sibling triggers that point at the samedirectoryandpoke_intervalshare a single underlying directory scan in the triggerer; each instance only fires for its ownfilename. This is useful when many assets are driven by per-flag-file events landing in a shared inbox directory.- Parameters:
All triggers on the same directory + cadence share one scan.
- Async:
Drive one directory-listing loop and broadcast each snapshot.
Missing directories yield an empty snapshot so subscribers keep polling for the file to appear. Configuration-class failures (
PermissionError,NotADirectoryError,IsADirectoryError) propagate — these are almost always permanent (wrong mount, wrong mode, path points at a file), so silently retrying just hides the misconfiguration from the operator; surfacing them as a_PollFailuremakes the trigger visibly fail in the UI, where it can be diagnosed and restarted after the operator corrects the config. OtherOSErrorsubclasses (transient I/O blips, NFS hiccups, etc.) are logged at warning and the snapshot is skipped for this cadence, since those may self-heal.
Fire once for this instance’s own filename and delete the file.