修改测试脚本
This commit is contained in:
@@ -1,24 +1,13 @@
|
|||||||
import json
|
|
||||||
import redis
|
|
||||||
import fangjia
|
|
||||||
import config
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import json
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import pytz
|
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
import redis
|
||||||
|
|
||||||
|
import config
|
||||||
def get_weekend(tt):
|
import fangjia
|
||||||
|
|
||||||
from dateutil.parser import parse
|
|
||||||
bb=parse(tt)
|
|
||||||
pacific = pytz.timezone('Asia/Shanghai')
|
|
||||||
return pacific.localize(bb)
|
|
||||||
|
|
||||||
weekend = get_weekend('20180527')
|
|
||||||
|
|
||||||
|
|
||||||
class CJsonEncoder(json.JSONEncoder):
|
class CJsonEncoder(json.JSONEncoder):
|
||||||
@@ -32,17 +21,13 @@ class CJsonEncoder(json.JSONEncoder):
|
|||||||
|
|
||||||
|
|
||||||
QUEUE = "calc_cmd"
|
QUEUE = "calc_cmd"
|
||||||
#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_redis_db())
|
||||||
redisPool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=9)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
client = redis.Redis(connection_pool=redisPool)
|
client = redis.Redis(connection_pool=redisPool)
|
||||||
logger = fangjia.get_logger("CalcCmdSender")
|
logger = fangjia.get_logger("CalcCmdSender")
|
||||||
|
|
||||||
|
|
||||||
def get_district(city):
|
def get_district(city):
|
||||||
#weekend = fangjia.get_weekend()
|
weekend = fangjia.get_weekend()
|
||||||
seaweeds = []
|
seaweeds = []
|
||||||
keys = {"city": 1, "region": 1, "name": 1, "_id": 0}
|
keys = {"city": 1, "region": 1, "name": 1, "_id": 0}
|
||||||
for dis in fangjia.get_collection("fangjia", "seaweed", config.get_seaweed_host()).find({"cat": "district", "status": 0, "city": city}, keys):
|
for dis in fangjia.get_collection("fangjia", "seaweed", config.get_seaweed_host()).find({"cat": "district", "status": 0, "city": city}, keys):
|
||||||
@@ -59,9 +44,7 @@ def send_cmd(seaweed):
|
|||||||
|
|
||||||
|
|
||||||
def send_district_calc_cmd():
|
def send_district_calc_cmd():
|
||||||
#for city in fangjia.get_all_city():
|
for city in fangjia.get_all_city():
|
||||||
for city in ['上海']:
|
|
||||||
|
|
||||||
for seaweed in get_district(city):
|
for seaweed in get_district(city):
|
||||||
send_cmd(seaweed)
|
send_cmd(seaweed)
|
||||||
|
|
||||||
@@ -88,10 +71,8 @@ def save_city_calc_command(city, region, weekend):
|
|||||||
|
|
||||||
|
|
||||||
def send_city_calc_cmd():
|
def send_city_calc_cmd():
|
||||||
#weekend = fangjia.get_weekend()
|
weekend = fangjia.get_weekend()
|
||||||
|
for city in fangjia.get_all_city():
|
||||||
for city in ['上海']:
|
|
||||||
#for city in fangjia.get_all_city():
|
|
||||||
for region in fangjia.get_region(city):
|
for region in fangjia.get_region(city):
|
||||||
save_city_calc_command(city, region, weekend)
|
save_city_calc_command(city, region, weekend)
|
||||||
save_city_calc_command(city, None, weekend)
|
save_city_calc_command(city, None, weekend)
|
||||||
|
|||||||
Reference in New Issue
Block a user