17 #include <sys/types.h>
25 #include <openssl/md5.h>
27 #include <boost/iostreams/device/mapped_file.hpp>
52 gethostname(hostname, 64);
57 snprintf(suffix, 127,
".ls%08ld_host%s_pid%08d", fp.
lumi_, hostname, pid);
91 h.
save(tmp_root_fp,
"", fp.
run_,
true,
"RECREATE");
96 std::ofstream meta_fd(tmp_meta_fp);
100 checkError(
"Rename failed: ", root_fp, ::rename(tmp_root_fp.c_str(), root_fp.c_str()));
101 checkError(
"Rename failed: ", meta_fp, ::rename(tmp_meta_fp.c_str(), meta_fp.c_str()));
131 if (!f.
data.empty()) {
139 actual_msg += std::strerror(status);
148 unsigned char md5[MD5_DIGEST_LENGTH];
150 boost::iostreams::mapped_file_source
fp(filename);
152 MD5((
unsigned char*)fp.data(), fp.size(), md5);
154 std::ostringstream
hash;
155 for (
unsigned char&
i : md5) {
156 hash << std::hex << std::setfill(
'0') << std::setw(2) << (int)
i;
159 std::ostringstream
out;
160 out <<
"md5:" << hash.str() <<
" " << fp.size() <<
" " << final_filename;
166 desc.
setComment(
"Saves histograms from DQM store, online workflow.");
170 "How often the backup file will be generated, in lumisections (-1 "
175 "Usually the backup old backup is deleted once the new file is "
176 "available. Setting this to true ensures that no backup files are "
177 "ever deleted. Useful for ML applications, which use backups as a "
178 "'history' of what happened during the run.");
T getUntrackedParameter(std::string const &, T const &) const
void saveJobReport(const std::string &filename) const
void save(std::string const &filename, std::string const &path="", uint32_t const run=0, bool saveall=true, std::string const &fileupdate="RECREATE")
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
static const std::string fillOrigin(const std::string &filename, const std::string &final_filename)
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)
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_
void saveRun(const FileParameters &fp) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescription(edm::ParameterSetDescription &d)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
DQMFileSaverOnline(const edm::ParameterSet &ps)
void saveLumi(const FileParameters &fp) const override