jztools.parallelization.selector#
Programatic/environment variable-based selection of thread-based parallelization, process-based parallelization, or mock parallelization.
Module Attributes
Maximum parallelization type returned by |
Functions
|
Returns a runtime-determined parallelizer. |
|
Returns a runtime-determined pool executor. |
- jztools.parallelization.selector.JZTOOLS_MAX_PARTYPE = 'PROCESS'#
Maximum parallelization type returned by
ParallelizerorPoolWorker. Parallelization types are assumed to have the following increasing order:MOCK, THREAD, PROCESS. Setting a max order ofMOCKwill change all requested types toMOCK. The value of this variable is set from the eponymous environment variableJZTOOLS_MAX_PARTYPE.
- jztools.parallelization.selector.Parallelizer(preferred_partype, **kwargs)#
Returns a runtime-determined parallelizer. The paralleliztion type is determined by
preferred_partypeand the maximum allowable parallelization typePBLIG_MAX_PARTYPE.See
MockParallelizer,ThreadParallelizer, orProcessParallelizer.- Parameters:
preferred_partype – One of
'MOCK', 'THREAD', 'PROCESS'. the type of parallelizer returned will be the mininum of this value andJZTOOLS_MAX_PARTYPE.kwargs – Extra arguments to pass to the requested parallelizer class.
- jztools.parallelization.selector.PoolExecutor(preferred_partype, **kwargs)#
Returns a runtime-determined pool executor. The paralleliztion type is determined by
preferred_partypeand the maximum allowable parallelization typePBLIG_MAX_PARTYPE.- Parameters:
preferred_partype – (See the corresponding parameter in
Parallelizer)kwargs – Extra arguments to pass to the requested parallelizer class. See
MockPoolExecutor,ThreadPoolExecutor, orProcessPoolExecutor.