6 #include <boost/regex.hpp>
7 #include <boost/format.hpp>
8 #include <boost/range.hpp>
9 #include <boost/filesystem.hpp>
10 #include <boost/algorithm/string/predicate.hpp>
16 boost::property_tree::ptree
pt;
17 read_json(filename, pt);
24 ->
second.get_value<std::size_t>();
44 boost::property_tree::ptree
pt;
45 read_json(filename, pt);
52 ->
second.get_value<std::size_t>();
54 ->
second.get_value<std::size_t>();
139 auto last_ms = std::chrono::duration_cast<std::chrono::milliseconds>(
143 if ((!ignoreTimers) && (last_ms < 100)) {
150 std::time_t
t = boost::filesystem::last_write_time(
runPath_);
160 using boost::filesystem::directory_iterator;
161 using boost::filesystem::directory_entry;
165 directory_iterator dend;
166 for (directory_iterator di(
runPath_); di != dend; ++di) {
167 const boost::regex fn_re(
"run(\\d+)_ls(\\d+)(_.*).jsn");
173 if (boost::regex_match(filename, result, fn_re)) {
174 unsigned int run = std::stoi(result[1]);
175 unsigned int lumi = std::stoi(result[2]);
182 if ((lumi == 0) && (label ==
"_EoR") && (!
eor_.
loaded)) {
194 logFileAction(
"Found and skipped json file (stream label mismatch): ",
205 if (!fn_eor.empty()) {
224 using std::chrono::high_resolution_clock;
225 using std::chrono::duration_cast;
226 using std::chrono::milliseconds;
234 state_ = State::EOR_CLOSING;
244 auto elapsed_ms = duration_cast<milliseconds>(elapsed).
count();
259 if (
state_ == State::EOR_CLOSING) {
271 if (
state_ != old_state) {
285 const char*
x = getenv(
"WATCHDOG_FD");
303 ->setComment(
"Run number passed via configuration file.");
306 ->setComment(
"Stream label used in json discovery.");
309 ->setComment(
"Number of milliseconds to wait between file checks.");
311 desc.
addUntracked<int32_t>(
"nextLumiTimeoutMillis", -1)->setComment(
312 "Number of milliseconds to wait before switching to the next lumi "
313 "section if the current is missing, -1 to disable.");
316 ->setComment(
"Directory where the DQM files will appear.");
T getUntrackedParameter(std::string const &, T const &) const
std::string make_path_data(const LumiEntry &lumi)
static LumiEntry load_json(const std::string &filename, int lumiNumber, JsonType type)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
DQMFileIterator(ParameterSet const &pset, JsonType t)
void advanceToLumi(unsigned int lumi)
string format
Some error handling for the usage.
std::map< unsigned int, LumiEntry > lumiSeen_
U second(std::pair< T, U > const &p)
std::string to_string(const T &t)
tuple path
else: Piece not in the list, fine.
const LumiEntry & front()
void logFileAction(const std::string &msg, const std::string &fileName="") const
static void fillDescription(ParameterSetDescription &d)
unsigned int lastLumiFound()
std::chrono::high_resolution_clock::time_point lastLumiLoad_
std::chrono::high_resolution_clock::time_point runPathLastCollect_
unsigned long delayMillis_
long nextLumiTimeoutMillis_
static EorEntry load_json(const std::string &filename)
void collect(bool ignoreTimers)
unsigned int currentLumi_
std::time_t runPathMTime_