airflow添加新任务

配置执行命令

path:/home/airflow/dsp-airflow/dsp_airflow/conf/dsp_airflow.cfg
#anti-fraud
dir_anti_fraud = %(project_dir)santi-fraud
script_anti_fraud = run_daily.sh

修改调度文件

path:/home/airflow/dsp-airflow/dsp_airflow/dags/dsp_daily_production.py

1
dir_dsp_simple = get_dsp_config(section=command_tag, option='dir_dsp_simple')
script_dsp_simple = get_dsp_config(section=command_tag, option='script_dsp_simple')
dir_anti_fraud = get_dsp_config(section=command_tag, option='dir_anti_fraud')
script_anti_fraud = get_dsp_config(section=command_tag, option='script_anti_fraud')


2
local_dsp_simple_daily_taskid = "local_dsp_simple_daily"
local_anti_fraud_daily_taskid = "local_anti_fraud_daily"


3
local_dsp_simple_daily = gen_report_task(parent_dag=dag, task_id_str=local_dsp_simple_daily_taskid,
                                         command=command_template.format(username=LINUX_USER,
                                                                         dir=dir_dsp_simple,
                                                                         script=script_dsp_simple,
                                                                         paras=" -%sd %s" % (test_option,
                                                                                             day_interval_between_execution_and_now))
                                         )
local_anti_fraud_daily = gen_report_task(parent_dag=dag, task_id_str=local_anti_fraud_daily_taskid,
                                         command=command_template.format(username=LINUX_USER,
                                                                         dir=dir_anti_fraud,
                                                                         script=script_anti_fraud,
                                                                         paras="{{ ds }}")
                                         )


4
# local dsp simple daily
local_dsp_simple_daily.set_upstream(is_local_dsp_simple_hourly_all_ready)
local_dsp_simple_daily.set_downstream(end_task)
# local anti fraud daily
local_anti_fraud_daily.set_upstream([is_local_dsp_info_hourly_all_ready, is_local_dsp_simple_hourly_all_ready])
local_anti_fraud_daily.set_downstream(end_task)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值