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