5 #include <boost/regex.hpp>
6 #include <boost/format.hpp>
7 #include <boost/range.hpp>
8 #include <boost/filesystem.hpp>
9 #include <boost/algorithm/string/predicate.hpp>
14 #include <boost/property_tree/json_parser.hpp>
15 #include <boost/property_tree/ptree.hpp>
17 namespace dqmservices {
21 boost::property_tree::ptree
pt;
22 read_json(filename, pt);
29 ->
second.get_value<std::size_t>();
43 boost::property_tree::ptree
pt;
44 read_json(filename, pt);
51 ->
second.get_value<std::size_t>();
53 ->
second.get_value<std::size_t>();
121 using boost::property_tree::ptree;
130 if (
mon_.isAvailable()) {
138 mon_->registerExtra(
"lumiSeen", children);
156 auto last_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
160 if ((!ignoreTimers) && (last_ms < 100)) {
165 std::time_t
t = boost::filesystem::last_write_time(
runPath_);
177 using boost::filesystem::directory_iterator;
178 using boost::filesystem::directory_entry;
182 directory_iterator dend;
183 for (directory_iterator di(
runPath_); di != dend; ++di) {
184 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)(_.*).jsn");
190 if (boost::regex_match(filename, result, fn_re)) {
191 unsigned int run = std::stoi(result[1]);
192 unsigned int lumi = std::stoi(result[2]);
199 if ((lumi == 0) && (label ==
"_EoR") && (!
eor_.
loaded)) {
211 logFileAction(
"Found and skipped json file (stream label mismatch): ",
222 if (!fn_eor.empty()) {
241 using std::chrono::high_resolution_clock;
242 using std::chrono::duration_cast;
243 using std::chrono::milliseconds;
251 state_ = State::EOR_CLOSING;
261 auto elapsed_ms = duration_cast<milliseconds>(elapsed).
count();
276 if (
state_ == State::EOR_CLOSING) {
288 if (
state_ != old_state) {
302 const char*
x = getenv(
"WATCHDOG_FD");
320 ->setComment(
"Run number passed via configuration file.");
323 ->setComment(
"Data filename position in the positional arguments array 'data' in json file.");
326 ->setComment(
"Stream label used in json discovery.");
329 ->setComment(
"Number of milliseconds to wait between file checks.");
331 desc.
addUntracked<int32_t>(
"nextLumiTimeoutMillis", -1)->setComment(
332 "Number of milliseconds to wait before switching to the next lumi "
333 "section if the current is missing, -1 to disable.");
336 ->setComment(
"Directory where the DQM files will appear.");
T getUntrackedParameter(std::string const &, T const &) const
unsigned long delayMillis_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
unsigned int lastLumiFound()
edm::Service< DQMMonitoringService > mon_
const LumiEntry & front()
std::map< unsigned int, LumiEntry > lumiSeen_
string format
Some error handling for the usage.
unsigned int currentLumi_
void advanceToLumi(unsigned int lumi)
std::string make_path_data(const LumiEntry &lumi)
U second(std::pair< T, U > const &p)
std::string to_string(const T &t)
DQMFileIterator(edm::ParameterSet const &pset)
tuple path
else: Piece not in the list, fine.
long nextLumiTimeoutMillis_
void logFileAction(const std::string &msg, const std::string &fileName="") const
static EorEntry load_json(const std::string &filename)
std::chrono::high_resolution_clock::time_point lastLumiLoad_
static LumiEntry load_json(const std::string &filename, int lumiNumber, unsigned int datafn_position)
unsigned int datafnPosition_
long forceFileCheckTimeoutMillis_
std::chrono::high_resolution_clock::time_point runPathLastCollect_
std::time_t runPathMTime_
static void fillDescription(edm::ParameterSetDescription &d)
void collect(bool ignoreTimers)