Merge branch 'master' of 192.168.0.27:dev0/PriceSystem
修改: PriceSystem/CalcCmdReceiver.py 修改: PriceSystem/CalcCmdSender.py 修改: PriceSystem/CalcSpeedMonitor.py 修改: PriceSystem/config/__init__.py 修改: PriceSystem/sell_price/zhuge0118A.py 修改: PriceSystem/test.py
This commit is contained in:
@@ -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())
|
||||
@@ -46,11 +47,22 @@ def format_cmd(cmd):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
user_home = os.path.expanduser('~')
|
||||
lock_file = user_home + "/price.sys.stop"
|
||||
if os.path.exists(lock_file):
|
||||
os.remove(lock_file)
|
||||
pro_num = config.get_worker_num()
|
||||
pool = multiprocessing.Pool(processes=pro_num)
|
||||
for pid in range(0, pro_num):
|
||||
pool.apply_async(worker, ())
|
||||
pool.close()
|
||||
logger.info("均价系统启动成功")
|
||||
while True:
|
||||
if os.path.exists(lock_file):
|
||||
pool.terminate()
|
||||
break
|
||||
else:
|
||||
time.sleep(3)
|
||||
if os.path.exists(lock_file):
|
||||
os.remove(lock_file)
|
||||
pool.join()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -8,7 +8,7 @@ def get_logging_config():
|
||||
|
||||
|
||||
def get_worker_num():
|
||||
return 30
|
||||
return 80
|
||||
|
||||
|
||||
def get_redis_host():
|
||||
|
||||
@@ -1311,11 +1311,11 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
|
||||
pt.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||
{"city": ct, "region": rl, "district_name": p[0], "calc_date": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(0),
|
||||
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
||||
'problem': None,
|
||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(102),
|
||||
'remark': 'week', 'category': 'sell', "calc_date": weekend, 'priority': int(0),
|
||||
'problem': None, "calc_type" : int(0)
|
||||
}, True
|
||||
)
|
||||
|
||||
@@ -1336,10 +1336,10 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
else:
|
||||
pt.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||
{"city": ct, "region": rl, "district_name": p[0], "calc_date": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(1),
|
||||
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
||||
'problem': mm[0],
|
||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(3),
|
||||
'remark': 'week', 'category': 'sell', "calc_date": weekend, 'priority': int(0),
|
||||
'problem': mm[0], "calc_type" : int(0)
|
||||
}, True
|
||||
)
|
||||
+1
-1
@@ -8,7 +8,7 @@ s = time.time()
|
||||
#上海嘉定莱茵北郡
|
||||
ct='上海'
|
||||
rl='嘉定'
|
||||
lk='莱茵北郡别墅'
|
||||
lk='莱茵北郡'
|
||||
|
||||
#上海闵行上海康城
|
||||
weekend = datetime.datetime.strptime("2018-03-11", "%Y-%m-%d")
|
||||
|
||||
Reference in New Issue
Block a user