35 #include "hep_concurrency/RecursiveMutex.h" 49 string const dev_null{
"/dev/null"};
60 static constexpr
char const* default_tmpDir{
"<parent-path-of-filename>"};
88 Name(
"fileProperties")};
108 keys.insert(
"results");
127 void postSelectProducts()
override;
129 void endJob()
override;
138 string fileNameAtOpen()
const;
139 string fileNameAtClose(
string const& currentFileName);
140 string const& lastClosedFileName()
const override;
142 void openFile(
FileBlock const&)
override;
143 void respondToOpenInputFile(
FileBlock const&)
override;
145 void respondToCloseInputFile(
FileBlock const&)
override;
146 void incrementInputFileNumber()
override;
150 void setSubRunAuxiliaryRangeSetID(
RangeSet const&)
override;
151 void setRunAuxiliaryRangeSetID(
RangeSet const&)
override;
152 bool isFileOpen()
const override;
154 bool requestsToCloseFile()
const override;
155 void startEndFile()
override;
156 void writeFileFormatVersion()
override;
157 void writeFileIndex()
override;
158 void writeEventHistory()
override;
159 void writeProcessConfigurationRegistry()
override;
160 void writeProcessHistoryRegistry()
override;
161 void writeParameterSetRegistry()
override;
162 void writeProductDescriptionRegistry()
override;
163 void writeParentageRegistry()
override;
164 void doWriteFileCatalogMetadata(
167 void writeProductDependencies()
override;
168 void finishEndFile()
override;
189 string lastClosedFileName_{};
207 RootOutput::~RootOutput() =
default;
211 ,
mutex_{
"RootOutput::mutex_"}
235 config.get_PSet().has_key(
config().fileProperties.name()),
237 config().fileProperties())}
256 <<
" has parameter writeParameterSets set to false.\n" 257 <<
"Parameter set provenance will not be available in subsequent " 259 <<
"Check your experiment's policy on this issue to avoid future " 261 <<
"with analysis reproducibility.\n";
268 RecursiveMutexSentry sentry{
mutex_, __func__};
282 RecursiveMutexSentry sentry{
mutex_, __func__};
291 RecursiveMutexSentry sentry{
mutex_, __func__};
298 (rfb->tree() !=
nullptr) &&
303 <<
"Fast cloning deactivated for this input file due to " 304 <<
"empty event tree and/or event limits.";
306 if (fastCloneThisOne && !rfb->fastClonable()) {
308 <<
"Fast cloning deactivated for this input file due to " 309 <<
"information in FileBlock.";
310 fastCloneThisOne =
false;
319 RecursiveMutexSentry sentry{
mutex_, __func__};
327 RecursiveMutexSentry sentry{
mutex_, __func__};
336 RecursiveMutexSentry sentry{
mutex_, __func__};
350 RecursiveMutexSentry sentry{
mutex_, __func__};
357 RecursiveMutexSentry sentry{
mutex_, __func__};
371 RecursiveMutexSentry sentry{
mutex_, __func__};
378 RecursiveMutexSentry sentry{
mutex_, __func__};
389 RecursiveMutexSentry sentry{
mutex_, __func__};
390 auto resp = make_unique<ResultsPrincipal>(
396 resp->addToProcessHistory();
406 RecursiveMutexSentry sentry{
mutex_, __func__};
413 RecursiveMutexSentry sentry{
mutex_, __func__};
420 RecursiveMutexSentry sentry{
mutex_, __func__};
427 RecursiveMutexSentry sentry{
mutex_, __func__};
434 RecursiveMutexSentry sentry{
mutex_, __func__};
441 RecursiveMutexSentry sentry{
mutex_, __func__};
450 RecursiveMutexSentry sentry{
mutex_, __func__};
457 RecursiveMutexSentry sentry{
mutex_, __func__};
466 RecursiveMutexSentry sentry{
mutex_, __func__};
473 RecursiveMutexSentry sentry{
mutex_, __func__};
480 RecursiveMutexSentry sentry{
mutex_, __func__};
494 RecursiveMutexSentry sentry{
mutex_, __func__};
516 RecursiveMutexSentry sentry{
mutex_, __func__};
525 RecursiveMutexSentry sentry{
mutex_, __func__};
532 RecursiveMutexSentry sentry{
mutex_, __func__};
541 RecursiveMutexSentry sentry{
mutex_, __func__};
548 RecursiveMutexSentry sentry{
mutex_, __func__};
555 RecursiveMutexSentry sentry{
mutex_, __func__};
558 <<
"Attempt to open output file before input file. " 559 <<
"Please report this to the core framework developers.\n";
595 RecursiveMutexSentry sentry{
mutex_, __func__};
598 <<
"called before meaningful.\n";
606 RecursiveMutexSentry sentry{
mutex_, __func__};
613 RecursiveMutexSentry sentry{
mutex_, __func__};
620 RecursiveMutexSentry sentry{
mutex_, __func__};
627 RecursiveMutexSentry sentry{
mutex_, __func__};
634 RecursiveMutexSentry sentry{
mutex_, __func__};
641 RecursiveMutexSentry sentry{
mutex_, __func__};
648 RecursiveMutexSentry sentry{
mutex_, __func__};
std::string const & processName() const
Granularity fileGranularity() const override
EventID const & eventID() const
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
void registerProducts(ProductDescriptions &producedProducts, ModuleDescription const &md)
void writeParentageRegistry() override
void respondToCloseInputFile(FileBlock const &) override
void startEndFile() override
RunID const & runID() const
ModuleDescription const & moduleDescription() const
Granularity granularity() const
void writeProductDescriptionRegistry() override
void endSubRun(SubRunPrincipal const &) override
void doRegisterProducts(ProductDescriptions &productsToProduce, ModuleDescription const &md) override
void doEvent(EventPrincipal const &)
auto const & get_PSet() const
bool dropMetaDataForDroppedData_
void doBeginSubRun(SubRunPrincipal const &)
std::string const & moduleLabel() const
void recordRun(RunID const &id)
ClosingCriteria fileProperties_
string fileNameAtOpen() const
void doWriteFileCatalogMetadata(FileCatalogMetadata::collection_type const &md, FileCatalogMetadata::collection_type const &ssmd) override
void doWriteResults(ResultsPrincipal &)
FileStatsCollector fstats_
void writeFileIndex() override
PostCloseFileRenamer fRenamer_
void doReadResults(ResultsPrincipal const &)
void validateFileNamePattern(bool do_check, std::string const &pattern)
void logFileAction(const char *msg, std::string const &file)
void writeFileFormatVersion() override
void setFileStatus(OutputFileStatus) override
void recordEvent(EventID const &id)
static constexpr char const * default_tmpDir
void addToProcessHistory()
std::vector< BranchDescription > ProductDescriptions
bool isFileOpen() const override
string fileNameAtClose(string const ¤tFileName)
void openFile(FileBlock const &) override
void writeProcessConfigurationRegistry() override
void doEndRun(RunPrincipal const &)
void incrementInputFileNumber() override
auto const & descriptions(BranchType const bt) const
void for_each_RPWorker(on_rpworker_t wfunc)
int64_t const treeMaxVirtualSize_
std::string unique_filename(std::string stem, std::string extension=".root")
void doBeginRun(RunPrincipal const &)
ProductDescriptions productsToProduce_
void writeParameterSetRegistry() override
#define DEFINE_ART_MODULE(klass)
DropMetaData dropMetaData_
void doEndSubRun(SubRunPrincipal const &)
bool requestsToCloseFile() const override
void write(EventPrincipal &) override
string const & lastClosedFileName() const override
std::string const & fileName() const
void setModuleDescription(ModuleDescription const &)
static bool shouldFastClone(bool const fastCloningSet, bool const fastCloning, bool const wantAllEvents, ClosingCriteria const &cc)
RPParams const & params() const
void recordSubRun(SubRunID const &id)
SubRunID subRunID() const
int const compressionLevel_
void recordInputFile(std::string const &inputFileName)
string const filePattern_
void writeProductDependencies() override
set< string > operator()() const
void writeSubRun(SubRunPrincipal &) override
ProcessConfiguration const & processConfiguration() const
void beginRun(RunPrincipal const &) override
int64_t const saveMemoryObjectThreshold_
void invoke(invoke_function_t< void, ARGS... > mfunc, ARGS &&...args)
static ProductTables invalid()
int remainingEvents() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
void setRunAuxiliaryRangeSetID(RangeSet const &) override
void respondToOpenInputFile(FileBlock const &) override
std::string parent_path(std::string const &path)
void readResults(ResultsPrincipal const &resp) override
bool wantAllEvents() const
string lastClosedFileName_
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void setSubRunAuxiliaryRangeSetID(RangeSet const &) override
void endRun(RunPrincipal const &) override
ProductTables producedResultsProducts_
std::string maybeRenameFile(std::string const &inPath, std::string const &toPattern)
fhicl::TableFragment< OutputModule::Config > omConfig
void beginSubRun(SubRunPrincipal const &) override
void writeProcessHistoryRegistry() override
void postSelectProducts() override
auto const & get(AssnsNode< L, R, D > const &r)
void writeRun(RunPrincipal &) override
bool shouldDropEvents(bool const dropAllEventsSet, bool const dropAllEvents, bool const dropAllSubRuns)
void writeEventHistory() override
string const moduleLabel_
unique_ptr< RootOutputFile > rootOutputFile_
void set_par_style(par_style const vt)
void event(EventPrincipal const &) override
ModuleDescription const & moduleDescription() const
void finishEndFile() override