diff --git a/dags/office/dag_office_base_price.py b/dags/office/dag_office_base_price.py index 6d83a90..fbcfc75 100644 --- a/dags/office/dag_office_base_price.py +++ b/dags/office/dag_office_base_price.py @@ -16,7 +16,7 @@ with DAG( ) as dag: t1 = BashOperator( task_id='base_price', - bash_command='python /opt/airflow/dags/repo/dags/office/rent/base_price.py', + bash_command='python /opt/airflow/dags/repo/dags/office/rent/base_price.py {{dag_run.conf["yearmonth"] if "yearmonth" in dag_run.conf}}', ) t1 diff --git a/dags/office/rent/base_price.py b/dags/office/rent/base_price.py index 555e0e1..7751c35 100644 --- a/dags/office/rent/base_price.py +++ b/dags/office/rent/base_price.py @@ -16,6 +16,7 @@ from datetime import datetime from pymongo import UpdateOne import math import numpy as np +import sys es = ElasticSearchClient(host='192.168.0.206') seaweed_df = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed') @@ -304,7 +305,6 @@ def calc(city, year_month): actions.clear() office_rent_stat_conn.bulk_write(actions) -for year_month in range(202406, 202501): - print(year_month) - calc(None, year_month) -#calc('上海', 202412) \ No newline at end of file +yearmonth = sys.argv[1] if len(sys.argv) > 1 else None + +calc(None, yearmonth) \ No newline at end of file