Skip to content
Snippets Groups Projects
Commit 91a7345e authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau Committed by Volker Friese
Browse files

Add ZMQ to Cbmroot deps + ZMQ iface & boost deser. example to histserv_nofairmq

parent e2f57330
No related branches found
No related tags found
1 merge request!1212Add services main folder + histogram server binary w/o FairMQ + tester binary example
...@@ -129,6 +129,13 @@ if(FAIRROOT_FOUND) ...@@ -129,6 +129,13 @@ if(FAIRROOT_FOUND)
endif() endif()
#Searching for Boost Package
find_package(ZeroMQ)
if(ZeroMQ_FOUND)
list(APPEND packages ZeroMQ)
endif()
#Searching for Boost Package #Searching for Boost Package
find_package(Boost COMPONENTS serialization regex filesystem log log_setup container program_options thread) find_package(Boost COMPONENTS serialization regex filesystem log log_setup container program_options thread)
if(Boost_FOUND) if(Boost_FOUND)
......
Histo source: class/lib + EventBuildChain
- Members: hostname, port, ZMQ socket, list of known histo names
- Interface method/constructor: init socket
=> Type? PUB or PUSH?
- Interface function: new entry <histo name, histo, (folder)>
=> Check if histo already known
=> No = add config part to message with <histo name, folder>
=> Add part to message with <histo name, histo>
-> How do we stream the Histo1D object? boost streamer call?
- Message format
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Histo consummer: histserv
- Members: ZMQ socket
- Interface function: init socket
=> Type? SUB or PULL?
=> PULL
- Exec method: ZMQ poll/get loop
=> Blocking?
=> Exit condition?
- Config deserialization: boost?
- Histos deserialization: boost?
- Message processing: parts + calls to deserialization methods for Config and histo depending on size
This diff is collapsed.
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include "THttpServer.h" #include "THttpServer.h"
#include "TObjArray.h" #include "TObjArray.h"
#include <memory>
#include <string> #include <string>
#include <thread> #include <thread>
#include <zmq.hpp>
#include "ProgramOptions.h" #include "ProgramOptions.h"
...@@ -43,15 +43,12 @@ namespace cbm::services::histserv ...@@ -43,15 +43,12 @@ namespace cbm::services::histserv
void UpdateHttpServer(); void UpdateHttpServer();
private: private:
const std::string& OutputFile() const;
const std::string& ParamFile() const;
const std::string& SetupTag() const;
//const std::string& ConfigFile() const; //const std::string& ConfigFile() const;
bool ReceiveData(/*FIXME_SOMETHING_To_Replace_FairMQ& parts*/); bool ReceiveData(zmq::message_t& msg);
bool ReceiveHistoConfig(/*FIXME_SOMETHING_To_Replace_FairMQ& parts*/); bool ReceiveHistoConfig(zmq::message_t& msg);
bool ReceiveCanvasConfig(/*FIXME_SOMETHING_To_Replace_FairMQ& parts*/); bool ReceiveCanvasConfig(zmq::message_t& msg);
bool ReceiveConfigAndData(/*FIXME_SOMETHING_To_Replace_FairMQ& parts*/); bool ReceiveConfigAndData(std::vector<zmq::message_t>& vMsg);
template<class HistoT> template<class HistoT>
bool ReadHistogram(HistoT* pHist); bool ReadHistogram(HistoT* pHist);
...@@ -67,6 +64,10 @@ namespace cbm::services::histserv ...@@ -67,6 +64,10 @@ namespace cbm::services::histserv
std::thread fThread; std::thread fThread;
bool fStopThread = false; bool fStopThread = false;
/// Interface
zmq::context_t fZmqContext {1};
zmq::socket_t fZmqSocket {fZmqContext, ZMQ_PULL};
/// Array of histograms with unique names /// Array of histograms with unique names
TObjArray fArrayHisto; TObjArray fArrayHisto;
/// Vector of string with ( HistoName, FolderPath ) to configure the histogram /// Vector of string with ( HistoName, FolderPath ) to configure the histogram
......
...@@ -38,6 +38,8 @@ target_link_libraries(histserv_nofairmq ...@@ -38,6 +38,8 @@ target_link_libraries(histserv_nofairmq
ROOT::Hist ROOT::Hist
ROOT::RIO ROOT::RIO
ROOT::RHTTP ROOT::RHTTP
libzmq
cppzmq
) )
install(TARGETS histserv_nofairmq DESTINATION bin) install(TARGETS histserv_nofairmq DESTINATION bin)
...@@ -34,8 +34,9 @@ namespace cbm::services::histserv ...@@ -34,8 +34,9 @@ namespace cbm::services::histserv
// --- Define configuration options // --- Define configuration options
po::options_description config("Configuration"); po::options_description config("Configuration");
auto config_add = config.add_options(); auto config_add = config.add_options();
config_add("input,i", po::value<string>(&fsChanHistosIn)->value_name("<???????>"), config_add("input,i", po::value<string>(&fsChanHistosIn)->value_name("<protocol://xxxxxx>"),
"name or host:port or whatever is needed for input channel (histos/canvases config and data)"); "name or host:port or whatever is needed for input channel (histos/canvases config and data), "
" cf http://api.zeromq.org/2-1:zmq-bind");
config_add("port,p", po::value<uint32_t>(&fuHttpServerPort)->default_value(8080), config_add("port,p", po::value<uint32_t>(&fuHttpServerPort)->default_value(8080),
"port on which the http ROOT server (JSroot) will be available"); "port on which the http ROOT server (JSroot) will be available");
config_add("output,o", po::value<string>(&fsHistoFileName)->value_name("<file name>"), config_add("output,o", po::value<string>(&fsHistoFileName)->value_name("<file name>"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment