Skip to content
Snippets Groups Projects
Commit a680492f authored by Jan de Cuveland's avatar Jan de Cuveland
Browse files

Bump flesnet version, include monitoring library

parent a93dafb5
No related branches found
No related tags found
1 merge request!852Bump flesnet version, include monitoring library
......@@ -3,7 +3,7 @@
# The included libraries provide the interface to the experiment data in timeslices
# both online and in timeslice archive (.tsa) files.
set(FLESNET_VERSION b503c3ce500c1b25894c393ff4bae2f5ba058a22) # 2022-06-10
set(FLESNET_VERSION 60b074eb9d40af820201763c583fd1c67a6611a3) # 2022-06-17
set(FLESNET_SRC_URL "https://github.com/cbm-fles/flesnet")
......@@ -43,7 +43,7 @@ ExternalProject_Add(
${CMAKE_CURRENT_SOURCE_DIR}/flesnet
BUILD_IN_SOURCE 0
LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . -j 1 --target logging fles_ipc
BUILD_COMMAND ${CMAKE_COMMAND} --build . -j 1 --target logging monitoring fles_ipc
BUILD_BYPRODUCTS ${FLESNET_DESTDIR}/src/flesnet-build/lib/fles_ipc/${CMAKE_STATIC_LIBRARY_PREFIX}fles_ipc${CMAKE_STATIC_LIBRARY_SUFFIX}
INSTALL_COMMAND ""
)
......@@ -63,6 +63,21 @@ target_compile_definitions(external::fles_logging
INTERFACE BOOST_ERROR_CODE_HEADER_ONLY
)
add_library(external::fles_monitoring STATIC IMPORTED GLOBAL)
add_dependencies(external::fles_monitoring flesnet)
set_target_properties(external::fles_monitoring PROPERTIES
IMPORTED_LOCATION ${FLESNET_DESTDIR}/src/flesnet-build/lib/monitoring/${CMAKE_STATIC_LIBRARY_PREFIX}monitoring${CMAKE_STATIC_LIBRARY_SUFFIX}
)
target_include_directories(external::fles_monitoring INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/flesnet/lib/monitoring
${Boost_INCLUDE_DIRS}
)
target_compile_definitions(external::fles_monitoring
INTERFACE BOOST_LOG_DYN_LINK
INTERFACE BOOST_LOG_USE_NATIVE_SYSLOG
INTERFACE BOOST_ERROR_CODE_HEADER_ONLY
)
add_library(external::fles_ipc STATIC IMPORTED GLOBAL)
add_dependencies(external::fles_ipc flesnet external::fles_logging)
......@@ -77,12 +92,16 @@ if(GNUTLS_FOUND)
endif()
list(APPEND dir_to_link
${FLESNET_DESTDIR}/src/flesnet-build/lib/logging/${CMAKE_STATIC_LIBRARY_PREFIX}logging${CMAKE_STATIC_LIBRARY_SUFFIX}
)
${FLESNET_DESTDIR}/src/flesnet-build/lib/monitoring/${CMAKE_STATIC_LIBRARY_PREFIX}monitoring${CMAKE_STATIC_LIBRARY_SUFFIX}
${FLESNET_DESTDIR}/src/flesnet-build/_deps/fmtlib-build/${CMAKE_STATIC_LIBRARY_PREFIX}fmt${CMAKE_STATIC_LIBRARY_SUFFIX}
)
list(APPEND dir_to_link
${Boost_LOG_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_SERIALIZATION_LIBRARY}
${Boost_ASIO_LIBRARY}
${Boost_BEAST_LIBRARY}
)
if(NOT APPLE)
list(APPEND dir_to_link ${Boost_THREAD_LIBRARY})
......
......@@ -4,8 +4,15 @@
#include "Application.h"
#include <thread>
#include <chrono>
Application::Application(ProgramOptions const& opt) : fOpt(opt)
{
// start up monitoring
if (!fOpt.MonitorUri().empty()) { fMonitor = std::make_unique<cbm::Monitor>(fOpt.MonitorUri()); }
CbmRecoConfig config;
config.LoadYaml(fOpt.ConfigYamlFile());
if (!fOpt.SaveConfigYamlFile().empty()) { config.SaveYaml(fOpt.SaveConfigYamlFile()); }
......@@ -15,3 +22,10 @@ Application::Application(ProgramOptions const& opt) : fOpt(opt)
}
void Application::Run() { fCbmReco->Run(); }
Application::~Application()
{
// delay to allow monitor to process pending messages
constexpr auto destruct_delay = std::chrono::milliseconds(200);
std::this_thread::sleep_for(destruct_delay);
}
......@@ -9,6 +9,7 @@
#include <memory>
#include "Monitor.hpp"
#include "ProgramOptions.h"
#include "log.hpp"
......@@ -32,12 +33,16 @@ public:
/** @brief Assignment operator forbidden **/
void operator=(const Application&) = delete;
/** @brief Destructor **/
~Application();
/** @brief Run the application **/
void Run();
private:
ProgramOptions const& fOpt; ///< Program options object
std::unique_ptr<CbmReco> fCbmReco; ///< CBM reconstruction steering class instance
std::unique_ptr<cbm::Monitor> fMonitor; ///< The application's monitoring object
ProgramOptions const& fOpt; ///< Program options object
std::unique_ptr<CbmReco> fCbmReco; ///< CBM reconstruction steering class instance
};
#endif
......@@ -21,6 +21,7 @@ target_link_directories(cbmreco_fairrun
target_link_libraries(cbmreco_fairrun
external::fles_logging
external::fles_monitoring
CbmRecoTasks
Core
${Boost_LIBRARIES}
......
......@@ -30,6 +30,11 @@ void ProgramOptions::ParseOptions(int argc, char* argv[])
generic_add("log-file,L", po::value<std::string>(&log_file)->value_name("<filename>"), "write log output to file");
generic_add("log-syslog,S", po::value<unsigned>(&log_syslog)->implicit_value(log_syslog)->value_name("<n>"),
"enable logging to syslog at given log level");
generic_add(
"monitor,m",
po::value<std::string>(&fMonitorUri)->value_name("<uri>")->implicit_value("influx1:login:8086:tsclient_status"),
"publish program status to InfluxDB (or \"file:cout\" for "
"console output)");
generic_add("help,h", "display this help and exit");
generic_add("version,V", "output version information and exit");
......
......@@ -36,6 +36,9 @@ public:
/** @brief Assignment operator forbidden **/
void operator=(const ProgramOptions&) = delete;
/** @brief Get URI specifying the monitoring server interface **/
[[nodiscard]] const std::string& MonitorUri() const { return fMonitorUri; }
/** @brief Get URI specifying input timeslice stream source(s) **/
[[nodiscard]] const std::vector<std::string>& InputUri() const { return fInputUri; }
......@@ -58,6 +61,8 @@ private:
/** @brief Parse command line arguments using boost program_options **/
void ParseOptions(int argc, char* argv[]);
std::string fMonitorUri; ///< URI specifying the monitoring server interface
std::vector<std::string> fInputUri; ///< URI(s) specifying input timeslice stream source(s)
std::string fOutputRootFile = "/dev/null"; ///< Output file name (.root format)
std::string fConfigYamlFile; ///< Configuration file name (.yaml format)
......
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