修改测试脚本
This commit is contained in:
@@ -1,24 +1,13 @@
|
||||
import json
|
||||
import redis
|
||||
import fangjia
|
||||
import config
|
||||
import datetime
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
import pytz
|
||||
|
||||
from datetime import date
|
||||
|
||||
import redis
|
||||
|
||||
|
||||
def get_weekend(tt):
|
||||
|
||||
from dateutil.parser import parse
|
||||
bb=parse(tt)
|
||||
pacific = pytz.timezone('Asia/Shanghai')
|
||||
return pacific.localize(bb)
|
||||
|
||||
weekend = get_weekend('20180527')
|
||||
import config
|
||||
import fangjia
|
||||
|
||||
|
||||
class CJsonEncoder(json.JSONEncoder):
|
||||
@@ -32,17 +21,13 @@ class CJsonEncoder(json.JSONEncoder):
|
||||
|
||||
|
||||
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=9)
|
||||
|
||||
|
||||
|
||||
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("CalcCmdSender")
|
||||
|
||||
|
||||
def get_district(city):
|
||||
#weekend = fangjia.get_weekend()
|
||||
weekend = fangjia.get_weekend()
|
||||
seaweeds = []
|
||||
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):
|
||||
@@ -59,9 +44,7 @@ def send_cmd(seaweed):
|
||||
|
||||
|
||||
def send_district_calc_cmd():
|
||||
#for city in fangjia.get_all_city():
|
||||
for city in ['上海']:
|
||||
|
||||
for city in fangjia.get_all_city():
|
||||
for seaweed in get_district(city):
|
||||
send_cmd(seaweed)
|
||||
|
||||
@@ -88,10 +71,8 @@ def save_city_calc_command(city, region, weekend):
|
||||
|
||||
|
||||
def send_city_calc_cmd():
|
||||
#weekend = fangjia.get_weekend()
|
||||
|
||||
for city in ['上海']:
|
||||
#for city in fangjia.get_all_city():
|
||||
weekend = fangjia.get_weekend()
|
||||
for city in fangjia.get_all_city():
|
||||
for region in fangjia.get_region(city):
|
||||
save_city_calc_command(city, region, weekend)
|
||||
save_city_calc_command(city, None, weekend)
|
||||
|
||||
Reference in New Issue
Block a user