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

add example dags

parent ac7e05c6
Loading
Loading
Loading
Loading
+34 −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),
    "params": {"example_param": "example_value", "a": 1, "b": 2, "c": 3},
}

with DAG(
    dag_id="dag_hello_world",
    default_args=default_args,
    description="A simple tutorial DAG",
    start_date=datetime(2023, 1, 1),
    schedule="@daily",
    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