 |
Belle II Software
release-05-02-19
|
12 #include <framework/core/Module.h>
13 #include <framework/core/EventProcessor.h>
14 #include <framework/core/Path.h>
15 #include <framework/pcore/zmq/utils/ZMQParent.h>
37 class HLTEventProcessor :
public EventProcessor {
59 std::vector<std::unique_ptr<zmq::socket_t>>
m_sockets;
86 bool processEvent(PathIterator moduleIter,
bool firstRound);
bool forkOut()
Helper function to fork out. Sets the Python state correctly and adds the process to the internal sta...
bool processEvent(PathIterator moduleIter, bool firstRound)
Process a single event by iterating through the module path once.
ZMQParent m_parent
An instance of a ZMQParent to create sockets for unregistering workers.
std::vector< std::unique_ptr< zmq::socket_t > > m_sockets
The created sockets for unregistering workers. TODO: use connections.
HLTEventProcessor(const std::vector< std::string > &outputAddresses)
Create a new event processor and store the ZMQ addresses where to unregister workers.
void release()
Release the parent resource, which is needed after forking to not close it twice.
void process(PathPtr spath, bool restartFailedWorkers)
Process the given path.
void runWorkers(PathPtr path, unsigned int numProcesses)
Fork out as much workers as requested and in each run the given path using processCore.
void sendTerminatedMessage(unsigned int pid, bool waitForConfirmation)
Send an unregister message to all sockets if the given PID died. Wait at max 10s for the confirmation...
Abstract base class for different kinds of events.
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
std::vector< int > m_processList
The current list of running processes (with their PIDs)
void processCore(PathPtr path)
Process the path by basically calling processEvent until a termination is requested.
std::pair< unsigned int, unsigned int > checkChildProcesses()
Check if one of the started processes has died.