From 5b5252c18554c8f159ef3f1014f4ebc764be880a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Mon, 3 Mar 2025 09:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9A=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/dag_office_base_price.py | 2 +- dags/office/rent/base_price.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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