1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # -*- coding: utf-8 -*-
import airflow
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import timedelta
from ctp.ctp_instrument import *
# -------------------------------------------------------------------------------
# dag
# these args will get passed on to each operator
# you can override them on a per-task basis during operator initialization
default_args = {
'owner': 'TongYu',
'catchup': False,
'start_date': airflow.utils.dates.days_ago(1),
}
dag = DAG(
'ctp_instrument_dag',
catchup=False,
default_args=default_args,
schedule_interval='55 8 * * 1-5',
dagrun_timeout=timedelta(minutes=15),
description='ctp_instrument_task dag')
# -------------------------------------------------------------------------------
ctp_operator = PythonOperator(
task_id='update_ctp_instruments_task',
python_callable=update_ctp_instruments_run,
execution_timeout=timedelta(minutes=15),
dag=dag)
|