From b2a6f650ea42682d735c656992fcaf315b859780 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Tue, 13 Mar 2018 11:10:10 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PriceSystem/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PriceSystem/config/__init__.py b/PriceSystem/config/__init__.py index 2de3607..c7758d7 100644 --- a/PriceSystem/config/__init__.py +++ b/PriceSystem/config/__init__.py @@ -27,7 +27,7 @@ def get_mongodb_port(): def get_log_mongodb_host(): - return "192.168.0.139" + return "192.168.0.136" # return "log.mongo.db.fangjia.com" From eb6d442ba0ce7b7f223b3e1b0719946a20c68767 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Tue, 13 Mar 2018 13:34:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PriceSystem/fangjia/__init__.py | 4 ++-- PriceSystem/test.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/PriceSystem/fangjia/__init__.py b/PriceSystem/fangjia/__init__.py index 75fa840..92c57c8 100644 --- a/PriceSystem/fangjia/__init__.py +++ b/PriceSystem/fangjia/__init__.py @@ -19,7 +19,7 @@ def get_logger(name): handler.setFormatter(formatter) logger.addHandler(handler) - file_handler = logging.FileHandler("/home/goojia/logs/price.log") + file_handler = logging.FileHandler("/home/goojia/logs/" + name + ".log") file_handler.setFormatter(formatter) logger.addHandler(file_handler) logger.setLevel("INFO") @@ -33,7 +33,7 @@ def get_performance_logger(name): handler.setFormatter(formatter) logger.addHandler(handler) - file_handler = logging.FileHandler("/home/goojia/logs/price.performance.log") + file_handler = logging.FileHandler("/home/goojia/logs/" + name + ".performance.log") file_handler.setFormatter(formatter) logger.addHandler(file_handler) logger.setLevel("INFO") diff --git a/PriceSystem/test.py b/PriceSystem/test.py index 923a59d..e519b20 100644 --- a/PriceSystem/test.py +++ b/PriceSystem/test.py @@ -11,8 +11,8 @@ s = time.time() #上海 闵行上海康城 ct = '上海' -rl = '闵行' -lk = '上海康城' +rl = '嘉定' +lk = '湖畔天下' #weekend = datetime.datetime.strptime("2018-03-11", "%Y-%m-%d") #for i in range(0, 100): sellPrice.out_put_price(ct, rl, lk, fangjia.get_weekend()) From a4aa98af4d929eda58e5ab6cf7d009cfb7f7cdc0 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Tue, 13 Mar 2018 13:34:52 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9D=87=E4=BB=B7?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PriceSystem/config/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PriceSystem/config/__init__.py b/PriceSystem/config/__init__.py index c7758d7..f397454 100644 --- a/PriceSystem/config/__init__.py +++ b/PriceSystem/config/__init__.py @@ -1,5 +1,5 @@ def get_worker_num(): - return 20 + return 15 def get_redis_host(): From 0a79af322e06c66273fcc1a1ce4ce2a008e096a6 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Tue, 13 Mar 2018 15:16:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9D=87=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PriceSystem/CalcCmdSender.py | 2 +- PriceSystem/CalcSpeedMonitor.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PriceSystem/CalcCmdSender.py b/PriceSystem/CalcCmdSender.py index 747cd88..671bfa6 100644 --- a/PriceSystem/CalcCmdSender.py +++ b/PriceSystem/CalcCmdSender.py @@ -22,7 +22,7 @@ class CJsonEncoder(json.JSONEncoder): QUEUE = "calc_cmd" redisPool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db()) client = redis.Redis(connection_pool=redisPool) -logger = fangjia.get_logger("CalcCmdReceiver") +logger = fangjia.get_logger("CalcCmdSender") def get_district(city): diff --git a/PriceSystem/CalcSpeedMonitor.py b/PriceSystem/CalcSpeedMonitor.py index 715f423..5049b3b 100644 --- a/PriceSystem/CalcSpeedMonitor.py +++ b/PriceSystem/CalcSpeedMonitor.py @@ -3,10 +3,13 @@ import multiprocessing import time import redis import config +import fangjia QUEUE = "calc_cmd" redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=config.get_redis_db()) +logger = fangjia.get_logger("CalcSpeedMonitor") + def monitor(pname): client = redis.Redis(connection_pool=redis_pool) @@ -14,7 +17,7 @@ def monitor(pname): pre_counter = client.llen(QUEUE) time.sleep(60) now_counter = client.llen(QUEUE) - print(pname + "#########:".zfill(100) + str(pre_counter - now_counter) + "/min") + logger.info(pname + "#####:".zfill(20) + str(pre_counter - now_counter) + "/min") def format_cmd(cmd):