1

我正在使用python 2.7。这是我的一些代码:

from pathos.multiprocessing import ProcessingPool as Pool

class pair_scraper(object):

    #code and various methods ...

    def parallelized_processing(self):
    '''
    Parallelize length extraction of
    relevant files.
    '''
    pool = Pool(self.pool_size)
    pool.map(self.length_processer, self.zip_files)
    pool.close()
    pool.join()

但是,当我运行它时,我得到一个空白AssertionError

/...file.py in parallelized_processing(self)
     69         '''
     70         pool = Pool(self.pool_size)
---> 71         pool.map(self.length_processer, self.zip_files)
     72         # pool.close()
     73         # pool.join()

/.../anaconda/lib/python2.7/site-packages/pathos/multiprocessing.pyc in map(self, f, *args, **kwds)
    134         AbstractWorkerPool._AbstractWorkerPool__map(self, f, *args, **kwds)
    135         _pool = self._serve()
--> 136         return _pool.map(star(f), zip(*args)) # chunksize
    137     map.__doc__ = AbstractWorkerPool.map.__doc__
    138     def imap(self, f, *args, **kwds):

/.../anaconda/lib/python2.7/site-packages/multiprocess/pool.pyc in map(self, func, iterable, chunksize)
    248         Equivalent of `map()` builtin
    249         '''
--> 250         assert self._state == RUN
    251         return self.map_async(func, iterable, chunksize).get()
    252 

AssertionError: 

此错误似乎类似于此问题中描述的错误,尽管那里的修复更为明显。我运行了上面的代码删除pool.close()pool.join()但得到了相同的结果。

想法?

4

0 回答 0