Last active
November 12, 2021 08:54
-
-
Save momota10s/c14e9c78ef248b7334914fdc37f24b87 to your computer and use it in GitHub Desktop.
Apache AirflowのDAGサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.python import PythonOperator | |
from airflow.operators.bash import BashOperator | |
from datetime import datetime | |
def test_func(): | |
print('Hello from test_func') | |
default_args = { | |
'owner': 'momota', | |
'start_date': datetime(2018, 10, 1), | |
} | |
with DAG( | |
'momota-demo-dag', | |
default_args=default_args, | |
schedule_interval='0 18 * * *', | |
catchup=False ) as dag: | |
task1 = BashOperator( | |
task_id='task1', | |
bash_command='sleep 1' | |
) | |
task2 = BashOperator( | |
task_id='task2', | |
bash_command='sleep 2' | |
) | |
task3 = BashOperator( | |
task_id='task3', | |
bash_command='sleep 3' | |
) | |
task4 = PythonOperator( | |
task_id='task4', | |
python_callable=test_func | |
) | |
task5 = PythonOperator( | |
task_id='task5', | |
python_callable=test_func | |
) | |
task1 >> task2 >> task3 | |
task4 >> task3 | |
task3 >> task5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment