Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def imap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
def submit(*argz):
"""send a job to the server"""
_pool = self._serve()
#print("using %s local workers" % _pool.get_ncpus())
try:
return _pool.submit(f, argz, globals=globals())
except pp.DestroyedServerError:
self._is_alive(None)
# submit all jobs, then collect results as they become available
return (subproc() for subproc in list(builtins.map(submit, *args)))
imap.__doc__ = AbstractWorkerPool.imap.__doc__
def uimap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
def submit(*argz):
"""send a job to the server"""
_pool = self._serve()
#print("using %s local workers" % _pool.get_ncpus())
try:
return _pool.submit(f, argz, globals=globals())
except pp.DestroyedServerError:
self._is_alive(None)
def imap_unordered(it):
"""build a unordered map iterator"""
it = list(it)
while len(it):
for i,job in enumerate(it):
if job.finished:
yield it.pop(i)()
break
def imap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
_pool = self._serve()
return _pool.imap(star(f), zip(*args)) # chunksize
imap.__doc__ = AbstractWorkerPool.imap.__doc__
def uimap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
_pool = self._serve()
return _pool.imap_unordered(star(f), zip(*args)) # chunksize
uimap.__doc__ = AbstractWorkerPool.uimap.__doc__
def imap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
_pool = self._serve()
return _pool.imap(star(f), zip(*args)) # chunksize
imap.__doc__ = AbstractWorkerPool.imap.__doc__
def uimap(self, f, *args, **kwds):
AbstractWorkerPool._AbstractWorkerPool__imap(self, f, *args, **kwds)
_pool = self._serve()
return _pool.imap_unordered(star(f), zip(*args)) # chunksize
uimap.__doc__ = AbstractWorkerPool.uimap.__doc__