修改文件名
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
import json
|
||||
import multiprocessing
|
||||
import os
|
||||
import time
|
||||
import redis
|
||||
import config
|
||||
import rent_price.district_map0413 as rentPrice
|
||||
import fangjia
|
||||
import datetime
|
||||
import pytz
|
||||
import os
|
||||
import rent_price.district_map0413 as rentPrice
|
||||
|
||||
QUEUE = "rent_cmd"
|
||||
#redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db())
|
||||
QUEUE = config.get_rent_calc_cmd_queue_name()
|
||||
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_rent_redis_db())
|
||||
logger = fangjia.get_logger("Rent_Receiver.py")
|
||||
logger = fangjia.get_logger("RentCalcCmdReceiver")
|
||||
|
||||
|
||||
def worker():
|
||||
@@ -46,7 +43,7 @@ def format_cmd(cmd):
|
||||
|
||||
if __name__ == "__main__":
|
||||
user_home = os.path.expanduser('~')
|
||||
lock_file = user_home + "/price.sys.stop"
|
||||
lock_file = user_home + "/rent.sys.stop"
|
||||
if os.path.exists(lock_file):
|
||||
os.remove(lock_file)
|
||||
pro_num = config.get_worker_num()
|
||||
@@ -48,13 +48,10 @@ class CJsonEncoder(json.JSONEncoder):
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
|
||||
QUEUE = "rent_cmd"
|
||||
#redisPool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db())
|
||||
|
||||
QUEUE = config.get_rent_calc_cmd_queue_name()
|
||||
redisPool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_rent_redis_db())
|
||||
|
||||
client = redis.Redis(connection_pool=redisPool)
|
||||
logger = fangjia.get_logger("Rent_Sender.py")
|
||||
logger = fangjia.get_logger("RentCalcCmdSender")
|
||||
|
||||
|
||||
def get_district(city):
|
||||
@@ -85,7 +82,6 @@ def send_district_calc_cmd():
|
||||
send_cmd(seaweed)
|
||||
|
||||
|
||||
|
||||
def district_calc_cmd_finish():
|
||||
count = client.llen(QUEUE)
|
||||
if count == 0:
|
||||
@@ -94,16 +90,14 @@ def district_calc_cmd_finish():
|
||||
return False
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
start_time = datetime.datetime.utcnow()
|
||||
send_district_calc_cmd()
|
||||
while not district_calc_cmd_finish():
|
||||
time.sleep(5)
|
||||
logger.info("等待小区均价计算完成")
|
||||
#send_city_calc_cmd()
|
||||
logger.info("城市均价计算完成")
|
||||
#all_calc_cmd_finish(start_time)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import redis
|
||||
import config
|
||||
import fangjia
|
||||
|
||||
QUEUE = "rent_cmd"
|
||||
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db())
|
||||
QUEUE = config.get_rent_calc_cmd_queue_name()
|
||||
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_rent_redis_db())
|
||||
|
||||
logger = fangjia.get_logger("Rent_SpeedMonitor")
|
||||
logger = fangjia.get_logger("RentCalcSpeedMonitor")
|
||||
|
||||
|
||||
def monitor(pname):
|
||||
@@ -58,18 +58,29 @@ def get_seaweed_port():
|
||||
return 27017
|
||||
|
||||
|
||||
def get_rent_calc_cmd_queue_name():
|
||||
"""
|
||||
获取租金计算命令的队列名称
|
||||
:return:
|
||||
"""
|
||||
return "rent_cmd"
|
||||
|
||||
|
||||
##########################################3
|
||||
#the code below is about square meter rent price
|
||||
|
||||
def get_65_host():
|
||||
return 'seawater65.mongo.com'
|
||||
|
||||
|
||||
def get_sqm_rentprice_db():
|
||||
return "sqmetre_rent"
|
||||
|
||||
|
||||
def get_lg_mongo():
|
||||
return 'luogan.mongo.com'
|
||||
|
||||
|
||||
def get_rent_redis_db():
|
||||
return 5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user