12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- #!/usr/bin/env python
- #coding=utf-8
- from airflow.models import DAG
- from airflow.operators.bash_operator import BashOperator
- def idl_subdag(parent_dag_name, child_dag_name, args):
- idl_subdag = DAG(
- dag_id='%s.%s' % (parent_dag_name, child_dag_name),
- default_args=args,
- schedule_interval='@daily',
- )
- # 收视率趋势
- BashOperator(
- task_id='idl_trending-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_trending.py',
- default_args=args,
- dag=idl_subdag,
- )
- # 类型统计
- BashOperator(
- task_id='idl_tv_station_type_stat-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_tv_station_type_stat.py',
- default_args=args,
- dag=idl_subdag,
- )
- # 收视指数统计
- BashOperator(
- task_id='idl_tv_station_ratings_index_stat-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_tv_station_ratings_index_stat.py',
- default_args=args,
- dag=idl_subdag,
- )
- # 电视台推荐
- BashOperator(
- task_id='idl_tv_station_recommend-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_tv_station_recommend.py',
- default_args=args,
- dag=idl_subdag,
- )
- # 电视台收视率统计
- BashOperator(
- task_id='idl_ad_television_stat-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_ad_television_stat.py',
- default_args=args,
- dag=idl_subdag,
- )
- # 备案发行数据
- BashOperator(
- task_id='idl_ad_tv_record_distribution-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_ad_tv_record_distribution.py',
- default_args=args,
- dag=idl_subdag,
- )
- # idl_tv_station_rank
- BashOperator(
- task_id='idl_tv_station_rank-task',
- bash_command='cd /Users/wudancheng/huoju/code/huoju_fty/py_script; python idl_tv_station_rank.py',
- default_args=args,
- dag=idl_subdag,
- )
-
- return idl_subdag
|