21 lines
851 B
Python
21 lines
851 B
Python
from airflow import DAG
|
|
from airflow.providers.standard.operators.bash import BashOperator
|
|
import pendulum
|
|
|
|
with DAG(
|
|
dag_id="community_rating_dag",
|
|
# 每月的最后一天运行
|
|
schedule="0 20 * * 6",
|
|
start_date=pendulum.datetime(2025, 6, 9, tz="Asia/Shanghai"),
|
|
description="小区楼盘评级计算",
|
|
catchup=True
|
|
) as dag:
|
|
t1 = BashOperator(
|
|
task_id='community_rating',
|
|
bash_command='python /opt/airflow/dags/repo/dags/stat/community/community_rate.py --city "{{ dag_run.conf.get("city", "all")}}" --month "{{ dag_run.conf.get("month", "")}}"'
|
|
)
|
|
t2 = BashOperator(
|
|
task_id='region_rating',
|
|
bash_command='python /opt/airflow/dags/repo/dags/stat/community/region_rate.py --city "{{ dag_run.conf.get("city", "all")}}" --month "{{ dag_run.conf.get("month", "")}}"'
|
|
)
|
|
t1 >> t2 |