jztools.parallelization.mock#

Classes

MockFuture(task[, lazy])

Mock implementation of Future.

MockParallelizer([do_raise, verbose, ...])

param do_raise:

If True, Raise an exception as soon as it is received internally. Otherwise, will return the exception object.

MockPoolExecutor(*args, **kwargs)

https://stackoverflow.com/questions/10434593/dummyexecutor-for-pythons-futures

class jztools.parallelization.mock.MockFuture(task, lazy=False)#

Bases: Future

Mock implementation of Future.

Initializes the future. Should not be called by clients.

class jztools.parallelization.mock.MockPoolExecutor(*args, **kwargs)#

Bases: Executor

https://stackoverflow.com/questions/10434593/dummyexecutor-for-pythons-futures

submit(fn, *args, **kwargs)#

Todo

Computation should not happen here, but rather when checking for results.

shutdown(wait=True)#

Clean-up the resources associated with the Executor.

It is safe to call this method several times. Otherwise, no other methods can be called after this one.

Args:
wait: If True then shutdown will not return until all running

futures have finished executing and the resources used by the executor have been reclaimed.

class jztools.parallelization.mock.MockParallelizer(do_raise: bool = False, verbose=False, tqdm_kwargs={}, **pool_executor_kwargs)#

Bases: _Parallelizer

Parameters:
  • do_raise – If True, Raise an exception as soon as it is received internally. Otherwise, will return the exception object.

  • verbose – Use tqdm to display progress.

  • tqdm_kwargs – Dictionary of keyword arguments passed to tqdm.

  • pool_executor_kwargs – Variable keyword args passed to the pool executor initializer.

PoolExecutor#

alias of MockPoolExecutor