qml.concurrency.executors.native.serial.SerialExec¶
- class SerialExec(max_workers=1, persist=False, **kwargs)[source]¶
Bases:
PyNativeExec
Serial Python standard library executor class.
This executor wraps Python standard library calls without support for multithreaded or multiprocess execution. Any calls to external libraries that utilize threads, such as BLAS through numpy, can still use multithreaded calls at that layer.
- Parameters:
max_workers – the maximum number of concurrent units (threads, processes) to use. The serial backend defaults to 1 and will return a
RuntimeError
if more are requested.persist – allow the executor backend to persist between executions. This is ignored for the serial backend.
**kwargs – Keyword arguments to pass-through to the executor backend. This is ignored for the serial 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)¶
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.