def run(conf): parames = get_parames(conf) work_num = parames.get("master").get("work_num", "2") firstname = parames.get("regist").get("firstname", "Lee") lastname = parames.get("regist").get("lastname", "Jack") regist_num = int(parames.get("master").get("regist_num", 10)) pool = multiprocessing.Pool(int(work_num)) for one in range(regist_num): pool.apply_async(target, args=(firstname, lastname, parames)) pool.close() pool.join()
def run(conf): parames = get_parames(conf) user_file = parames.get("user").get("address", "") work_num = parames.get("master").get("work_num", "2") if not user_file: raise Exception("Please give a user file") user_list = read_file(user_file) if not user_list: raise Exception("User file no data") pool = multiprocessing.Pool(int(work_num)) for one in user_list: username = json.loads(one).get("response").get("username") password = json.loads(one).get("response").get("password") pool.apply_async(target, args=(username, password, parames)) pool.close() pool.join()
def run(conf): parames = get_parames(conf) user_file = parames.get("user").get("buy", "") work_num = parames.get("master").get("work_num", "2") if not user_file: raise Exception("Please give a user file") user_list = read_file(user_file) if not user_list: raise Exception("User file no data") queue = multiprocessing.Queue() record_list = multiprocessing.Manager().list() process_pool = [] for i in range(int(work_num)): p = QueueProcess(record_queue=queue, record_list=record_list, parames=parames) p.start() process_pool.append(p) for one in user_list: queue.put(one) for j in process_pool: j.join()