DAG: eod_market_data_update_dag eod_market_data_update dag

schedule: None


eod_market_data_update_dag

 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
# -*- coding: utf-8 -*-

import os
from airflow import DAG
from airflow.operators.python_operator import PythonOperator

from eod_pd import *

# -------------------------------------------------------------------------------
# dag
# these args will get passed on to each operator
# you can override them on a per-task basis during operator initialization

#set env variable "MKT_DATA = on" to turn on this dag

default_args = {
    'owner': 'TongYu',
    'catchup': False,
    'start_date': utils.trans_utc_datetime('0:00:00'),
}
dag = DAG(
    'eod_market_data_update_dag',
    catchup=False,
    default_args=default_args,
    schedule_interval='0,1 7 * * 1-5' if os.environ.get('MKT_DATA',None) == 'on' else None,
    dagrun_timeout=timedelta(minutes=15),
    description='eod_market_data_update dag')

eod_market_data_update_operator = PythonOperator(
    task_id='eod_market_data_update_task',
    python_callable=eod_market_data,
    execution_timeout=timedelta(minutes=5),
    dag=dag)