31 lines
834 B
Python
31 lines
834 B
Python
from datetime import datetime, timedelta
|
|
from textwrap import dedent
|
|
|
|
from airflow import DAG
|
|
from airflow.operators.bash import BashOperator
|
|
|
|
# These args will get passed on to each operator
|
|
# You can override them on a per-task basis during operator initialization
|
|
default_args = {
|
|
'owner': '王文艳',
|
|
'depends_on_past': False,
|
|
'email': ['wangwenyan@fangjia.com'],
|
|
'email_on_failure': False,
|
|
'email_on_retry': False,
|
|
'retries': 1,
|
|
'retry_delay': timedelta(minutes=5),
|
|
}
|
|
with DAG(
|
|
'定时样例',
|
|
default_args=default_args,
|
|
description='A simple tutorial DAG',
|
|
schedule_interval=timedelta(minutes=1),
|
|
start_date=datetime(2021, 1, 1),
|
|
catchup=False,
|
|
tags=['样例'],
|
|
) as dag:
|
|
t1 = BashOperator(
|
|
task_id='print_date_demo',
|
|
bash_command='date',
|
|
)
|
|
t1 |