def start_readCoroutine(five_config,fivemin_log): # 处理日志log文件名 if not five_config.TRUNC_PROCESS_DISABLE: # 创建read对象 read_accesslog = read_access(five_config,fivemin_log) # 开始读取access.log read_accesslog.read_to_queue()
def start_truck(): # 启动功能list thread = [] # load config five_config = load_config() # load log config truckName = "%s-%s" %(time.strftime("%Y%m%d"),"truck.log") fivemin_log = load_log(truckName) # load IPname area if load_view_data(five_config.IPNAMEDPATH) < 0: print "load_view_data failed" return -1 # 创建功能对象 read_accesslog = read_access(five_config,fivemin_log) work1 = gevent.spawn(read_accesslog.read_to_queue) thread.append(work1) for i in range(10): worker = progress_access(five_config, fivemin_log, i) work = gevent.spawn(worker.handle_task) thread.append(work) # 启动功能 gevent.joinall(thread) print "system start succeed"