DataLoggerManager
class DataLoggerManager : public karabo::core::Device
@brief The DataLoggerManager manages device loggers in the distributed system.
In the Karabo distributed system two types of data archiving exist:
- run associated archival of scientific data through the DAQ system
- constant device state and slow control logging using the data logger services
This device manages the data loggers used in the second logging scenario. It is the central configuration point to set via its expected parameters the
- flushInterval: at which loggers flush their data to disk
- maximumFileSize: of log files after which a new log file chunk is created
- directory: the directory into which loggers should write their data
- serverList: a list of device servers which each runs one logger. Each device in the distributed system is assigned to one logger. They are added to the loggers on these servers in a round robin fashion, allowing for load balancing. Assignment is made permanent in a loggermap.xml file that is regularly written to disk. This allows to distribute the servers in the serverList to be distributed among several hosts and still have fixed places for reading the data back.
Variables
| Name | Description |
|---|---|
| m_checkStatus | 1st level keys: entries in m_serverList, 2nd level: "state", "backlog", "beingAdded" and "devices" |
| m_knownClasses | Keep track of all important stuff during check |
| m_strand | to be accessed on the strand |
| m_blockListFile | Hash with 'deviceIds' and 'classIds' entries |
Functions
| Name | Description |
|---|---|
| checkSummary | Assemble summary from m_checkStatus and clear for next use. |
| printLoggerData | Print internal cash of logger status. |
| forceDeviceToBeLogged | If deviceId's logging status is fishy, re-add to its logger. |
| slotGetLoggerMap | Request the current mapping of loggers to servers. |
| loggerServerId | Get id of server that should run logger for given device that should be logged deviceId : the device that should be logged addIfNotYetInMap : whether to create a server/logger relation in the logger map in case it does not yet exist for deviceId Return : the server id - can be empty if addIfNotYetInMap == false |
| serverIdToLoggerId | Get id of DataLogger running on server with id 'serverId' |
| loggerIdToServerId | Get id of server that should run logger with id 'loggerId' |
| allowLock | This device may not be locked Return : false |
| evaluateBlockedOnStrand | @brief Evaluate old and new configuration in order to possibly start/stop archiving for some devices/device classes oldList : old configuration for blocked devices/classes newList : new configuration for blocked devices/classes |
| makeLoggersTable | @brief create a vector of hashes that can be loaded in a table from the Hash with the mapping device -> logger |
Variable Details
m_blockListFile
const std::string m_blockListFile
Hash with 'deviceIds' and 'classIds' entries
m_checkStatus
karabo::data::Hash m_checkStatus
1st level keys: entries in m_serverList, 2nd level: "state", "backlog",
"beingAdded" and "devices"
m_knownClasses
std::unordered_map<std::string, std::set<std::string>> m_knownClasses
Keep track of all important stuff during check
m_strand
karabo::net::Strand::Pointer m_strand
to be accessed on the strand
Function Details
allowLock
bool allowLock() const
This device may not be locked
Return : false
checkSummary
std::pair<bool, std::string> checkSummary()
Assemble summary from m_checkStatus and clear for next use. The boolean returned tells whether the status requires operator attention.
evaluateBlockedOnStrand
void evaluateBlockedOnStrand(const karabo::data::Hash& oldList, const karabo::data::Hash& newList)
@brief Evaluate old and new configuration in order to possibly start/stop archiving for some devices/device classes
oldList
: old configuration for blocked devices/classes
newList
: new configuration for blocked devices/classes
forceDeviceToBeLogged
void forceDeviceToBeLogged(const std::string& deviceId)
If deviceId's logging status is fishy, re-add to its logger. Needs to be protected by m_strand.
deviceId
: the fishy device
loggerIdToServerId
inline std::string loggerIdToServerId(const std::string& loggerId) const
Get id of server that should run logger with id 'loggerId'
loggerServerId
std::string loggerServerId(const std::string& deviceId, bool addIfNotYetInMap)
Get id of server that should run logger for given device that should be logged
deviceId
: the device that should be logged
addIfNotYetInMap
: whether to create a server/logger relation in the logger map
in case it does not yet exist for deviceId
Return : the server id - can be empty if addIfNotYetInMap == false
makeLoggersTable
std::vector<karabo::data::Hash> makeLoggersTable()
@brief create a vector of hashes that can be loaded in a table from the Hash with the mapping device -> logger
printLoggerData
void printLoggerData() const
Print internal cash of logger status. Needs to be protected by m_strand.
serverIdToLoggerId
inline std::string serverIdToLoggerId(const std::string& serverId) const
Get id of DataLogger running on server with id 'serverId'
slotGetLoggerMap
void slotGetLoggerMap()
Request the current mapping of loggers to servers. The reply contains a Hash where the the logger id is the key and the server id the value.