From 0559eacd17304efa031b53dbadcd1e668e06970d Mon Sep 17 00:00:00 2001 From: Rocco Ardino <rocco.ardino@cern.ch> Date: Fri, 5 Apr 2024 18:41:32 +0200 Subject: [PATCH] Revert "Handle properly not complete file after run stop" This reverts commit ae9fe10766709670201c82aa82f8798aa2b73e10 --- src/OutputFileHandler.cc | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/OutputFileHandler.cc b/src/OutputFileHandler.cc index f428e192..0ea77ab6 100644 --- a/src/OutputFileHandler.cc +++ b/src/OutputFileHandler.cc @@ -76,15 +76,7 @@ bool OutputFileHandler::MaybeCommitFile(uint32_t run, uint32_t index) { // OutputFileHandler::write_EoR_file(); // } - // if new run is detected, it's likely that last file of previous run - // is not complete, so don't enqueue for closure and nullify it to avoid problems - if (is_new_run) { - outputFile_.nullify(); - UpdateRunInfo(run, index); - return true; - } - // if inside the run a new file index has been detected, prepare for closure - if (is_new_index) { + if (is_new_run || is_new_index) { enqueue_current_file_for_close_and_move_maybe(); UpdateRunInfo(run, index); return true; @@ -188,19 +180,15 @@ void OutputFileHandler::close_and_rename::operator()() const { } std::string from = outputFile.getRunDir() + "/" + working_dir_ + "/" + outputFile.getFileName(); std::string to = outputFile.getRunDir() + "/" + outputFile.getFileName(); - // if file rename has failed (for instance, when a new run - // starts and open file from previous run can't be closed) - // then we don't update the counters - // TODO: this error needs to be fatal in the future if (rename(from.c_str(), to.c_str()) != 0) { LOG(ERROR) << tools::strerror("File rename of " + outputFile.getFileName() + " failed"); - } else { - // counters update logic - outputfilehandler_->updateLumisectionFileSize(outputFile.getFileSize()); - outputfilehandler_->updateLumisectionNOrbits(outputFile.getNOrbits()); - outputfilehandler_->updateLumisectionNFiles(1); } + // TODO: new counters logic here to be tested + outputfilehandler_->updateLumisectionFileSize(outputFile.getFileSize()); + outputfilehandler_->updateLumisectionNOrbits(outputFile.getNOrbits()); + outputfilehandler_->updateLumisectionNFiles(1); + if (outputFile.Index() == outputfilehandler_->max_index_per_ls_ && outputfilehandler_->getCMSSWHeaders() && outputfilehandler_->isMainPipeline()) { // end of lumisection outputfilehandler_->write_EoLS_file(outputFile.Lumisection()); -- GitLab