qml.concurrency.executors.native.api.PyNativeExec¶
- class PyNativeExec(max_workers=None, persist=False, **kwargs)[source]¶
Bases:
IntExec
,ABC
Python standard library backed ABC for executor API.
This class abstracts single-machine environments and unifies the standard-library backed executor backend to support the same API call structure.
- Parameters:
max_workers – the maximum number of concurrent units (threads, 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.
Attributes
Indicates whether the executor will maintain its configured state between calls.
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.
Methods
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.