Skip to content

data_event_handlers_http

Handling of HTTP/REST-based data events.

This module contains Data Event Handler classes that manipulate events originating from the HTTP/REST interface of detectors manufactured by company Dectris.

EigerHttpDataEventHandler

Bases: OmDataEventHandlerProtocol

See documentation of the __init__ function.

__init__(*, source, data_sources, monitor_parameters)

Data Event Handler for Eiger's HTTP/REST events.

This class handles data events recovered from the HTTP/REST interface of an Eiger detector.

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 event retrieved from the HTTP/REST interface (usually a single detector data frame)

  • The source string for this Data Event Handler is the base URL of the 'monitor' subsystem of the Eiger detector HTTP/REST interface. The string has the following format: http://<address_of_dcu>/monitor/api/<version>.

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.

  • Each dictionary key must define the name of a data source.

  • The corresponding dictionary value must store the instance of the Data Source class # noqa: E501 that describes the source.

required
monitor_parameters MonitorParameters

An object storing OM's configuration parameters.

required

initialize_event_handling_on_collecting_node(*, node_rank, node_pool_size)

Initializes Eiger's HTTP/REST event handling on the collecting node.

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

Raises:

Type Description
OmHttpInterfaceInitializationError

Raised when an error happens during the initialization of the Eiger'S HTTP/REST interface.

initialize_event_handling_on_processing_node(*, node_rank, node_pool_size)

Initializes Eiger's HTTP/REST 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

Returns:

Type Description
Any

An optional initialization token.

event_generator(*, node_rank, node_pool_size)

Retrieves events from Eiger's HTTP/REST interface.

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 event from Eiger's HTTP/REST interface (a single detector data frame).

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 Eiger's HTTP/REST interface event.

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

Events from Eiger's HTTP/REST interface 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 Eiger's HTTP/REST interface event.

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

Events from Eiger's HTTP/REST interface 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 Eiger HTTP/REST 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.

  • Each dictionary key identifies a Data Source in the event for which data has been retrieved.

  • The corresponding dictionary value stores the data extracted from the Data Source for the event being processed.

Raises:

Type Description
OmDataExtractionError

Raised when data cannot be extracted from the event.

initialize_event_data_retrieval()

Initializes event data retrievals from from Eiger's HTTP/REST interface.

Eiger's HTTP/REST interface does not allow the retrieval of single standalone data events, so this function has no implementation.

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

Raises:

Type Description
NotImplementedError

This functionality has not been implemented for this Data Event Handler.

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.

Eiger's HTTP/REST interface does not allow the retrieval of standalone data events, so this function has no implementation.

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 detector event.

Raises:

Type Description
NotImplementedError

This functionality has not been implemented for this Data Event Handler.