Skip to content

Commit

Permalink
Update dags
Browse files Browse the repository at this point in the history
  • Loading branch information
heumsi committed Jan 29, 2024
1 parent c648c2a commit 860f131
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
11 changes: 4 additions & 7 deletions 01-batch-serving(airflow)/dags/01-bash-operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
# 'priority_weight': 10 # DAG의 우선 순위를 설정할 수 있음
# 'end_date': datetime(2022, 4, 24) # DAG을 마지막으로 실행할 Date
# 'execution_timeout': timedelta(seconds=300), # 실행 타임아웃 : 300초 넘게 실행되면 종료
# 'on_failure_callback': some_function # 만약에 Task들이 실패하면 실행할 함수
# 'on_success_callback': some_other_function
# 'on_retry_callback': another_function
}

# with 구문으로 DAG 정의
with DAG(
dag_id='bash_dag',
default_args=default_args,
schedule_interval='@once',
tags=['my_dags']
dag_id='bash_dag',
default_args=default_args,
schedule_interval='@once',
tags=['my_dags']
) as dag:
# BashOperator 사용
task1 = BashOperator(
Expand Down
8 changes: 4 additions & 4 deletions 01-batch-serving(airflow)/dags/02-python-operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def print_current_date():

# with 구문으로 DAG 정의
with DAG(
dag_id='python_dag1',
default_args=default_args,
schedule_interval='30 0 * * *', # UTC 시간 기준 0시 30분에 Daily로 실행하겠다! 한국 시간 기준 오전 9시 30분
tags=['my_dags']
dag_id='python_dag1',
default_args=default_args,
schedule_interval='30 0 * * *', # UTC 시간 기준 0시 30분에 Daily로 실행하겠다! 한국 시간 기준 오전 9시 30분
tags=['my_dags']
) as dag:
python_task = PythonOperator(
task_id='print_current_date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def print_current_date_with_context_variable(*args, **kwargs):

# with 구문으로 DAG 정의
with DAG(
dag_id='python_dag_with_context',
default_args=default_args,
schedule_interval='30 0 * * *',
tags=['my_dags']
dag_id='python_dag_with_context',
default_args=default_args,
schedule_interval='30 0 * * *',
tags=['my_dags']
) as dag:
PythonOperator(
task_id='print_current_date_with_context_variable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def print_current_date_with_jinja(date):

# with 구문으로 DAG 정의
with DAG(
dag_id='python_dag_with_jinja',
default_args=default_args,
schedule_interval='30 0 * * *',
tags=['my_dags']
dag_id='python_dag_with_jinja',
default_args=default_args,
schedule_interval='30 0 * * *',
tags=['my_dags']
) as dag:
execution_date = "{{ ds }}" # Template 정의

Expand Down

0 comments on commit 860f131

Please sign in to comment.