aitune.utils.monitoring.hardware_metrics.ipc
aitune.utils.monitoring.hardware_metrics.ipc
Inter-process communication utilities.
Module Contents
Classes
Functions
API
Simple inter-process communication class to send and receive data between parent and child processes.
This is implementation for child process. It uses stdin/stdout pipes to send and receive data which is packed using pickle.
Receive data from the parent process.
Returns:
The data received from the parent process.
Raises:
ValueError: If the parent process closed the pipe.
Send data to the parent process.
Parameters:
The data to send to the parent process.
Returns:
The number of bytes sent.
Bases: Exception
Exception for IPC errors.
Simple inter-process communication class to send and receive data between parent and child processes.
This is implementation for parent process. It uses stdin/stdout pipes to send and receive data which is packed using pickle.
Note: there is assumption that parent will sent lots of small data, that is why flush_interval is used so that underlying operating system can buffer data and send it in larger chunks which improves throughput.
Flush the data to the child process.
Receive data from the child process.
Send data to the child process.
Parameters:
The data to send to the child process.
Returns:
The number of bytes sent.
Read exactly n bytes from stream, looping until all bytes are received.