0
0
Apache Airflowdevops~20 mins

Task documentation and tags in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Airflow Task Documentation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Purpose of task documentation in Airflow

Why is it important to add documentation to Airflow tasks?

ATo provide clear explanations for task behavior and improve maintainability
BTo increase the execution speed of the task
CTo automatically retry failed tasks
DTo reduce the number of tasks in a DAG
Attempts:
2 left
💡 Hint

Think about how documentation helps others understand the task.

💻 Command Output
intermediate
1:30remaining
Output of task tags in Airflow UI

What is the visible effect of adding tags to an Airflow task in the Airflow UI?

Apache Airflow
from airflow import DAG
from airflow.operators.dummy import DummyOperator
from datetime import datetime
with DAG('example_dag', start_date=datetime(2024,1,1)) as dag:
    task = DummyOperator(task_id='dummy_task', tags=['tag1', 'tag2'])
AThe tags appear as clickable labels next to the task in the Airflow UI
BThe tags change the task execution order
CThe tags cause the task to run multiple times
DThe tags are not shown anywhere in the Airflow UI
Attempts:
2 left
💡 Hint

Tags help organize and filter tasks visually.

Configuration
advanced
2:00remaining
Correct way to add documentation to an Airflow task

Which code snippet correctly adds documentation to an Airflow task using the doc_md attribute?

Atask = DummyOperator(task_id='task1', doc_string='This task does nothing.')
Btask = DummyOperator(task_id='task1', doc_md='''This task does nothing.''')
Ctask = DummyOperator(task_id='task1', doc='This task does nothing.')
Dtask = DummyOperator(task_id='task1', documentation='This task does nothing.')
Attempts:
2 left
💡 Hint

Check the exact attribute name Airflow expects for markdown documentation.

Troubleshoot
advanced
2:00remaining
Why task tags are not visible in Airflow UI

You added tags to your Airflow tasks but they do not appear in the Airflow UI. What is the most likely cause?

ATags only appear if the DAG is paused
BThe tags attribute must be a string, not a list
CThe Airflow version is older than 2.0 which does not support task tags
DTags require a special plugin to be visible
Attempts:
2 left
💡 Hint

Check the Airflow version compatibility for task tags.

Best Practice
expert
2:30remaining
Recommended practice for documenting complex Airflow tasks

For a complex Airflow task with multiple steps and conditions, what is the best practice for documentation?

ASkip documentation to avoid clutter
BAdd a short comment in the DAG file only
CRely on task_id naming to explain the task
DUse <code>doc_md</code> with detailed markdown including code snippets and explanations
Attempts:
2 left
💡 Hint

Think about clarity and maintainability for others reading the task.