[Airflow] Release Notes - 2.4.x
안녕하세요 마개입니다.
2022년 09월 19일에 적용된 Airflow 2.4 버전에서의 변경사항은 무엇이 있었는지 공식 홈페이지를 통해 알아봅니다. 메이저한 변경사항에 대해만 알아보고 버그 수정 부분은 생략합니다. 자세한 것은 공식 홈페이지를 통해 확인합니다.
- 참고 URL : 공식 홈페이지
메인 변경사항
1. Dataset
이라는 새로운 개념과 Data-aware
스케줄링이 추가되었습니다.
스케줄링 방법 중에서 dataset
이 업데이트되면 실행되는 방법입니다.
- 참고 URL
2. context manager에서 사용되는 DAG들은 더이상 변수로 할당하지 않아도 됩니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# AS-IS
with DAG(dag_id="example") as dag:
...
@dag
def dag_maker():
...
dag2 = dag_maker()
# TO-BE
with DAG(dag_id="example"):
...
@dag
def dag_maker():
...
dag_maker()
만약에 위와 같이 자동으로 지정되는 것이 싫다면 auto_register=False
를 지정하면 됩니다.
1
2
3
# This dag will not be picked up by Airflow as it's not assigned to a variable
with DAG(dag_id="example", auto_register=False):
...
3. schedule_interval
과 timetable
argument는 더이상 사용되지 않습니다.
대신 schedule
이라는 argument를 추가하여 cron 표현식이나 timedelta 객체, timetable 객체 또는 dataset 객체들을 수용할 수 있습니다.
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
# AS-IS
with DAG(
dag_id="my_example",
start_date=datetime(2021, 1, 1),
schedule_interval="@daily",
):
...
with DAG(
dag_id="my_example",
start_date=datetime(2021, 1, 1),
timetable=EventsTimetable(event_dates=[pendulum.datetime(2022, 4, 5)]),
):
...
# TO-BE
with DAG(
dag_id="my_example",
start_date=datetime(2021, 1, 1),
schedule="@daily",
):
...
with DAG(
dag_id="my_example",
start_date=datetime(2021, 1, 1),
schedule=EventsTimetable(event_dates=[pendulum.datetime(2022, 4, 5)]),
):
...