Skip to content
Snippets Groups Projects
Commit 5acfd390 authored by Jan de Cuveland's avatar Jan de Cuveland Committed by Florian Uhlig
Browse files

Add HttpServer and configuration to cbmreco_fairrun

parent 12609505
No related branches found
No related tags found
1 merge request!833Add HttpServer and refresh rate configuration to cbmreco_fairrun
Pipeline #17455 passed
......@@ -10,7 +10,8 @@ Application::Application(ProgramOptions const& opt) : fOpt(opt)
config.LoadYaml(fOpt.ConfigYamlFile());
if (!fOpt.SaveConfigYamlFile().empty()) { config.SaveYaml(fOpt.SaveConfigYamlFile()); }
fCbmReco = std::make_unique<CbmReco>(fOpt.InputUri(), fOpt.OutputRootFile(), fOpt.MaxNumTs(), config);
fCbmReco =
std::make_unique<CbmReco>(fOpt.InputUri(), fOpt.OutputRootFile(), fOpt.MaxNumTs(), config, fOpt.HttpServerPort());
}
void Application::Run() { fCbmReco->Run(); }
......@@ -49,6 +49,8 @@ void ProgramOptions::ParseOptions(int argc, char* argv[])
"save configuration to yaml file (mostly for debugging)");
config_add("max-timeslice-number,n", po::value<int32_t>(&fMaxNumTs)->value_name("<n>"),
"quit after processing given number of timeslices (default: unlimited)");
config_add("http-server-port,p", po::value<uint16_t>(&fHttpServerPort)->value_name("<n>"),
"port number for the HTTP server. If 0, server will not be activated (default)");
po::options_description cmdline_options("Allowed options");
cmdline_options.add(generic).add(config);
......
......@@ -51,6 +51,9 @@ public:
/** @brief Get maximum number of timeslices to process **/
[[nodiscard]] int32_t MaxNumTs() const { return fMaxNumTs; }
/** @brief Get the port number for the HTTP server **/
[[nodiscard]] uint16_t HttpServerPort() const { return fHttpServerPort; }
private:
/** @brief Parse command line arguments using boost program_options **/
void ParseOptions(int argc, char* argv[]);
......@@ -59,7 +62,8 @@ private:
std::string fOutputRootFile = "/dev/null"; ///< Output file name (.root format)
std::string fConfigYamlFile; ///< Configuration file name (.yaml format)
std::string fSaveConfigYamlFile; ///< Save configuration file name (.yaml format)
int32_t fMaxNumTs = INT32_MAX; ///< Maximum number of timeslices to process
int32_t fMaxNumTs = INT32_MAX; ///< Maximum number of timeslices to process
uint16_t fHttpServerPort = 0; ///< Port number for the HTTP server. If 0, server will not be activated.
};
#endif /* APP_CBMRECO_PROGRAMOPTIONS_H */
......@@ -56,6 +56,8 @@ void CbmRecoConfig::LoadYaml(const std::string& filename)
fStoreTimeslice = config["store"]["timeslice"].as<bool>();
fStoreTrigger = config["store"]["triggers"].as<bool>();
fStoreEvents = config["store"]["events"].as<bool>();
// --- QA publishing
fHttpServerRefreshRate = config["qa"]["refreshrate"].as<int32_t>(fHttpServerRefreshRate);
}
// ----------------------------------------------------------------------------
......@@ -79,6 +81,8 @@ void CbmRecoConfig::SaveYaml(const std::string& filename)
config["store"]["timeslice"] = fStoreTimeslice;
config["store"]["triggers"] = fStoreTrigger;
config["store"]["events"] = fStoreEvents;
// --- QA publishing
config["qa"]["refreshrate"] = fHttpServerRefreshRate;
// ---
std::ofstream fout(filename);
fout << config;
......@@ -200,8 +204,7 @@ int32_t CbmReco::Run()
// ----- HttpServer for online monitoring
if (fHttpServerPort) {
Int_t serverRefreshRate = 100; // timeslices
run.ActivateHttpServer(serverRefreshRate, fHttpServerPort);
run.ActivateHttpServer(fConfig.fHttpServerRefreshRate, fHttpServerPort);
run.GetHttpServer()->GetSniffer()->SetScanGlobalDir(kFALSE);
}
......
......@@ -32,6 +32,8 @@ public:
bool fStoreTimeslice = false;
bool fStoreTrigger = false;
bool fStoreEvents = false;
// --- QA publishing
int32_t fHttpServerRefreshRate = 100;
// --- Load/save using yaml-cpp
void LoadYaml(const std::string& filename);
void SaveYaml(const std::string& filename);
......
......@@ -10,3 +10,5 @@ store:
timeslice: false
triggers: false
events: true
qa:
refreshrate: 100
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