|
17 | 17 | #include "CommonUtils/FileSystemUtils.h" |
18 | 18 | #include "Framework/Logger.h" |
19 | 19 | #include <filesystem> |
| 20 | +#include <fmt/chrono.h> |
20 | 21 | #include <fstream> |
21 | 22 | #include <memory> |
22 | 23 | #include <thread> |
@@ -183,6 +184,7 @@ size_t FileFetcher::popFromQueue(bool discard) |
183 | 184 | } |
184 | 185 | auto id = mQueue.front(); |
185 | 186 | mQueue.pop(); |
| 187 | + LOGP(info, "removing processed {} from the queue, discard flag is {}", mInputFiles[id].getLocalName(), discard); |
186 | 188 | if (discard) { |
187 | 189 | discardFile(mInputFiles[id].getLocalName()); |
188 | 190 | } |
@@ -234,6 +236,19 @@ void FileFetcher::cleanup() |
234 | 236 | throw std::runtime_error("FileFetcher thread is still active, cannot cleanup"); |
235 | 237 | } |
236 | 238 | if (mNRemote && o2::utils::Str::pathExists(mCopyDirName)) { |
| 239 | + try { |
| 240 | + LOGP(info, "FileFetcher scratch directory {} contents (modification date, size in bytes, name):", mCopyDirName); |
| 241 | + for (const auto& entry : fs::directory_iterator(mCopyDirName)) { |
| 242 | + const auto fileTime = entry.last_write_time(); |
| 243 | + const auto systemTime = std::chrono::time_point_cast<std::chrono::system_clock::duration>( |
| 244 | + fileTime - fs::file_time_type::clock::now() + std::chrono::system_clock::now()); |
| 245 | + const auto modificationTime = std::chrono::system_clock::to_time_t(systemTime); |
| 246 | + const auto size = entry.is_regular_file() ? std::to_string(entry.file_size()) : "-"; |
| 247 | + LOGP(info, "{:%Y-%m-%d %H:%M:%S} {} {}", fmt::localtime(modificationTime), size, entry.path().filename().string()); |
| 248 | + } |
| 249 | + } catch (const std::exception& e) { |
| 250 | + LOGP(error, "FileFetcher failed to list scratch directory {}: {}", mCopyDirName, e.what()); |
| 251 | + } |
237 | 252 | try { |
238 | 253 | fs::remove_all(mCopyDirName); |
239 | 254 | } catch (...) { |
@@ -319,6 +334,7 @@ void FileFetcher::discardFile(const std::string& fname) |
319 | 334 | mInputFiles[ent->second - 1].copied = false; |
320 | 335 | fs::remove(fname); |
321 | 336 | mCopied.erase(fname); |
| 337 | + LOGP(info, "removing processed file {} from the disk", fname); |
322 | 338 | } |
323 | 339 | } |
324 | 340 |
|
|
0 commit comments