简化评级
This commit is contained in:
@@ -1,13 +0,0 @@
|
|||||||
"""
|
|
||||||
消费评级定时运行
|
|
||||||
"""
|
|
||||||
import requests
|
|
||||||
import logging
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
log.info("定时消费评级开始。。。。。")
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
|
||||||
url = "http://192.168.0.19:31080/FangJiaNlpService/consumption_rate"
|
|
||||||
if requests.get(url=url, headers=headers).text == 'success':
|
|
||||||
log.info("定时消费评级调用完毕。。。。。")
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
"""
|
|
||||||
消费评级定时运行
|
|
||||||
"""
|
|
||||||
import requests
|
|
||||||
import logging
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
log.info("定时楼盘评级开始。。。。。")
|
|
||||||
headers = {'Content-Type': 'application/json'}
|
|
||||||
url = "http://192.168.0.19:31080/FangJiaNlpService/price_rate"
|
|
||||||
if requests.get(url=url, headers=headers).text == 'success':
|
|
||||||
log.info("定时楼盘评级调用完毕。。。。。")
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
"""
|
||||||
|
消费或价格评级定时运行
|
||||||
|
"""
|
||||||
|
import requests
|
||||||
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
type = sys.argv[1] if len(sys.argv) > 1 else ''
|
||||||
|
print("输出评级类型" + type)
|
||||||
|
|
||||||
|
if type == 'price':
|
||||||
|
log.info("定时楼盘评级开始。。。。。")
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
url = "http://192.168.0.19:31080/FangJiaNlpService/price_rate"
|
||||||
|
if requests.get(url=url, headers=headers).text == 'success':
|
||||||
|
log.info("定时楼盘评级调用完毕。。。。。")
|
||||||
|
|
||||||
|
else:
|
||||||
|
log.info("定时消费评级开始。。。。。")
|
||||||
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
url = "http://192.168.0.19:31080/FangJiaNlpService/consumption_rate"
|
||||||
|
if requests.get(url=url, headers=headers).text == 'success':
|
||||||
|
log.info("定时消费评级调用完毕。。。。。")
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
from airflow.operators.bash import BashOperator
|
|
||||||
import pendulum
|
|
||||||
from airflow import DAG
|
|
||||||
|
|
||||||
with DAG(
|
|
||||||
"consumption_rate_dag",
|
|
||||||
# 每月2日2点整分运行
|
|
||||||
schedule_interval="0 2 2 * *",
|
|
||||||
start_date=pendulum.datetime(2022, 7, 20, tz="Asia/Shanghai"),
|
|
||||||
catchup=True,
|
|
||||||
) as dag:
|
|
||||||
t1 = BashOperator(
|
|
||||||
task_id='consumption_rate',
|
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/business/business/consumption_rate.py',
|
|
||||||
)
|
|
||||||
t1
|
|
||||||
@@ -3,14 +3,15 @@ import pendulum
|
|||||||
from airflow import DAG
|
from airflow import DAG
|
||||||
|
|
||||||
with DAG(
|
with DAG(
|
||||||
"price_rate_dag",
|
"rate_dag",
|
||||||
# 每月2日6点整分运行
|
# 每月2日6点整分运行
|
||||||
schedule_interval="0 6 2 * *",
|
schedule_interval="0 6 2 * *",
|
||||||
start_date=pendulum.datetime(2022, 7, 20, tz="Asia/Shanghai"),
|
start_date=pendulum.datetime(2022, 7, 20, tz="Asia/Shanghai"),
|
||||||
catchup=True,
|
catchup=True,
|
||||||
|
description="地数价格与消费评级 指定type: price或consumption, 不指定则只对消费评级"
|
||||||
) as dag:
|
) as dag:
|
||||||
t1 = BashOperator(
|
t1 = BashOperator(
|
||||||
task_id='price_rate',
|
task_id='rate_dag',
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/business/business/price_rate.py',
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/rate.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
||||||
)
|
)
|
||||||
t1
|
t1
|
||||||
Reference in New Issue
Block a user