15 #include <sys/types.h>
25 #include <openssl/md5.h>
26 #include <boost/iostreams/device/mapped_file.hpp>
27 #include <boost/filesystem.hpp>
56 gethostname(hostname, 64);
61 snprintf(suffix, 127,
".ls%08ld_host%s_pid%08d", fp.
lumi_, hostname, pid);
81 snprintf(rewrite, 128,
"\\1Run %ld/\\2/Run summary", fp.
run_);
83 store->save(tmp_root_fp,
85 "^(Reference/)?([^/]+)",
87 store->mtEnabled() ? fp.
run_ : 0,
97 std::ofstream meta_fd(tmp_meta_fp);
101 checkError(
"Rename failed: ", root_fp, ::rename(tmp_root_fp.c_str(), root_fp.c_str()));
102 checkError(
"Rename failed: ", meta_fp, ::rename(tmp_meta_fp.c_str(), meta_fp.c_str()));
130 if (! f.
data.empty()) {
138 actual_msg += std::strerror(status);
149 unsigned char md5[MD5_DIGEST_LENGTH];
151 boost::iostreams::mapped_file_source
fp(filename);
153 MD5((
unsigned char *)fp.data(), fp.size(), md5);
155 std::ostringstream
hash;
156 for (
int i = 0;
i < MD5_DIGEST_LENGTH; ++
i) {
157 hash << std::hex << std::setfill(
'0') << std::setw(2) << (int)(md5[
i]);
160 std::ostringstream
out;
161 out <<
"md5:" << hash.str() <<
" " << fp.size() <<
" " << final_filename;
171 desc.
setComment(
"Saves histograms from DQM store, online workflow.");
173 desc.
addUntracked<
int>(
"backupLumiCount", 10)->setComment(
174 "How often the backup file will be generated, in lumisections (-1 disables).");
178 descriptions.
add(
"saver", desc);
T getUntrackedParameter(std::string const &, T const &) const
static const std::string fillOrigin(const std::string filename, const std::string final_filename)
void saveJobReport(const std::string &filename) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
static const std::string filename(const FileParameters &fp, bool useLumi=false)
T x() const
Cartesian x coordinate.
void setComment(std::string const &value)
void appendSnapshot(SnapshotFiles new_snap) const
void checkError(const char *msg, const std::string file, int status) const
void logFileAction(const std::string &msg, const std::string &fileName) const
void makeSnapshot(const FileParameters &fp, bool final) const
std::list< SnapshotFiles > snapshots_
std::mutex snapshots_lock_
virtual void saveRun(const FileParameters &fp) const override
DQMStore::SaveReferenceTag saveReference_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescription(edm::ParameterSetDescription &d)
DQMFileSaverOnline(const edm::ParameterSet &ps)
virtual void saveLumi(const FileParameters &fp) const override