Untitled
unknown
python
a year ago
1.0 kB
3
Indexable
import logging from datetime import datetime, timedelta from airflow import DAG from airflow.operators.bash import BashOperator from airflow.operators.python import PythonOperator with DAG( "my_first_dag", default_args={ "depends_on_past": False, "email": ["airflow@example.com"], "email_on_failure": False, "email_on_retry": False, "retries": 1, "retry_delay": timedelta(minutes=5), }, description="My First DAG", schedule_interval="0 7 * * *", # Каждый день в 07:00 UTC start_date=datetime(2023, 10, 30), 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, ) def t3_func(): logging.info("Hello World!") t3 = PythonOperator( task_id="hello_world", python_callable=t3_func, ) t1 >> t2 >> t3
Editor is loading...