Skip to content

Commit f432178

Browse files
committed
By default avoid MD5 calc. for epn2eos metadata
As it takes > 2 s/GB, becoming too slow for CTF file. The MD5 can be still calculated by reguesting it explicitly FileMetaData::fillFileData(const std::string& fname, bool md5)
1 parent 806fc6f commit f432178

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/FileMetaData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct FileMetaData { // https://docs.google.com/document/d/1nH9EZEF
4545
size_t size{}; // 6, default the size of the lurl file, optional
4646
int persistent{}; // 16, default is forever, optional
4747
std::vector<uint32_t> tfOrbits; // 15, comma-sep. list of 1st orbits of TFs, optional
48-
bool fillFileData(const std::string& fname);
48+
bool fillFileData(const std::string& fname, bool md5 = false);
4949
void setDataTakingContext(const o2::framework::DataTakingContext& dtc);
5050
std::string asString() const;
5151
};

DataFormats/Detectors/Common/src/FileMetaData.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@
2020

2121
using namespace o2::dataformats;
2222

23-
bool FileMetaData::fillFileData(const std::string& fname)
23+
bool FileMetaData::fillFileData(const std::string& fname, bool md5)
2424
{
2525
try {
2626
lurl = std::filesystem::canonical(fname).string();
2727
size = std::filesystem::file_size(lurl);
28-
std::unique_ptr<TMD5> md5ptr{TMD5::FileChecksum(fname.c_str())};
29-
md5 = md5ptr->AsString();
28+
if (md5) {
29+
std::unique_ptr<TMD5> md5ptr{TMD5::FileChecksum(fname.c_str())};
30+
md5 = md5ptr->AsString();
31+
}
3032
ctime = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
3133
} catch (std::exception const& e) {
3234
LOG(error) << "Failed to fill metadata for file " << fname << ", reason: " << e.what();

0 commit comments

Comments
 (0)