본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)41k · #6669

airflow-dag-patterns

하는 일

이 도구는 Apache Airflow용 자동화 워크플로(DAG라고 부름)를 만드는 데 도움을 줍니다. 작업을 정리하고, 올바르게 실행되도록 하며, 쉽게 관리할 수 있도록 하는 모범 사례를 가르칩니다.

사용하는 경우

  • ✓데이터를 옮기거나 처리하는 자동 과정을 만들 때.
  • ✓특정 순서로 실행되어야 하는 작업 묶음이 필요할 때.
  • ✓정해진 시간에 반복되어야 하는 작업을 설정하는 경우.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/data-engineering/skills/airflow-dag-patterns/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/data-engineering/skills/airflow-dag-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“매일 오전 6시에 파일을 내려받고 그다음 처리하는 워크플로를 어떻게 만들 수 있을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 작업, 그 의존성, 중요한 설정을 정의하는 방법을 보여 주는 템플릿과 코드 예시를 제공합니다. 작업을 여러 번 실행해도 문제가 없도록 하는 '멱등성(idempotence)'과, 각 작업이 명확한 결과를 가지도록 하는 '원자성(atomic)' 같은 원칙을 따릅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Apache Airflow DAG Patterns

Production-ready patterns for Apache Airflow including DAG design, operators, sensors, testing, and deployment strategies.

When to Use This Skill

  • Creating data pipeline orchestration with Airflow
  • Designing DAG structures and dependencies
  • Implementing custom operators and sensors
  • Testing Airflow DAGs locally
  • Setting up Airflow in production
  • Debugging failed DAG runs

Core Concepts

1. DAG Design Principles

Principle Description
Idempotent Running twice produces same result
Atomic Tasks succeed or fail completely
Incremental Process only new/changed data
Observable Logs, metrics, alerts at every step

2. Task Dependencies

# Linear
task1 >> task2 >> task3

# Fan-out
task1 >> [task2, task3, task4]

# Fan-in
[task1, task2, task3] >> task4

# Complex
task1 >> task2 >> task4
task1 >> task3 >> task4

Quick Start

# dags/example_dag.py
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.python import PythonOperator
from airflow.operators.empty import EmptyOperator

default_args = {
    'owner': 'data-team',
    'depends_on_past': False,
    'email_on_failure': True,
    'email_on_retry': False,
    'retries': 3,
    'retry_delay': timedelta(minutes=5),
    'retry_exponential_backoff': True,
    'max_retry_delay': timedelta(hours=1),
}

with DAG(
    dag_id='example_etl',
    default_args=default_args,
    description='Example ETL pipeline',
    schedule='0 6 * * *',  # Daily at 6 AM
    start_date=datetime(2024, 1, 1),
    catchup=False,
    tags=['etl', 'example'],
    max_active_runs=1,
) as dag:

    start = EmptyOperator(task_id='start')

    def extract_data(**context):
        execution_date = context['ds']
        # Extract logic here
        return {'records': 1000}

    extract = PythonOperator(
        task_id='extract',
        python_callable=extract_data,
    )

    end = EmptyOperator(task_id='end')

    start >> extract >> end

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

Do's

  • Use TaskFlow API - Cleaner code, automatic XCom
  • Set timeouts - Prevent zombie tasks
  • Use mode='reschedule' - For sensors, free up workers
  • Test DAGs - Unit tests and integration tests
  • Idempotent tasks - Safe to retry

Don'ts

  • Don't use depends_on_past=True - Creates bottlenecks
  • Don't hardcode dates - Use {{ ds }} macros
  • Don't use global state - Tasks should be stateless
  • Don't skip catchup blindly - Understand implications
  • Don't put heavy logic in DAG file - Import from modules
자주 묻는 질문

DAG란 무엇인가요?

'Directed Acyclic Graph(방향성 비순환 그래프)'의 약자입니다. 해야 할 작업과 그 순서를 보여 주는 지도로 생각하면 되며, 루프가 없습니다. 즉 시작점으로 되돌아가지 않습니다.

작업이 '멱등성'을 가져야 하는 이유는 무엇인가요?

멱등성은 작업을 여러 번 연속 실행해도 한 번 실행한 것과 같은 결과가 나온다는 뜻입니다. 작업이 실패해 다시 시작해도 최종 결과가 바뀌지 않으므로 신뢰성에 매우 중요합니다.

'연산자(operators)'와 '센서(sensors)'란 무엇인가요?

연산자는 DAG의 기본 구성 요소로, 파이썬 스크립트 실행처럼 수행할 동작을 나타냅니다. 센서는 무언가 일어나기를 기다린 뒤 진행하는 특별한 종류의 연산자입니다(예: 파일이 도착하기를 기다림).

상세 정보

작성자의 원본 설명

Build production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6669
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬