我想出了同样的问题。我有每天、每小时、半小时的工作。
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
import pendulum
local_tz = pendulum.timezone("Asia/Calcutta")
args = {
'owner': 'ganesh',
'depends_on_past': False,
'start_date': datetime(2020, 3, 25, tzinfo=local_tz),
'email': ['abcd@test.com'],
'email_on_failure': True,
'email_on_retry': False,
'retries': 0,
'retry_delay': timedelta(minutes=5),
}
dag = DAG(
dag_id='test1',
default_args=args,
schedule_interval='30 00 * * *'
)
first_date = BashOperator(
task_id='first_date'
,
bash_command='date'
, dag=dag, env=None, output_encoding='utf-8')
second_date = BashOperator(
task_id='second_date'
,
bash_command='echo date'
, dag=dag, env=None, output_encoding='utf-8')
first_date >> second_date