0
0
Apache Airflowdevops~10 mins

Log inspection and troubleshooting in Apache Airflow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to view the latest logs of a task instance in Airflow CLI.

Apache Airflow
airflow tasks [1] my_dag my_task 2023-06-01
Drag options to blanks, or click blank then click option'
Arun
Btrigger
Clist
Dlogs
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'logs' to view logs.
Confusing 'list' or 'trigger' commands with logs.
2fill in blank
medium

Complete the code to check the status of all tasks in a DAG run using Airflow CLI.

Apache Airflow
airflow tasks [1] my_dag 2023-06-01
Drag options to blanks, or click blank then click option'
Alist
Bstate
Clogs
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'logs' which shows logs, not task list.
Using 'state' which is not a valid subcommand.
3fill in blank
hard

Fix the error in the command to clear task instances for a DAG run.

Apache Airflow
airflow tasks [1] my_dag my_task 2023-06-01 --yes
Drag options to blanks, or click blank then click option'
Aremove
Bdelete
Cclear
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'delete' or 'remove' which are not valid Airflow commands.
Using 'reset' which does not exist.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters logs by task state.

Apache Airflow
filtered_logs = {task_id: log for task_id, log in logs.items() if task_states[task_id] [1] [2]
Drag options to blanks, or click blank then click option'
A==
B'success'
C'failed'
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' causes wrong filtering.
Filtering for 'failed' instead of 'success'.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps task IDs to logs for failed tasks.

Apache Airflow
failed_logs = { [1]: [2] for [3], [2] in logs.items() if task_states[[1]] == 'failed' }
Drag options to blanks, or click blank then click option'
Atask_id
Blog
Dtask
Attempts:
3 left
💡 Hint
Common Mistakes
Using inconsistent variable names causing errors.
Mixing up keys and values in the comprehension.