FileSensor¶
使用 FileSensor
来检测本地文件系统中出现的文件。你需要定义一个连接才能使用它(通过 fs_conn_id
传递连接 ID)。默认连接为 fs_default
。
airflow/example_dags/example_sensors.py
t6 = FileSensor(task_id="wait_for_file", filepath="/tmp/temporary_file_for_testing")
此外,对于此作业,你可以在可延迟模式下使用 Sensor
airflow/example_dags/example_sensors.py
t7 = FileSensor(
task_id="wait_for_file_async", filepath="/tmp/temporary_file_for_testing", deferrable=True
)