Skip to content

multiprocessing

Multiprocessing Parallelization Layer for OM.

This module contains a Parallelization Layer based on Python's multiprocessing module.

MultiprocessingParallelization

Bases: OmParallelizationProtocol

See documentation of the __init__ function.

__init__(*, data_retrieval_layer, processing_layer, monitor_parameters)

Multiprocessing-based Parallelization Layer for OM.

This class implements a Parallelization Layer based on Python's multiprocessing module. Each processing node is spawned as a subprocess. The parent process acts as the collecting node and additionally manages the child processes. This class manages all the subprocesses, and sets up all the communication channels through which data and control commands are received and dispatched.

This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.

Parameters:

Name Type Description Default
data_retrieval_layer OmDataRetrievalProtocol

A class defining how data and data events are retrieved and handled.

required
processing_layer OmProcessingProtocol

A class defining how retrieved data is processed.

required
monitor_parameters MonitorParameters

An object storing OM's configuration parameters.

required

start()

Starts the multiprocessing parallelization.

The function starts the nodes and manages all of their interactions,organizing the receiving and dispatching of data and control commands.

Please see the documentation of the base Protocol class for additional information about this method.

shutdown(*, msg='Reason not provided.')

Shuts down the multiprocessing parallelization.

This function stops OM, closing all the communication channels between the nodes and managing a controlled shutdown of OM's resources. Additionally, it terminates all the subprocesses in an orderly fashion.

Please see the documentation of the base Protocol class for additional information about this method.

Parameters:

Name Type Description Default
msg str

Reason for shutting down. Defaults to "Reason not provided".

'Reason not provided.'