Add dags/soosoo/sidecar_test.py
This commit is contained in:
parent
09e315de65
commit
78a320dd44
36
dags/soosoo/sidecar_test.py
Normal file
36
dags/soosoo/sidecar_test.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import time
|
||||||
|
import pendulum
|
||||||
|
from datetime import datetime
|
||||||
|
from airflow import DAG
|
||||||
|
from airflow.operators.python import PythonOperator
|
||||||
|
|
||||||
|
KST = pendulum.timezone('Asia/Seoul')
|
||||||
|
|
||||||
|
def task1():
|
||||||
|
print('Task 1 execute time ', datetime.now(tz=KST).strftime('%Y-%m-%d %H-%M-%S'))
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
def task2():
|
||||||
|
print('Task 2 execute time ', datetime.now(tz=KST).strftime('%Y-%m-%d %H-%M-%S'))
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
def task3():
|
||||||
|
print('Task 3 execute time ', datetime.now(tz=KST).strftime('%Y-%m-%d %H-%M-%S'))
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
def task4():
|
||||||
|
print('Task 4 execute time ', datetime.now(tz=KST).strftime('%Y-%m-%d %H-%M-%S'))
|
||||||
|
|
||||||
|
with DAG(
|
||||||
|
dag_id='sidecar_test',
|
||||||
|
default_args={'retries': 1},
|
||||||
|
schedule='@once',
|
||||||
|
start_date=datetime(2025, 8, 11, tzinfo=KST),
|
||||||
|
catchup=False,
|
||||||
|
) as dag:
|
||||||
|
t1 = PythonOperator(task_id='task1', python_callable=task1)
|
||||||
|
t2 = PythonOperator(task_id='task2', python_callable=task2)
|
||||||
|
t3 = PythonOperator(task_id='task3', python_callable=task3)
|
||||||
|
t4 = PythonOperator(task_id='task4', python_callable=task4)
|
||||||
|
|
||||||
|
t1 >> t2 >> t3 >> t4
|
||||||
Loading…
Reference in New Issue
Block a user