合并周边配套dag
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
import logging
|
||||
import shutil
|
||||
import time
|
||||
from datetime import datetime
|
||||
from airflow import DAG
|
||||
from airflow.decorators import task
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
with DAG(
|
||||
dag_id='example_python_operator',
|
||||
schedule_interval="*/1 * * * *",
|
||||
start_date=datetime(2021, 1, 1),
|
||||
catchup=False,
|
||||
tags=['example'],
|
||||
) as dag:
|
||||
print('success')
|
||||
@@ -0,0 +1,41 @@
|
||||
import sys
|
||||
|
||||
type = 'all'
|
||||
if len(sys.argv) > 1:
|
||||
type = sys.argv[1]
|
||||
|
||||
print("输出类型" + type)
|
||||
|
||||
if type is not None:
|
||||
if type == 'bank':
|
||||
import district_bank as bank
|
||||
bank
|
||||
elif type == 'bus':
|
||||
import district_bus as bus
|
||||
bus
|
||||
elif type == 'hospital':
|
||||
import district_hospital as hospital
|
||||
hospital
|
||||
elif type == 'school':
|
||||
import district_school as school
|
||||
school
|
||||
elif type == 'subway':
|
||||
import district_subway as subway
|
||||
subway
|
||||
elif type == 'supermarket':
|
||||
import district_supermarket as supermarket
|
||||
supermarket
|
||||
else:
|
||||
import district_bank as bank
|
||||
import district_bus as bus
|
||||
import district_hospital as hospital
|
||||
import district_school as school
|
||||
import district_subway as subway
|
||||
import district_supermarket as supermarket
|
||||
|
||||
bank
|
||||
bus
|
||||
hospital
|
||||
school
|
||||
subway
|
||||
supermarket
|
||||
@@ -1,26 +0,0 @@
|
||||
"""
|
||||
小区周边公交DAG
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
import pendulum
|
||||
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
"district_bus_dag",
|
||||
# 每月1日9点运行
|
||||
schedule_interval="0 9 1 * *",
|
||||
start_date=pendulum.datetime(2022, 6, 18, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='district_subway',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_subway.py',
|
||||
)
|
||||
t2 = BashOperator(
|
||||
task_id='district_bus',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_bus.py',
|
||||
)
|
||||
t1 >> t2
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
小区周边银行DAG
|
||||
小区周边配套DAG
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
@@ -8,15 +8,15 @@ import pendulum
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
"district_bank_dag",
|
||||
"district_facilities_dag",
|
||||
# 每月1日1点运行
|
||||
schedule_interval="0 1 1 * *",
|
||||
start_date=pendulum.datetime(2022, 6, 18, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='district_bank',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_bank.py',
|
||||
task_id='district_facilities',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_facilities.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
||||
)
|
||||
t1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
"""
|
||||
小区周边银行DAG
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
import pendulum
|
||||
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
"district_hospital_dag",
|
||||
# 每月1日17点运行
|
||||
schedule_interval="0 17 1 * *",
|
||||
start_date=pendulum.datetime(2022, 6, 20, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='district_hospital',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_hospital.py',
|
||||
)
|
||||
t1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
"""
|
||||
小区周边银行DAG
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
import pendulum
|
||||
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
"district_school_dag",
|
||||
# 每月2日9点运行
|
||||
schedule_interval="0 9 2 * *",
|
||||
start_date=pendulum.datetime(2022, 6, 20, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='district_school',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_school.py',
|
||||
)
|
||||
t1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
"""
|
||||
小区周边公交DAG
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
import pendulum
|
||||
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
"district_supermarket_dag",
|
||||
# 每月2日1点运行
|
||||
schedule_interval="0 1 2 * *",
|
||||
start_date=pendulum.datetime(2022, 6, 18, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='district_supermarket',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/poi/business/district_supermarket.py',
|
||||
)
|
||||
t1
|
||||
|
||||
Reference in New Issue
Block a user