diff --git a/PriceSystem/CalcCmdReceiver.py b/PriceSystem/CalcCmdReceiver.py index b9bdce7..497dd90 100644 --- a/PriceSystem/CalcCmdReceiver.py +++ b/PriceSystem/CalcCmdReceiver.py @@ -7,6 +7,7 @@ import sell_price import fangjia import datetime import pytz +import os QUEUE = "calc_cmd" redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db()) @@ -47,6 +48,11 @@ def format_cmd(cmd): if __name__ == "__main__": + pid_file = open("/var/run/price.sys.pid", "w") + pid_file.write(str(os.getpid())) + pid_file.flush() + pid_file.close() + pro_num = config.get_worker_num() pool = multiprocessing.Pool(processes=pro_num) for pid in range(0, pro_num): diff --git a/PriceSystem/CalcCmdSender.py b/PriceSystem/CalcCmdSender.py index 9302d7e..972ef16 100644 --- a/PriceSystem/CalcCmdSender.py +++ b/PriceSystem/CalcCmdSender.py @@ -23,7 +23,7 @@ client = redis.Redis(connection_pool=redisPool) def get_district(): seaweeds = [] keys = {"city": 1, "region": 1, "name": 1, "_id": 0} - for dis in fangjia.get_collection("fangjia", "seaweed").find({"cat": "district", "status": 0, "city": "上海"}, keys): + for dis in fangjia.get_collection("fangjia", "seaweed").find({"cat": "district", "status": 0, "city": "合肥"}, keys): dis["weekend"] = datetime.strptime("2018-03-11", "%Y-%m-%d") seaweeds.append(dis) diff --git a/PriceSystem/CalcSpeedMonitor.py b/PriceSystem/CalcSpeedMonitor.py index b610e6a..767d0f3 100644 --- a/PriceSystem/CalcSpeedMonitor.py +++ b/PriceSystem/CalcSpeedMonitor.py @@ -13,8 +13,7 @@ def monitor(pname): while True: pre_counter = client.llen(QUEUE) time.sleep(60) - print(pname + "#####################################:".zfill(100) + str( - pre_counter - client.llen(QUEUE)) + "/min") + print(pname + "#####################################:".zfill(100) + str(pre_counter - client.llen(QUEUE)) + "/min") def format_cmd(cmd):