FileSensor for file arrival detection
📖 Scenario: You are working with Apache Airflow to automate workflows. You want to create a simple DAG that waits for a specific file to arrive in a folder before proceeding.
🎯 Goal: Build an Airflow DAG that uses FileSensor to detect when a file named data_ready.txt appears in the /tmp/ directory.
📋 What You'll Learn
Create a DAG with the id
file_sensor_dagUse
FileSensor to watch for /tmp/data_ready.txtSet the sensor's
poke_interval to 5 secondsSet the sensor's
timeout to 20 secondsAdd a dummy task
process_file that runs after the sensor💡 Why This Matters
🌍 Real World
FileSensors are used in real workflows to wait for data files to arrive before starting processing jobs, ensuring data is ready and avoiding errors.
💼 Career
Understanding sensors in Airflow is important for building reliable data pipelines and automating workflows in data engineering and DevOps roles.
Progress0 / 4 steps