Commit a274da2c authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

add hello world dag

parent edf0f1b0
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
from airflow import DAG
from airflow.operators.bash import BashOperator
from datetime import datetime, timedelta

default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'email': ['bozhang@nao.cas.cn'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

with DAG(
    'dag_hello_world',
    default_args=default_args,
    description='A simple tutorial DAG',
    schedule_interval=timedelta(days=1),
    start_date=datetime(2023, 1, 1),
    catchup=False,
    tags=['example'],
) as dag:
    t1 = BashOperator(
        task_id='print_date',
        bash_command='date',
    )
    t2 = BashOperator(
        task_id='sleep',
        bash_command='sleep 5',
        retries=3,
    )
    t1 >> t2