ATLAS Offline Software
Loading...
Searching...
No Matches
WebdaqInfoSvc.cxx File Reference
#include "WebdaqInfoSvc.h"
#include "GaudiKernel/IIncidentSvc.h"
#include "AthenaInterprocess/Incidents.h"
#include "hltinterface/ContainerFactory.h"
#include "hltinterface/GenericHLTContainer.h"
#include "webdaq/webdaq.hpp"
#include <nlohmann/json.hpp>
#include <cstdlib>
#include <utility>
Include dependency graph for WebdaqInfoSvc.cxx:

Go to the source code of this file.

Classes

struct  WebdaqInfoSvc::Holder
 One entry per registered IS object. More...

Functions

StatusCode WebdaqInfoSvc::initialize ATLAS_NOT_THREAD_SAFE ()
 Install fatal handler with default options.

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

StatusCode WebdaqInfoSvc::initialize ATLAS_NOT_THREAD_SAFE ( )
inline

Install fatal handler with default options.

This is meant to be easy to call from python via ctypes.

Definition at line 41 of file WebdaqInfoSvc.cxx.

42{
43 //Retrieve environment variables
44 const char* tdaq_partition_cstr = std::getenv("TDAQ_PARTITION");
45 if (tdaq_partition_cstr != nullptr) {
46 m_partition = std::string(tdaq_partition_cstr);
47 ATH_MSG_INFO("Partition: " << m_partition);
48 } else {
49 ATH_MSG_ERROR("TDAQ_PARTITION environment variable not set");
50 return StatusCode::FAILURE;
51 }
52 const char* tdaqWebdaqBase_cstr = std::getenv("TDAQ_WEBDAQ_BASE");
53 if (tdaqWebdaqBase_cstr != nullptr) {
54 m_tdaqWebdaqBase = std::string(tdaqWebdaqBase_cstr);
55 ATH_MSG_INFO("TDAQ_WEBDAQ_BASE value: " << m_tdaqWebdaqBase);
56 } else {
57 ATH_MSG_ERROR("TDAQ_WEBDAQ_BASE environment variable not set! "
58 "Is needed for the IS publication through webdaq");
59 return StatusCode::FAILURE;
60 }
61 const char* tdaq_is_server = std::getenv("TDAQ_IS_SERVER");
62 if (tdaq_is_server != nullptr) {
63 m_tdaqIsServerName = std::string(tdaq_is_server);
64 } else {
65 m_tdaqIsServerName = m_isServerName.value();
66 }
67 ATH_MSG_INFO("TDAQ_IS_SERVER value: " << m_tdaqIsServerName);
68
69 // Install as the IInfoRegister singleton
70 hltinterface::IInfoRegister::setInstance(this, /*force=*/true);
71 ATH_MSG_INFO("Installed WebdaqInfoSvc as the hltinterface::IInfoRegister singleton");
72
73 // Provide a default ContainerFactory to build GenericHLTContainer instances via ContainerFactory::getInstance()
74 m_factory = hltinterface::ContainerFactory::getInstance();
75 if (m_factory) {
76 ATH_MSG_INFO("Reusing the hltinterface::ContainerFactory installed by another component");
77 }
78 else {
79 m_factory = std::make_shared<hltinterface::ContainerFactory>();
80 hltinterface::ContainerFactory::setInstance(m_factory);
81 ATH_MSG_INFO("Installed the default hltinterface::ContainerFactory");
82 }
83
84 // Start publishing thread after fork
85 ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", name());
86 ATH_CHECK( incSvc.retrieve() );
87 incSvc->addListener(this, AthenaInterprocess::UpdateAfterFork::type());
88 return StatusCode::SUCCESS;
89}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
static const std::string & type()
Incident type.
Definition Incidents.h:49