17 #include <sys/types.h> 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);
90 h.save(tmp_root_fp,
"",
fp.run_,
true,
"RECREATE");
95 std::ofstream meta_fd(tmp_meta_fp);
99 checkError(
"Rename failed: ", root_fp, ::
rename(tmp_root_fp.c_str(), root_fp.c_str()));
100 checkError(
"Rename failed: ", meta_fp, ::
rename(tmp_meta_fp.c_str(), meta_fp.c_str()));
121 checkError(
"Unlink failed: ",
x.meta, ::unlink(
x.meta.c_str()));
124 checkError(
"Unlink failed: ",
x.data, ::unlink(
x.data.c_str()));
130 if (!
f.data.empty()) {
138 actual_msg += std::strerror(
status);
149 const EVP_MD* md = EVP_get_digestbyname(
"MD5");
150 unsigned int md_len = 0;
151 unsigned char md5[EVP_MAX_MD_SIZE];
153 boost::iostreams::mapped_file_source
fp(
filename);
155 EVP_DigestInit_ex(mdctx, md,
nullptr);
156 EVP_DigestUpdate(mdctx, (
unsigned char*)
fp.data(),
fp.size());
157 EVP_DigestFinal_ex(mdctx, md5, &md_len);
160 std::ostringstream
hash;
161 for (
unsigned int i = 0;
i < md_len;
i++) {
162 hash << std::hex << std::setfill(
'0') << std::setw(2) << (
int)md5[
i];
165 std::ostringstream
out;
166 out <<
"md5:" <<
hash.str() <<
" " <<
fp.size() <<
" " << final_filename;
172 desc.setComment(
"Saves histograms from DQM store, online workflow.");
174 desc.addUntracked<
int>(
"backupLumiCount", 10)
176 "How often the backup file will be generated, in lumisections (-1 " 179 desc.addUntracked<
bool>(
"keepBackupLumi",
false)
181 "Usually the backup old backup is deleted once the new file is " 182 "available. Setting this to true ensures that no backup files are " 183 "ever deleted. Useful for ML applications, which use backups as a " 184 "'history' of what happened during the run.");
void logFileAction(const std::string &msg, const std::string &fileName) const
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 saveJobReport(const std::string &filename) const
T getUntrackedParameter(std::string const &, T const &) const
void appendSnapshot(SnapshotFiles new_snap) const
void checkError(const char *msg, const std::string &file, int status) const
void addDefault(ParameterSetDescription const &psetDescription)
~DQMFileSaverOnline() override
#define DEFINE_FWK_MODULE(type)
std::list< SnapshotFiles > snapshots_
std::mutex snapshots_lock_
void saveRun(const FileParameters &fp) const override
void makeSnapshot(const FileParameters &fp, bool final) const
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