diff --git a/dags/stat/district_sell_deal_dag.py b/dags/stat/district_sell_deal_dag.py index 3ee1409..3b5196f 100644 --- a/dags/stat/district_sell_deal_dag.py +++ b/dags/stat/district_sell_deal_dag.py @@ -11,10 +11,10 @@ with DAG( ) as dag: t1 = BashOperator( task_id='district_count_thirdavg_deal', - bash_command='python /opt/airflow/dags/repo/dags/stat/district_count_thirdavg_deal.py', + bash_command='python /opt/airflow/dags/repo/dags/stat/evaluate/district_count_thirdavg_deal.py', ) t2 = BashOperator( task_id='district_sell_property', - bash_command='python /opt/airflow/dags/repo/dags/stat/district_sell_property.py', + bash_command='python /opt/airflow/dags/repo/dags/stat/evaluate/district_sell_property.py', ) t1 >> t2 diff --git a/dags/stat/evaluate/district_count_thirdavg_deal.py b/dags/stat/evaluate/district_count_thirdavg_deal.py index 089bc7e..b1eeb18 100644 --- a/dags/stat/evaluate/district_count_thirdavg_deal.py +++ b/dags/stat/evaluate/district_count_thirdavg_deal.py @@ -1,4 +1,3 @@ - """ 统计小区数量、近半年第三方均价、近半年成交信息 """ @@ -6,12 +5,16 @@ import logging from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, dateutils import pandas as pd import datetime +import os log = logging.getLogger(__name__) df = pd.read_excel('/opt/airflow/dags/repo/dags/stat/evaluate/data/估值数据统计.xlsx') year_month_day = dateutils.format_date(datetime.datetime.now()) -aim_file_name = '/opt/airflow/dags/repo/dags/stat/evaluate/data/估值数据统计结果' + year_month_day + '.xlsx' +path = "/home/airflow/data/evaluate" +aim_file_name = path + '/估值数据统计结果' + year_month_day + '.xlsx' +if not os.path.exists(path): + os.makedirs(path) seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed') es206_client = ElasticSearchClient(host='192.168.0.206') @@ -119,4 +122,4 @@ log.info("开始统计小区数量、近半年第三方均价、近半年成交 count_stat() third_avg_stat() deal_stat() -log.info("完成统计小区数量、近半年第三方均价、近半年成交信息") \ No newline at end of file +log.info("完成统计小区数量、近半年第三方均价、近半年成交信息") diff --git a/dags/stat/evaluate/district_sell_property.py b/dags/stat/evaluate/district_sell_property.py index 5cc48c8..f7830af 100644 --- a/dags/stat/evaluate/district_sell_property.py +++ b/dags/stat/evaluate/district_sell_property.py @@ -9,7 +9,7 @@ import datetime log = logging.getLogger(__name__) year_month_day = dateutils.format_date(datetime.datetime.now()) -aim_file_name = '/opt/airflow/dags/repo/dags/stat/evaluate/data/估值数据统计结果' + year_month_day + '.xlsx' +aim_file_name = '/home/airflow/data/evaluate/估值数据统计结果' + year_month_day + '.xlsx' start_time = dateutils.format_date(dateutils.add_months(dateutils.datetime.datetime.now(), days=-181)) one_year_time = dateutils.format_date(dateutils.add_months(dateutils.datetime.datetime.now(), days=-366)) @@ -19,7 +19,6 @@ es206_client = ElasticSearchClient(host='192.168.0.206') seaweed_df = pd.DataFrame(list(seaweed_conn.find({'cat': 'district', 'status': 0}, {'city': 1, 'region': 1, 'name': 1, 'alias': 1}) .batch_size(10000))) - def sell_stat(): """ 最近一年有样本小区占比 最近3月有样本小区占比