일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- airflow
- AWS
- kafkaconnect
- DataPlatform
- Linux
- 파이썬
- 설치
- 개발
- S3
- 데이터엔지니어
- python
- Kafka
- tmux
- dataengineering
- Feature Importance
Archives
- Today
- Total
GuriLogs.
[Airflow] About DAGs 본문
About Dags
기본 구조
with DAG(
dag_id,
default_args,
start_date,
description,
schedule_interval,
tags
) as dag:
def ~ ~ ~:
~ ~ ~
Operator
airflow.operators - Airflow Documentation
- DummyOperator : 아무 작업도 안함.
- BashOperator : Bash Shell 스크립트 실행
- PythonOperator : Python Code(.py) 실행
Catch Up & Backfill
- Catch Up
- Python 코드로 DAG을 작성할 때 사용(DAG 안의 파라미터), default는 False
- Backfill을 수행할 수 있는 옵션.
- False이면, start_date 기준으로 DAG 실행 (과거 무시) True이면, start_date 기준으로 과거인 모든 경우에 다 실행Catch Up
- Backfill
- DAG가 이미 배포되어 실행중일 때, 해당 DAG를 사용하여 시작 날짜 이전의 데이터를 처리하고 싶을 때 사용한다.
- 지정한 기간동안 DAG 재시작, 전체 재시작, 지정한 기간/지정한 상태 동안 전체 재시작 등을 지정하여 사용 가능.
airflow dags backfill [-h] [-c CONF] [--delay-on-limit DELAY_ON_LIMIT] [-x] [-n] [-e END_DATE] [-i] [-I] [-l] [-m] [--pool POOL] [--rerun-failed-tasks] [--reset-dagruns] [-B] [-s START_DATE] [-S SUBDIR] [-t TASK_REGEX] [-v] [-y] dag_id # 예시 airflow dags backfill -s 2021-11-01 -e 2021-11-02 example_dag
DAG parameter
Scheduling
- @once - Schedule once and only once
- @hourly - Run once an hour at the beginning of the hour 0 * * * *
- @daily - Run once a day at midnight 0 0 * * *
- @weekly - Run once a week at midnight on Sunday morning 0 0 * * 0
- @monthly - Run once a month at midnight of the first day of the month 0 0 1 * *
- @yearly - Run once a year at midnight of January 1 0 0 1 1 *
참고자료
[Airflow]Catch up, Backfill 알아보기
Airflow를 운용하다 보면, 재실행을 하거나 현재 시점 보다 과거의 배치 작업을 주기적으로 진행을 해야하거나, 실행을 했더라도 특정 조건으로 해당하는(실패나, 건너뜀 등)을 골라내서 재실행
magpienote.tistory.com
'Data Engineering > Data Platform' 카테고리의 다른 글
[Airflow] 로컬에 Airflow 설치 및 시작하기 (0) | 2023.12.03 |
---|