Skip to main content
πŸ“˜ Complete PDF

Apache Airflow Certification Practice Test 07

Architect Review Board Questions

Question 1 of 20
πŸ“‹ Multiple Choice
Question 121
A newly joined Airflow Architect reviews a retail company's orchestration platform. Current State: - 600 DAGs - 40 developers across multiple business units - Frequent code duplication where developers copy entire DAGs and modify only a few parameters Leadership wants to lower maintenance costs and reduce technical debt. What is the BEST recommendation?
A. Create more DAG copies for each business unit
βœ“
B. Create reusable DAG frameworks, factory functions, or configuration-driven DAG generators
C. Store entire workflow logic inside Airflow Variables
D. Increase cluster worker counts continuously
Answer
βœ… B. Create reusable DAG frameworks, factory functions, or configuration-driven DAG generators
Explanation

1. Core Concept Overview Enterprise Airflow architectures scale maintainably by replacing copy-pasted DAG files with reusable DAG frameworks, factory patterns, or configuration-driven generation (e.g. YAML/JSON specifications).

2. Step-by-Step Technical Breakdown - **Option B is Correct:** DAG factory patterns abstract repetitive boilerplate (retries, alerting callbacks, connection lookups, standardized logging) into shared Python library functions. Developers define only parameters (table name, schedule, target path in YAML), drastically reducing code surface and maintenance costs. - **Option A is Incorrect:** Copying DAG files creates maintenance paralysis; bug fixes or infrastructure changes must be manually applied across hundreds of independent files. - **Option C is Incorrect:** Variables store non-sensitive configuration values, not workflow logic. Querying Variables for logic bloats the DB and causes scheduler latency. - **Option D is Incorrect:** Adding workers solves compute capacity shortages, not architectural code duplication or technical debt.

3. Why Other Options Are Incorrect - **A is an anti-pattern** that exacerbates technical debt and maintenance overhead. - **C misuses Variables** and degrades metadata database performance during scheduler parsing. - **D addresses infrastructure capacity**, not software architecture or code maintainability.

4. Architecture & Platform Execution In a DAG factory architecture, standard DAG generation logic resides in `plugins/` or a shared internal Python library. A lightweight loop parses declarative YAML configs in `dags/configs/`, instantiating DAG objects dynamically in the global namespace during scheduler parsing without duplicating operator boilerplate.

5. Practical Code Example

# dags/dag_factory.py
import yaml
from airflow import DAG
from airflow.operators.bash import BashOperator
from datetime import datetime

def create_ingestion_dag(dag_id, schedule, source_table):
    with DAG(
        dag_id=dag_id,
        schedule_interval=schedule,
        start_date=datetime(2025, 1, 1),
        catchup=False,
        tags=['factory', 'standardized']
    ) as dag:
        BashOperator(
            task_id='extract_data',
            bash_command=f"python /opt/extract.py --table {source_table}"
        )
    return dag

# Instantiate DAGs from YAML specs:
# config = yaml.safe_load(open('/opt/airflow/configs/sales.yaml'))
# globals()['sales_dag'] = create_ingestion_dag(**config)

6. Key Takeaway Standardize repetitive orchestration workflows using reusable DAG factory functions or declarative configuration generators.

7. Best Practice & Production Recommendation Maintain a common `shared_dag_utils` library for common hooks, default arguments, and alert callbacks to enforce enterprise uniformity across all teams.

8. Real-World Engineering Scenario A retail engineering department supported 450 nearly identical daily ingestion pipelines. When migrating from on-prem S3 to Snowflake, updating hardcoded operators would have taken 6 weeks. Migrating to a declarative YAML factory allowed the change in a single shared template file within hours.

9. Common Exam Trap / Anti-Pattern / Misconception Allowing teams to copy-paste monolithic DAG files across repositories. Code duplication makes global governance and library upgrades nearly impossible.

10. Related InsightfulSaga Tutorial Master these concepts in [Airflow Architecture & Operations](/tutorials/airflow/airflow-file-structure-best-practices).

Answered: 0 / 20
Question Navigator (Test 07)0% Answered