Challenge - 5 Problems
FileSensor Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What does this FileSensor detect?
Given the following Airflow FileSensor configuration, what file event is it waiting for?
Apache Airflow
file_sensor = FileSensor(
task_id='wait_for_file',
filepath='/data/input/data_ready.txt',
poke_interval=30,
timeout=600
)Attempts:
2 left
💡 Hint
FileSensor checks for the presence of a file at the given path.
✗ Incorrect
FileSensor waits for a file to appear at the specified filepath. It does not detect deletion or modification events.
❓ Configuration
intermediate2:00remaining
Choose the correct FileSensor timeout setting
You want the FileSensor to stop waiting after 5 minutes if the file does not appear. Which timeout value should you set?
Attempts:
2 left
💡 Hint
Timeout is in seconds.
✗ Incorrect
Timeout is specified in seconds. 5 minutes equals 300 seconds.
🔀 Workflow
advanced2:00remaining
How does FileSensor behave with poke_interval?
If a FileSensor has poke_interval=10 and timeout=60, how many times will it check for the file before timing out?
Attempts:
2 left
💡 Hint
Divide timeout by poke_interval to find the number of checks.
✗ Incorrect
The sensor checks every 10 seconds up to 60 seconds, so 60/10 = 6 checks.
❓ Troubleshoot
advanced2:00remaining
Why does FileSensor keep timing out without detecting the file?
You configured a FileSensor to watch '/tmp/data.csv' but it always times out. The file is created by another process. What could be a common cause?
Attempts:
2 left
💡 Hint
Check the exact file path the other process writes to.
✗ Incorrect
If the file is created in a different directory or path than the one the sensor watches, it will never detect it and time out.
✅ Best Practice
expert2:00remaining
What is the best practice to avoid blocking Airflow workers with FileSensor?
FileSensors can block workers while waiting for files. Which approach is best to avoid this problem?
Attempts:
2 left
💡 Hint
The 'reschedule' mode releases the worker slot while waiting.
✗ Incorrect
Setting mode='reschedule' makes the sensor task free the worker slot between pokes, improving resource usage.