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>();
120 using boost::property_tree::ptree;
129 if (
mon_.isAvailable()) {
137 mon_->registerExtra(
"lumiSeen", children);
155 auto last_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
159 if ((!ignoreTimers) && (last_ms < 100)) {
166 std::time_t
t = boost::filesystem::last_write_time(
runPath_);
176 using boost::filesystem::directory_iterator;
177 using boost::filesystem::directory_entry;
181 directory_iterator dend;
182 for (directory_iterator di(
runPath_); di != dend; ++di) {
183 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)(_.*).jsn");
189 if (boost::regex_match(filename, result, fn_re)) {
190 unsigned int run = std::stoi(result[1]);
191 unsigned int lumi = std::stoi(result[2]);
198 if ((lumi == 0) && (label ==
"_EoR") && (!
eor_.
loaded)) {
210 logFileAction(
"Found and skipped json file (stream label mismatch): ",
221 if (!fn_eor.empty()) {
240 using std::chrono::high_resolution_clock;
241 using std::chrono::duration_cast;
242 using std::chrono::milliseconds;
250 state_ = State::EOR_CLOSING;
260 auto elapsed_ms = duration_cast<milliseconds>(elapsed).
count();
275 if (
state_ == State::EOR_CLOSING) {
287 if (
state_ != old_state) {
301 const char*
x = getenv(
"WATCHDOG_FD");
319 ->setComment(
"Run number passed via configuration file.");
322 ->setComment(
"Data filename position in the positional arguments array 'data' in json file.");
325 ->setComment(
"Stream label used in json discovery.");
328 ->setComment(
"Number of milliseconds to wait between file checks.");
330 desc.
addUntracked<int32_t>(
"nextLumiTimeoutMillis", -1)->setComment(
331 "Number of milliseconds to wait before switching to the next lumi "
332 "section if the current is missing, -1 to disable.");
335 ->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_
std::chrono::high_resolution_clock::time_point runPathLastCollect_
std::time_t runPathMTime_
static void fillDescription(edm::ParameterSetDescription &d)
void collect(bool ignoreTimers)