|
@@ -7,7 +7,7 @@ import sys
|
|
|
import time
|
|
|
sys.path.append(os.getcwd())
|
|
|
from common.common import Common
|
|
|
-from common.db import MysqlHelper
|
|
|
+from common.db import MysqlHelper, RedisHelper
|
|
|
|
|
|
|
|
|
class Scheduling:
|
|
@@ -92,7 +92,8 @@ class Scheduling:
|
|
|
Common.logger(log_type, crawler).info("暂无新任务\n")
|
|
|
else:
|
|
|
for pre_task in pre_task_list:
|
|
|
-
|
|
|
+ print(type(pre_task))
|
|
|
+ print(pre_task)
|
|
|
if machine == "hk":
|
|
|
# 写入 redis
|
|
|
pass
|
|
@@ -101,13 +102,17 @@ class Scheduling:
|
|
|
pass
|
|
|
else:
|
|
|
# 写入 redis
|
|
|
- pass
|
|
|
+ RedisHelper.redis_push(env, machine,pre_task['task_id'], str(pre_task))
|
|
|
|
|
|
@classmethod
|
|
|
- def main(cls):
|
|
|
+ def main(cls, log_type, crawler):
|
|
|
# 当前时间 >= next_time,更新 next_time(调用update_task),然后启动该爬虫
|
|
|
-
|
|
|
- pass
|
|
|
+ pre_task_list = cls.get_task(log_type=log_type, crawler=crawler, env=env, machine=machine)
|
|
|
+ if len(pre_task_list) == 0:
|
|
|
+ Common.logger(log_type, crawler).info("暂无新任务\n")
|
|
|
+ else:
|
|
|
+ for pre_task in pre_task_list:
|
|
|
+ task_list = RedisHelper.redis_pop()
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|