Belle II Software
release-08-01-10
|
Class to monitor all started framework processes (input, workers, output), kill them if requested and handle the signals from the OS. More...
#include <ProcessMonitor.h>
Public Member Functions | |
void | subscribe (const std::string &pubSocketAddress, const std::string &subSocketAddress, const std::string &controlSocketAddress) |
Start listening for process management information on the given address. | |
void | waitForRunningInput (int timeout) |
Block until either the input process is running or the timeout (in seconds) is raised. | |
void | waitForRunningOutput (int timeout) |
Block until either the output process is running or the timeout (in seconds) is raised. | |
void | waitForRunningWorker (int timeout) |
Block until either the worker process is running or the timeout (in seconds) is raised. | |
void | killProcesses (unsigned int timeout) |
Ask all processes to terminate. If not, kill them after timeout seconds. | |
void | initialize (unsigned int requestedNumberOfWorkers) |
Init the processing with that many workers. | |
void | terminate () |
Terminate the processing. | |
void | reset () |
Reset the internal state. | |
void | checkMulticast (int timeout=0) |
check multicast for messages and kill workers if requested | |
void | checkChildProcesses () |
check the child processes, if one has died | |
void | checkSignals (int g_signalReceived) |
check if we have received any signal from the user or OS. Kill the processes if not SIGINT. | |
bool | hasEnded () const |
If we have received a SIGINT signal or the last process is gone, we can end smoothly. | |
unsigned int | needMoreWorkers () const |
Compare our current list of workers of how many we want to have. | |
bool | hasWorkers () const |
Check if there is at least one running worker. | |
Private Member Functions | |
unsigned int | processesWithType (const ProcType &procType) const |
Cound the number of processes with a certain type. | |
template<class ASocket > | |
void | processMulticast (const ASocket &socket) |
Process a message from the multicast. | |
Private Attributes | |
ZMQClient | m_client |
The client used for message processing. | |
unsigned int | m_requestedNumberOfWorkers = 0 |
How many workers we should request to start. | |
std::map< int, ProcType > | m_processList |
The current list of pid -> process types (to be compared to the proc handler) | |
bool | m_hasEnded = false |
Someone requested us to end the processing. | |
StreamHelper | m_streamer |
The data store streamer. | |
bool | m_receivedStatistics = false |
Did we already receive the statistics? | |
Class to monitor all started framework processes (input, workers, output), kill them if requested and handle the signals from the OS.
Is used in the ZMQ event processor and can only be used together with ZMQ.
Definition at line 28 of file ProcessMonitor.h.