调用带有参数并从bashoperator返回的函数

时间:2019-09-04 15:20:14

标签: airflow

我有这个

restart

BashOperator( task_id=( dag_id + "_extract" ).lower(), bash_command="python /usr/local/airflow/txd-mfp-extract.py {{ params.query }} {{ params.file }} {{ params.monday }} {{ params.sunday }}", on_success_callback=on_success_alert, on_failure_callback=on_failure_alert, params={ 'query': query_name, 'file': file_name, 'monday': get_monday, 'sunday': get_sunday, }, dag=dag) get_monday是函数de <get_sunday的返回值,我该怎么做?

1 个答案:

答案 0 :(得分:1)

您需要调用该函数SELECT t.* FROM ( SELECT [SummaryTbl].[WORK_ITEM_NMB], [SummaryTbl].[WORK_ITEM_STS], [SummaryTbl].[RELEASE_NMB], [SummaryTbl].[NOMADS_PRIORITY], [SummaryTbl].[TEST_ACTUAL_DT], [SummaryTbl].[TRAIN_ACTUAL_DT], [SummaryTbl].[TITLE], [SummaryTbl].[DESCRIPTION], [SummaryTbl].[DETAILED_RQ_COMMENTS], [SummaryTbl].[TRAIN_COMMENTS], [SummaryTbl].[TEST_COMMENTS], [ParentChildTbl].[HasAssocWI] FROM SummaryTbl LEFT JOIN ParentChildTbl ON [SummaryTbl].[WORK_ITEM_NMB] = [ParentChildTbl].[WORK_ITEM_NMB] UNION SELECT [ParentChildTbl].[WORK_ITEM_NMB], [SummaryTbl].[WORK_ITEM_STS], [SummaryTbl].[RELEASE_NMB], [SummaryTbl].[NOMADS_PRIORITY], [SummaryTbl].[TEST_ACTUAL_DT], [SummaryTbl].[TRAIN_ACTUAL_DT], [SummaryTbl].[TITLE], [SummaryTbl].[DESCRIPTION], [SummaryTbl].[DETAILED_RQ_COMMENTS], [SummaryTbl].[TRAIN_COMMENTS], [SummaryTbl].[TEST_COMMENTS], [ParentChildTbl].[HasAssocWI] FROM SummaryTbl RIGHT JOIN ParentChildTbl ON [SummaryTbl].[WORK_ITEM_NMB] = [ParentChildTbl].[WORK_ITEM_NMB] ) t WHERE t.[WORK_ITEM_NMB] > 2500 而不是get_monday()。还有get_monday而不是get_sunday()

get_sunday