diff --git a/dags/office/dag_office_sell_base_price.py b/dags/office/dag_office_sell_base_price.py index 82e3ef9..4465e2a 100644 --- a/dags/office/dag_office_sell_base_price.py +++ b/dags/office/dag_office_sell_base_price.py @@ -4,6 +4,7 @@ from airflow.operators.bash import BashOperator from airflow.operators.python import PythonOperator from office.sell.base_price import calc +from office.sell.fill_base_price import fill_base_price import pendulum @@ -21,9 +22,10 @@ with DAG( python_callable=calc, provide_context=True ) - # t2 = BashOperator( - # task_id='fill_base_price', - # bash_command='python /opt/airflow/dags/repo/dags/office/sell/fill_base_price.py {{dag_run.conf["yearmonth"] if "yearmonth" in dag_run.conf}}', - # ) + t2 = PythonOperator( + task_id='base_price', + python_callable=fill_base_price, + provide_context=True + ) t1 >> t2 diff --git a/dags/office/sell/fill_base_price.py b/dags/office/sell/fill_base_price.py index bfd334d..7cfc1e1 100644 --- a/dags/office/sell/fill_base_price.py +++ b/dags/office/sell/fill_base_price.py @@ -11,7 +11,7 @@ office_sell_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office office_rent_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office_rent_stat') -def calc(**kwargs): +def fill_base_price(**kwargs): """ 写字楼基准价 """ @@ -107,5 +107,5 @@ def calc_by_yearmonth(office_sell, office_rent, year_month): if __name__ == "__main__": # 测试脚本:直接运行时模拟 Airflow 的上下文 - calc(dag_run=type('DagRun', (), {'conf': {'city': '上海', 'district': '静安', 'name': '凯迪克大厦'}})) + fill_base_price(dag_run=type('DagRun', (), {'conf': {'city': '上海', 'district': '静安', 'name': '凯迪克大厦'}}))