130 lines
6.9 KiB
Python
130 lines
6.9 KiB
Python
from airflow.operators.bash import BashOperator
|
|
import pendulum
|
|
from airflow import DAG
|
|
|
|
with DAG(
|
|
dag_id="community_summary_dag",
|
|
# 每月2日1点整分运行
|
|
schedule="0 1 2 * *",
|
|
start_date=pendulum.datetime(2026, 8, 16, tz="Asia/Shanghai"),
|
|
catchup=True,
|
|
description="地址输出信息分类数据定时更新"
|
|
) as dag:
|
|
del_comm = BashOperator(
|
|
task_id='del_comm',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/del_comm.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
comm = BashOperator(
|
|
task_id='comm',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/comm.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
price = BashOperator(
|
|
task_id='price',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
sell = BashOperator(
|
|
task_id='sell',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/sell.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
avg_cost = BashOperator(
|
|
task_id='avg_cost',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/avg_cost.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
trade = BashOperator(
|
|
task_id='trade',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/trade.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
total_price = BashOperator(
|
|
task_id='total_price',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
total_price_complete = BashOperator(
|
|
task_id='total_price_complete',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price_complete.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
traffic = BashOperator(
|
|
task_id='traffic',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/traffic.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
business_district = BashOperator(
|
|
task_id='business_district',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/business_district.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
medical = BashOperator(
|
|
task_id='medical',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/medical.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
life = BashOperator(
|
|
task_id='life',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/life.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
relative_price_ranking = BashOperator(
|
|
task_id='relative_price_ranking',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/relative_price_ranking.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
# relative_price_ranking_fix = BashOperator(
|
|
# task_id='relative_price_ranking_fix',
|
|
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/relative_price_ranking_fix.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
# )
|
|
estate_charge_complete = BashOperator(
|
|
task_id='estate_charge_complete',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/estate_charge_complete.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
estate_charge_ranking = BashOperator(
|
|
task_id='estate_charge_ranking',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/estate_charge_ranking.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
consumption = BashOperator(
|
|
task_id='consumption',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/consumption.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
city_level_and_price_rating = BashOperator(
|
|
task_id='city_level_and_price_rating',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/city_level_and_price_rating.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
credit = BashOperator(
|
|
task_id='credit',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/credit.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
person_rating = BashOperator(
|
|
task_id='person_rating',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/person_rating.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
price_rating = BashOperator(
|
|
task_id='price_rating',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/price_rating.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
consumption_stat = BashOperator(
|
|
task_id='consumption_stat',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/consumption_stat.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
percentile = BashOperator(
|
|
task_id='percentile',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/percentile.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
education = BashOperator(
|
|
task_id='education',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
education2 = BashOperator(
|
|
task_id='education2',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/education2.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
extra = BashOperator(
|
|
task_id='extra',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/extra.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
other = BashOperator(
|
|
task_id='other',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
# 统一输出为省市区全拼
|
|
full_name = BashOperator(
|
|
task_id='full_name',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/full_name.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
|
|
)
|
|
# 人均消费并行,值为空
|
|
del_comm >> comm >> price >> [avg_cost, total_price, relative_price_ranking, estate_charge_complete] >> total_price_complete >> consumption >> city_level_and_price_rating >> credit >> [estate_charge_ranking, price_rating, person_rating, percentile] >> \
|
|
consumption_stat >> sell >> trade >> [traffic, business_district, medical, life, education] >> education2 >> extra >> other \
|
|
>> full_name
|