Python多处理(池映射)冻结 在活动的中间某处多冻结: def current_proc(): print mp.current_process().name, 'started' def multi(fn, func): print 'Process started on',time.strftime('%H:%M:%S') count = mp.cpu_count()*2 input = nohead(xlsx2array(fn)) parts = chunks(input, 10) pool = mp.Pool(processes = count, initializer = current_proc, maxtasksperchild = 1) for part in parts: with stopwatch() as r: pool.map(func, part) return r pool.close() pool.join()

Python多处理(池映射)冻结 在活动的中间某处多冻结: def current_proc(): print mp.current_process().name, 'started' def multi(fn, func): print 'Process started on',time.strftime('%H:%M:%S') count = mp.cpu_count()*2 input = nohead(xlsx2array(fn)) parts = chunks(input, 10) pool = mp.Pool(processes = count, initializer = current_proc, maxtasksperchild = 1) for part in parts: with stopwatch() as r: pool.map(func, part) return r pool.close() pool.join(),python,python-2.7,multiprocessing,python-requests,Python,Python 2.7,Multiprocessing,Python Requests,我使用多处理功能来获取有效的URL: def query(i): attempts = 2 while attempts: try: q = requests.get(i, allow_redirects = True, verify = False, timeout = 2) match = q.url

我使用多处理功能来获取有效的URL:

def query(i):
    attempts = 2
    while attempts:
        try:
            q = requests.get(i, allow_redirects = True, verify = False, timeout = 2)
            match = q.url                                                                                         
            match = str(match)
            break
        except:
            attempts -= 1
            match = 'pattern not found'
            pass

    return [ i, match ]

请告知我如何避免这种冰冻。谢谢,

您能更详细地说明它的冷冻位置吗?它是在某个查询的中间,还是在所有查询实例都已完成的情况下冻结了MAP命令?在它的活动中间的某个地方,它很难调试它,并且检查它在哪里?确切地说,在枚举的Poop.imaPunOrdEndoFunc中使用I,在部分中为作业的部分工作:PrimTI跟踪进度。