Commit 603cf85d authored by litaolemo's avatar litaolemo

update

parent 29d2c7f3
......@@ -141,30 +141,30 @@ def get_task_from_redis():
while True:
try:
print('----------------------')
# print('----------------------')
# now = datetime.datetime.now()
# if now.hour >= exit_hour:
# sys.exit()
res = rds_1.hgetall("process_num")
print(res)
# print(res)
for platform in platform_crawler_reg:
platform_str = platform + "_process"
print(platform_str)
# print(platform_str)
try:
process_num = rds_1.get(platform_str)
print(process_num)
# print(process_num)
except Exception as e:
print("line 152 error",e)
continue
try:
print("rds_1.llen(platform)" ,rds_1.llen(platform))
# print("rds_1.llen(platform)" ,rds_1.llen(platform))
if rds_1.llen(platform) > 0:
print("process_num",process_num)
# print("process_num",process_num)
if process_num:
if res.get(platform):
print(res.get(platform))
# print(res.get(platform))
if int(res.get(platform)) > int(process_num):
print("get platfrom %s" % platform)
# print("get platfrom %s" % platform)
rds_1.incr(platform_str)
yield platform
rds_1.decr(platform_str)
......@@ -191,7 +191,7 @@ def single_thead(processe,name):
end_time = int(now.timestamp() * 1e3)
for count, platform in enumerate(get_task_from_redis()):
now = datetime.datetime.now()
print(count,platform)
# print(count,platform)
try:
count_false = 0
releaser_dic_str = rds_1.blpop(platform)
......@@ -267,7 +267,7 @@ def single_thead(processe,name):
def start_crawler(processe,name):
for count in range(args.thead_num):
# single_thead(processe,name)
print("processe,name" ,processe,name)
# print("processe,name" ,processe,name)
t = threading.Thread(target=single_thead, name=str(count),args=(str(processe),name))
# t.setDaemon(False)
t.start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment