16 #include <sys/types.h> 24 #include <openssl/md5.h> 25 #include <boost/filesystem.hpp> 26 #include <boost/iostreams/device/mapped_file.hpp> 51 gethostname(hostname, 64);
56 snprintf(suffix, 127,
".ls%08ld_host%s_pid%08d", fp.
lumi_, hostname, pid);
76 snprintf(rewrite, 128,
"\\1Run %ld/\\2/Run summary", fp.
run_);
78 store->
save(tmp_root_fp,
80 "^(Reference/)?([^/]+)",
91 std::ofstream meta_fd(tmp_meta_fp);
95 checkError(
"Rename failed: ", root_fp, ::
rename(tmp_root_fp.c_str(), root_fp.c_str()));
96 checkError(
"Rename failed: ", meta_fp, ::
rename(tmp_meta_fp.c_str(), meta_fp.c_str()));
126 if (!f.
data.empty()) {
134 actual_msg += std::strerror(status);
143 unsigned char md5[MD5_DIGEST_LENGTH];
145 boost::iostreams::mapped_file_source
fp(filename);
147 MD5((
unsigned char*)fp.data(), fp.size(), md5);
149 std::ostringstream
hash;
150 for (
unsigned char&
i : md5) {
151 hash << std::hex << std::setfill(
'0') << std::setw(2) << (
int)
i;
154 std::ostringstream
out;
155 out <<
"md5:" << hash.str() <<
" " << fp.size() <<
" " << final_filename;
161 desc.
setComment(
"Saves histograms from DQM store, online workflow.");
165 "How often the backup file will be generated, in lumisections (-1 " 170 "Usually the backup old backup is deleted once the new file is " 171 "available. Setting this to true ensures that no backup files are " 172 "ever deleted. Useful for ML applications, which use backups as a " 173 "'history' of what happened during the run.");
T getUntrackedParameter(std::string const &, T const &) const
void saveJobReport(const std::string &filename) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
static const std::string fillOrigin(const std::string &filename, const std::string &final_filename)
void saveRun(const FileParameters &fp) const override
static const std::string filename(const FileParameters &fp, bool useLumi=false)
void checkError(const char *msg, const std::string &file, int status) const
void setComment(std::string const &value)
#define DEFINE_FWK_MODULE(type)
void addDefault(ParameterSetDescription const &psetDescription)
~DQMFileSaverOnline() override
void appendSnapshot(SnapshotFiles new_snap) 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_
DQMStore::SaveReferenceTag saveReference_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescription(edm::ParameterSetDescription &d)
void saveLumi(const FileParameters &fp) const override
DQMFileSaverOnline(const edm::ParameterSet &ps)
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")