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
Initialize self. See help(type(self)) for accurate signature.
Name | Type | Default value | Description |
---|---|---|---|
processes | Any | ||
initializer | Any | ||
initargs | tuple | () | |
maxtasksperchild | Any | ||
context | Any |
Equivalent of func(*args, **kwds)
.
Pool must be running.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
kwds | dict | {} |
Asynchronous version of apply()
method.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
kwds | dict | {} | |
callback | Any | ||
error_callback | Any |
Set |
Equivalent of map()
-- can be MUCH slower than Pool.map()
.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | int | 1 |
Like imap()
method but ordering of results is arbitrary.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | int | 1 |
Apply func
to each element in iterable
, collecting the results
in a list that is returned.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | Any |
Asynchronous version of map()
method.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | Any | ||
callback | Any | ||
error_callback | Any |
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).
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | Any |
Asynchronous version of starmap()
method.
Name | Type | Default value | Description |
---|---|---|---|
func | Any | ||
iterable | Any | ||
chunksize | Any | ||
callback | Any | ||
error_callback | Any |
Name | Type | Default value | Description |
---|---|---|---|
ctx | Any | ||
kwds | Any |