1.3. Configuration options¶
This section describes
1.3.1. Automated parallelization¶
The following functionalities are for configuring the automated parallelization of the connector’s computations.
-
class
connectors.
Parallelization
¶ An enumeration type for the parallelization parameter of an executor’s
run_method()
method:- SEQUENTIAL
- the method can only be executed sequentially.
- THREAD
- the method should be executed in a separate thread, sequential execution is possible as a fallback.
- PROCESS
- the method should be executed in a separate process, threaded execution or sequential execution can be used as a fallback.
-
connectors.
executor
(threads=None, processes=0)¶ A factory function for creating
Executor
objects. Executors define how the computations of a processing chain are parallelized by executing them in separate threads or processes. This function creates an executor and configures it to use at maximum the given number of threads or processes.Parameters: - threads – an integer number of threads or
None
to determine the number automatically. 0 disables the thread based parallelization. - processes – an integer number of processes or
None
to determine the number automatically (in this case, the number of CPU cores will be taken). 0 disables the process based parallelization.
- threads – an integer number of threads or
1.3.2. Configuring the laziness¶
Flags of the following enumeration can be passed to an input connectors set_laziness()
method.
-
class
connectors.
Laziness
¶ An enumeration type for defining the laziness of input connectors. The enumeration values are sorted by how lazy the behavior is, which they represent, so smaller/greater comparisons are possible. Do not rely on the exact integer value though, since they are not guaranteed to have the same value in any version of this package.
- ON_REQUEST
- the setter is called, when its execution is requested by a method further down the processing chain.
- ON_NOTIFY
- the setter is called, when the connected getter has computed the input value, even if the execution of this setter has not been requested.
- ON_ANNOUNCE
- the setter is requests its input value immediately and is executed as soon as that is available. But connecting the setter, does not cause a request of the input value.
- ON_CONNECT
- same as ON_ANNOUNCE, but the value is also requested, when a new connection is established, which influences the input value of this connector. This connection is does not necessarily have to be with this connector, but it can also be further upstream in the processing chain.