Login
Back to bricks list
Introduction Version

PoolDb

Use this class to create a pool of processes that can use the db (in parallel).

Class that extends multiprocessing.pool to allow to use the db in the sub processes. It clears the db connection before and after the pool.

:param Pool: description :type Pool: type

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

Parameters:
NameTypeDefault valueDescription
processesAny
initializerAny
initargstuple ()
maxtasksperchildAny
contextAny
APPLY

Equivalent of func(*args, **kwds). Pool must be running.

Parameters:
NameTypeDefault valueDescription
funcAny
kwdsdict {}
APPLY_ASYNC

Asynchronous version of apply() method.

Parameters:
NameTypeDefault valueDescription
funcAny
kwdsdict {}
callbackAny
error_callbackAny
CLOSE
GET_DBS
Return type:
Set
IMAP

Equivalent of map() -- can be MUCH slower than Pool.map().

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeint 1
IMAP_UNORDERED

Like imap() method but ordering of results is arbitrary.

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeint 1
JOIN
MAP

Apply func to each element in iterable, collecting the results in a list that is returned.

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeAny
MAP_ASYNC

Asynchronous version of map() method.

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeAny
callbackAny
error_callbackAny
STARMAP

Like map() method but the elements of the iterable are expected to be iterables as well and will be unpacked as arguments. Hence func and (a, b) becomes func(a, b).

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeAny
STARMAP_ASYNC

Asynchronous version of starmap() method.

Parameters:
NameTypeDefault valueDescription
funcAny
iterableAny
chunksizeAny
callbackAny
error_callbackAny
TERMINATE
PROCESS - @staticmethod
Parameters:
NameTypeDefault valueDescription
ctxAny
kwdsAny