Files
airflow/dags/office/dag_office_sell.py
T
2025-10-28 14:41:56 +08:00

38 lines
1.3 KiB
Python

from airflow.operators.bash import BashOperator
from airflow.operators.python import PythonOperator
from office.sell.base_price import calc
from office.sell.fill_base_price import fill_base_price
import pendulum
from airflow import DAG
with DAG(
dag_id="office_sell_dag",
# 每月24日1点运行
schedule_interval="0 3 25 * *",
start_date=pendulum.datetime(2025, 10, 28, tz="Asia/Shanghai"),
catchup=True,
description="写字楼出售价格计算",
tags=["office", "sell"],
) as dag:
t1 = PythonOperator(
task_id='office_sell_base_price_calc',
python_callable=calc,
provide_context=True
)
t2 = PythonOperator(
task_id='office_no_sample_sell_base_price_calc',
python_callable=fill_base_price,
provide_context=True
)
t3 = BashOperator(
task_id='office_city_region_sell_base_price_calc',
bash_command='python /opt/airflow/dags/repo/dags/office/sell/price.py {{dag_run.conf["yearmonth"] if "yearmonth" in dag_run.conf}} ',
)
t4 = BashOperator(
task_id='office_city_region_sell_no_sample_base_price_calc',
bash_command='python /opt/airflow/dags/repo/dags/office/sell/fill_price.py {{dag_run.conf["yearmonth"] if "yearmonth" in dag_run.conf}}',
)
t1 >> t2 >> t3 >> t4