18 lines
758 B
Python
18 lines
758 B
Python
from airflow.operators.bash import BashOperator
|
|
import pendulum
|
|
from airflow import DAG
|
|
|
|
with DAG(
|
|
dag_id="sync_es_price_to_mongo_dag",
|
|
# 每月3日凌晨2点整执行(在大部分上游爬取和ES清洗完毕后进行数据同步归档)
|
|
schedule="0 2 3 * *",
|
|
start_date=pendulum.datetime(2026, 8, 16, tz="Asia/Shanghai"),
|
|
catchup=False,
|
|
description="每月定时把 ES 206 上的 community 均价数据同步到 85 Mongo 的 average_statistics 表"
|
|
) as dag:
|
|
|
|
sync_es_price_to_mongo = BashOperator(
|
|
task_id='sync_es_price_to_mongo',
|
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/sync_es_price_to_mongo.py {{dag_run.conf["month"] if "month" in dag_run.conf else ""}}',
|
|
)
|