Skip to content

socket_collector

qoa4ml.collector.socket_collector

Classes

SocketCollector

SocketCollector handles the collection of data over a TCP socket.

Parameters:

Name Type Description Default
config
SocketCollectorConfig

Configuration settings for the socket collector.

required
process_report
Callable

A callable function to process incoming reports.

required

Attributes:

Name Type Description
config SocketCollectorConfig

The socket collector configuration.

host str

The hostname or IP address to bind the socket.

port int

The port number to bind the socket.

backlog int

The maximum number of queued connections.

bufsize int

The maximum size of data to be received at once.

process_report Callable

A function to process the received report.

execution_flag bool

Flag to control the execution loop.

Methods:

Name Description
start_collecting

Start the socket server to collect and process incoming data.

Functions
__init__(config, process_report)

Initialize an instance of SocketCollector.

Parameters:

Name Type Description Default
config SocketCollectorConfig

Configuration settings for the socket collector.

required
process_report Callable

A callable function to process incoming reports.

required
start_collecting()

Start the socket server to collect and process incoming data.

Notes
  • This method starts a TCP socket server that listens for incoming connections.
  • Data received from clients is deserialized using pickle and then processed using the process_report function.
  • The server runs indefinitely until the execution_flag is set to False.