Skip to content

Instantly share code, notes, and snippets.

@momota10s
Last active November 12, 2021 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save momota10s/c14e9c78ef248b7334914fdc37f24b87 to your computer and use it in GitHub Desktop.
Save momota10s/c14e9c78ef248b7334914fdc37f24b87 to your computer and use it in GitHub Desktop.
Apache AirflowのDAGサンプル
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