qml.concurrency.executors.native.multiproc.MPPoolExec

class MPPoolExec(max_workers=None, persist=False, **kwargs)[source]

Bases: PyNativeExec

Python standard library executor class backed by multiprocessing.Pool.

This executor wraps Python standard library multiprocessing.Pool interface, and provides support for execution using multiple processes.

Parameters:
  • max_workers – the maximum number of concurrent units (processes) to use

  • persist – allow the executor backend to persist between executions. True avoids potentially costly set-up and tear-down, where supported. Explicit calls to shutdown will set this to False.

  • **kwargs – Keyword arguments to pass-through to the executor backend.

persist

Indicates whether the executor will maintain its configured state between calls.

size

The size of the worker pool for the given executor.

persist

Indicates whether the executor will maintain its configured state between calls.

size

The size of the worker pool for the given executor.

map(fn, *args, **kwargs)

Single iterable map for batching execution of fn over data entries.

shutdown()

Shutdown the executor backend, if valid.

starmap(fn, args, **kwargs)

Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.

submit(fn, *args, **kwargs)

Single function submission for remote execution with provided args.

map(fn, *args, **kwargs)[source]

Single iterable map for batching execution of fn over data entries. Length of every entry in *args must be consistent. kwargs are assumed as broadcastable to each function call.

shutdown()

Shutdown the executor backend, if valid.

starmap(fn, args, **kwargs)

Single iterable map for batching execution of fn over data entries, with each entry being a tuple of arguments to fn.

submit(fn, *args, **kwargs)

Single function submission for remote execution with provided args.