Skip to content

Commit 95e8824

Browse files
committed
Update cleanup
1 parent 1270a82 commit 95e8824

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

ALICE3/Core/DelphesO2TrackSmearer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool TrackSmearer::loadTable(int pdg, const char* filename, bool forceReload)
6464
return false;
6565
}
6666

67-
const std::string localFilename = o2::fastsim::GeometryEntry::accessFile(filename, "./.ALICE3/LUTs/", mCcdbManager);
67+
const std::string localFilename = o2::fastsim::GeometryEntry::accessFile(filename, "./.ALICE3/LUTs/", mCcdbManager, 60);
6868
mLUTHeader[ipdg] = new lutHeader_t;
6969

7070
std::ifstream lutFile(localFilename, std::ifstream::binary);

ALICE3/Core/GeometryContainer.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ std::map<std::string, std::map<std::string, std::string>> GeometryEntry::parseTE
7777
return configMap;
7878
}
7979

80+
bool GeometryContainer::mCleanLutWhenLoaded = true;
8081
void GeometryContainer::init(o2::framework::InitContext& initContext)
8182
{
8283
std::vector<std::string> detectorConfiguration;
@@ -219,7 +220,7 @@ std::string GeometryEntry::accessFile(const std::string& path, const std::string
219220
LOG(info) << " --- CCDB source detected for detector geometry " << path;
220221
std::map<std::string, std::string> metadata;
221222
bool status = ccdb->getCCDBAccessor().retrieveBlob(ccdbPath, downloadPath, metadata, 1);
222-
if(!status) {
223+
if (!status) {
223224
flock(lockFd, LOCK_UN);
224225
close(lockFd);
225226
LOG(fatal) << " --- Failed to retrieve geometry configuration from CCDB for path: " << ccdbPath;
@@ -251,10 +252,11 @@ std::string GeometryEntry::accessFile(const std::string& path, const std::string
251252
close(lockFd);
252253

253254
// If timeout is specified, schedule file deletion after timeout
254-
if (timeoutSeconds > 0) {
255+
if (timeoutSeconds > 0 && GeometryContainer::cleanLutWhenLoaded()) {
256+
LOG(info) << " --- Deleting geometry configuration file after timeout: " << localPath;
255257
std::thread deletionThread([localPath, doneFile, timeoutSeconds]() {
258+
LOG(info) << " --- Operating deletion of geometry configuration file after timeout: " << localPath;
256259
std::this_thread::sleep_for(std::chrono::seconds(timeoutSeconds));
257-
LOG(info) << " --- Deleting geometry configuration file after timeout: " << localPath;
258260
if (std::remove(localPath.c_str()) == 0) {
259261
LOG(info) << " --- File deleted successfully: " << localPath;
260262
} else {

ALICE3/Core/GeometryContainer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ class GeometryContainer
8787

8888
// Add a geometry entry from a configuration file
8989
void addEntry(const std::string& filename) { mEntries.emplace_back(filename, mCcdb); }
90-
void setLutCleanupSetting(const bool cleanLutWhenLoaded) { mCleanLutWhenLoaded = cleanLutWhenLoaded; }
90+
static void setLutCleanupSetting(const bool cleanLutWhenLoaded) { mCleanLutWhenLoaded = cleanLutWhenLoaded; }
9191
void setCcdbManager(o2::ccdb::BasicCCDBManager* mgr) { mCcdb = mgr; }
9292

9393
// Getters
9494
int getNumberOfConfigurations() const { return mEntries.size(); }
9595
const std::vector<GeometryEntry>& getEntries() const { return mEntries; }
9696
const GeometryEntry& getEntry(const int id) const { return mEntries.at(id); }
9797
GeometryEntry getGeometryEntry(const int id) const { return mEntries.at(id); }
98-
bool cleanLutWhenLoaded() const { return mCleanLutWhenLoaded; }
98+
static bool cleanLutWhenLoaded() { return mCleanLutWhenLoaded; }
9999

100100
// Get configuration maps
101101
std::map<std::string, std::map<std::string, std::string>> getConfigurations(const int id) const { return mEntries.at(id).getConfigurations(); }
@@ -106,7 +106,7 @@ class GeometryContainer
106106
float getFloatValue(const int id, const std::string& layerName, const std::string& key) const { return mEntries.at(id).getFloatValue(layerName, key); }
107107

108108
private:
109-
bool mCleanLutWhenLoaded = true; // Whether to clean the LUT when loading a new geometry configuration
109+
static bool mCleanLutWhenLoaded; // Whether to clean the LUT when loading a new geometry configuration
110110
std::vector<GeometryEntry> mEntries;
111111
o2::ccdb::BasicCCDBManager* mCcdb = nullptr;
112112
};

0 commit comments

Comments
 (0)