data_event_handlers_asapo
Handling of ASAP::O-based data events.
This module contains Data Event Handler classes that manipulate events originating from the ASAP::O software framework (used at the PETRA III facility).
AsapoDataEventHandler
Bases: OmDataEventHandlerProtocol
See documentation of the __init__
function.
__init__(*, source, data_sources, monitor_parameters)
Data Event Handler for ASAP::O events.
This class handles data events retrieved from the ASAP::O software framework at the PETRA III facility.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
-
For this Event Handler, a data event corresponds to the content of an individual ASAP::O event.
-
The source string required by this Data Event Handler is either the ID of the beamtime for which OM is being used (for online data retrieval) or the ID of the beamtime and the name of the ASAP::O stream separated by a colon (for offline data retrieval).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
str
|
A string describing the data event source. |
required |
data_sources |
Dict[str, OmDataSourceProtocol]
|
A dictionary containing a set of Data Source class instances.
|
required |
monitor_parameters |
MonitorParameters
|
An object storing OM's configuration parameters. |
required |
initialize_event_handling_on_collecting_node(*, node_rank, node_pool_size)
Initializes ASAP::O event handling on the collecting node.
Please see the documentation of the base Protocol class for additional information about this method.
ASAP::O event handling does not need to be initialized on the collecting node, so this function actually does nothing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_rank |
int
|
The OM rank of the current node int the OM node pool. The rank is an integer that unambiguously identifies the node in the pool. |
required |
node_pool_size |
int
|
The total number of nodes in the OM pool, including all the processing nodes and the collecting node. |
required |
initialize_event_handling_on_processing_node(node_rank, node_pool_size)
Initializes ASAP::O event handling on the processing nodes.
Please see the documentation of the base Protocol class for additional information about this method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_rank |
int
|
The OM rank of the current node int the OM node pool. The rank is an integer that unambiguously identifies the node in the pool. |
required |
node_pool_size |
int
|
The total number of nodes in the OM pool, including all the processing nodes and the collecting node. |
required |
event_generator(*, node_rank, node_pool_size)
Retrieves ASAP::O events.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves data events on the processing nodes. Each retrieved event corresponds to a single ASAP::O event.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_rank |
int
|
The OM rank of the current node int the OM node pool. The rank is an integer that unambiguously identifies the node in the pool. |
required |
node_pool_size |
int
|
The total number of nodes in the OM pool, including all the processing nodes and the collecting node. |
required |
open_event(*, event)
Opens an ASAP::O event.
Please see the documentation of the base Protocol class for additional information about this method.
ASAP::O events do not need to be opened, so this function actually does nothing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
A dictionary storing the event data. |
required |
close_event(*, event)
Closes an ASAP::O event.
Please see the documentation of the base Protocol class for additional information about this method.
ASAP::O events do not need to be closed, so this function actually does nothing.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
A dictionary storing the event data. |
required |
extract_data(*, event)
Extracts data from an ASAP::O data event.
Please see the documentation of the base Protocol class for additional information about this method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
A dictionary storing the event data. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
A dictionary storing the extracted data.
|
Raises:
Type | Description |
---|---|
OmDataExtractionError
|
Raised when data cannot be extracted from the event. |
initialize_event_data_retrieval()
Initializes event data retrievals from ASAP::O.
This function initializes the retrieval of single standalone data events from ASAP::O.
Please see the documentation of the base Protocol class for additional information about this method.
retrieve_event_data(event_id)
Retrieves all data related to the requested event.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves all data related to the event specified by the provided identifier. An ASAP::O event identifier corresponds to the ASAP::O stream name and the ID of the ASAP::O event within the stream, separated by the "//" symbol.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
event_id |
str
|
A string that uniquely identifies a data event. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
All data related to the requested event. |