38 template <
typename S,
typename T>
41 if(f.fileHasBeenClosed) {
42 os <<
"\n<State Value=\"closed\"/>";
44 os <<
"\n<State Value=\"open\"/>";
47 os <<
"\n<LFN>" << TiXmlText(f.logicalFileName) <<
"</LFN>";
48 os <<
"\n<PFN>" << TiXmlText(f.physicalFileName) <<
"</PFN>";
49 os <<
"\n<Catalog>" << TiXmlText(f.catalog) <<
"</Catalog>";
50 os <<
"\n<ModuleLabel>" << TiXmlText(f.moduleLabel) <<
"</ModuleLabel>";
51 os <<
"\n<GUID>" << f.guid <<
"</GUID>";
53 for(
auto const& branch : f.branchNames) {
54 os <<
"\n <Branch>" << TiXmlText(branch) <<
"</Branch>";
56 os <<
"\n</Branches>";
67 os <<
"\n<InputFile>";
69 os <<
"\n<InputType>" << f.
inputType <<
"</InputType>";
71 <<
"</InputSourceClass>";
79 os <<
"\n<OutputModuleClass>" 81 <<
"</OutputModuleClass>";
82 os <<
"\n<TotalEvents>" 84 <<
"</TotalEvents>\n";
88 os <<
"\n<BranchHash>" 103 os <<
" <LumiSection ID=\"" << il.first <<
"\"/>\n";
106 os <<
" <LumiSection ID=\"" << il.first <<
"\" NEvents=\""<<il.second<<
"\"/>\n";
129 <<
"Access reported for secondary source input file with token " 131 <<
" but no matching input file is found\n";
137 <<
"Access reported for input file with token " 139 <<
" but no matching input file is found\n";
145 <<
"Access reported for input file with token " 147 <<
" after this file has been closed.\n" 148 <<
"File record follows:\n" 158 <<
"Access reported for output file with token " 160 <<
" but no matching output file is found\n";
164 <<
"Access reported for output file with token " 166 <<
" after this file has been closed.\n" 167 <<
"File record follows:\n" 184 outputFile.contributingInputsSecSource.push_back(t);
201 for(
auto const& runReport : f.runReports) {
202 *
ost_ << runReport.second;
204 *
ost_ <<
"\n</Runs>\n";
205 *
ost_ <<
"</InputFile>\n";
230 for(
auto const& runReport : f.runReports) {
231 *
ost_ << runReport.second;
233 *
ost_ <<
"\n</Runs>\n";
235 *
ost_ <<
"\n<Inputs>";
236 for(
auto token : f.contributingInputs) {
238 *
ost_ <<
"\n<Input>";
242 *
ost_ <<
"\n</Input>";
244 for(
auto token : f.contributingInputsSecSource) {
246 *
ost_ <<
"\n<Input>";
250 *
ost_ <<
"\n</Input>";
252 *
ost_ <<
"\n</Inputs>";
253 *
ost_ <<
"\n</File>\n";
281 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
282 if(iter == theMap.end() || runNumber < iter->first) {
290 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
291 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
292 if(iter == theMap.end() || runNumber < iter->first) {
301 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
302 if(iter == theMap.end() || runNumber < iter->first) {
305 iter->second.lumiSectionsToNEvents[lumiSect]+=
nEvents;
312 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
313 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
314 if(iter == theMap.end() || runNumber < iter->first) {
326 *(
impl_->ost_) <<
"</FrameworkJobReport>\n" << std::flush;
336 *(
impl_->ost_) <<
"<FrameworkJobReport>\n";
342 toFileName(
std::string const& jobReportFile,
unsigned int childIndex,
unsigned int numberOfChildren, std::ostringstream& ofilename) {
343 char filler = ofilename.fill();
344 unsigned int numberOfDigitsInIndex = 0
U;
345 while (numberOfChildren != 0) {
346 ++numberOfDigitsInIndex;
347 numberOfChildren /= 10;
349 if(numberOfDigitsInIndex == 0) {
350 numberOfDigitsInIndex = 3;
353 if(offset == std::string::npos) {
354 ofilename << jobReportFile;
355 ofilename <<
'_' << std::setw(numberOfDigitsInIndex) << std::setfill(
'0') << childIndex << std::setfill(filler);
357 ofilename << jobReportFile.substr(0, offset);
358 ofilename <<
'_' << std::setw(numberOfDigitsInIndex) << std::setfill(
'0') << childIndex << std::setfill(filler);
359 ofilename << jobReportFile.substr(offset);
367 *(
impl_->ost_) <<
"<ChildProcessFiles>\n";
368 for(
unsigned int i = 0;
i < numberOfChildren; ++
i) {
369 std::ostringstream ofilename;
370 toFileName(jobReportFile,
i, numberOfChildren, ofilename);
371 *(
impl_->ost_) <<
" <ChildProcessFile>" << ofilename.str() <<
"</ChildProcessFile>\n";
373 *(
impl_->ost_) <<
"</ChildProcessFiles>\n";
374 *(
impl_->ost_) <<
"</FrameworkJobReport>\n";
375 std::ofstream*
p =
dynamic_cast<std::ofstream *
>(
impl_->ost());
388 std::ofstream*
p =
dynamic_cast<std::ofstream*
>(
impl_->ost());
390 std::ostringstream ofilename;
391 toFileName(jobReportFile, childIndex, numberOfChildren, ofilename);
392 p->open(ofilename.str().c_str());
393 *p <<
"<FrameworkJobReport>\n";
404 std::vector<std::string>
const& branchNames) {
410 if (inputType ==
"mixingFiles") {
414 newToken = itr -
impl_->inputFilesSecSource_.begin();
416 if (inputType ==
"secondaryFiles") {
419 impl_->inputFiles_.emplace_back();
420 newFile = &
impl_->inputFiles_.back();
421 newToken =
impl_->inputFiles_.size() - 1;
425 impl_->lastOpenedPrimaryInputFile_ =
impl_->inputFiles_.size() - 1;
433 newFile->
guid = guid;
440 impl_->insertInputForOutputs(theInputType, newToken);
461 impl_->writeInputFile(f);
465 impl_->writeInputFile(f);
479 std::vector<std::string>
const& branchNames) {
480 auto itr =
impl_->outputFiles_.emplace_back();
498 if(!
impl_->inputFiles_[
i].fileHasBeenClosed) {
503 if(!
impl_->inputFilesSecSource_[
i].fileHasBeenClosed) {
507 return itr -
impl_->outputFiles_.begin();
520 impl_->writeOutputFile(f);
529 msg <<
"<SkippedEvent Run=\"" << run <<
"\"";
530 msg <<
" Event=\"" <<
event <<
"\" />\n";
544 impl_->associateLumiSection(token, run, lumiSectId,nEvents);
549 impl_->associateInputLumiSection(run, lumiSectId);
554 impl_->associateRun(token, run);
559 impl_->associateInputRun(run);
568 msg <<
"<AnalysisFile>\n" 569 <<
" <FileName>" << TiXmlText(fileName) <<
"</FileName>\n";
571 typedef std::map<std::string, std::string>::const_iterator const_iterator;
572 for(const_iterator
pos = fileData.begin(), posEnd = fileData.end();
pos != posEnd; ++
pos) {
573 msg <<
" <" <<
pos->first
574 <<
" Value=\"" <<
pos->second <<
"\" />" 577 msg <<
"</AnalysisFile>\n";
586 int const& exitCode) {
591 msg <<
"<FrameworkError ExitStatus=\""<< exitCode
592 <<
"\" Type=\"" << shortDesc <<
"\" >\n";
593 msg <<
"<![CDATA[\n" << longDesc <<
"\n]]>\n";
594 msg <<
"</FrameworkError>\n";
605 TiXmlElement
skipped(
"SkippedFile");
606 skipped.SetAttribute(
"Pfn", pfn);
607 skipped.SetAttribute(
"Lfn", lfn);
610 msg << skipped <<
"\n";
620 TiXmlElement
fallback(
"FallbackAttempt");
621 fallback.SetAttribute(
"Pfn", pfn);
622 fallback.SetAttribute(
"Lfn", lfn);
625 msg << fallback <<
"\n";
626 msg <<
"<![CDATA[\n" << err <<
"\n]]>\n";
636 msg <<
"<MemoryService>\n";
638 typedef std::vector<std::string>::const_iterator const_iterator;
639 for(const_iterator
pos = memoryData.begin(), posEnd = memoryData.end();
pos != posEnd; ++
pos) {
642 msg <<
"</MemoryService>\n";
651 msg <<
"<MessageSummary>\n";
652 typedef std::map<std::string, double>::const_iterator const_iterator;
653 for(const_iterator
pos = messageData.begin(), posEnd = messageData.end();
pos != posEnd; ++
pos) {
654 msg <<
" <" <<
pos->first
655 <<
" Value=\"" <<
pos->second <<
"\" />" 658 msg <<
"</MessageSummary>\n";
665 if(
impl_->printedReadBranches_)
return;
666 impl_->printedReadBranches_ =
true;
668 std::ostream& ost = *(
impl_->ost_);
669 ost <<
"<ReadBranches>\n";
670 for(
auto const& iBranch :
impl_->readBranches_) {
671 TiXmlElement branch(
"Branch");
672 branch.SetAttribute(
"Name", iBranch.first);
673 branch.SetAttribute(
"ReadCount", iBranch.second);
674 ost << branch <<
"\n";
676 for(
auto const& iBranch :
impl_->readBranchesSecFile_) {
677 TiXmlElement branch(
"Branch");
678 branch.SetAttribute(
"Name", iBranch.first);
679 branch.SetAttribute(
"ReadCount", iBranch.second);
680 ost << branch <<
"\n";
682 ost <<
"</ReadBranches>\n";
683 if(!
impl_->readBranchesSecSource_.empty()) {
684 ost <<
"<SecondarySourceReadBranches>\n";
685 for(
auto const& iBranch :
impl_->readBranchesSecSource_) {
686 TiXmlElement branch(
"Branch");
687 branch.SetAttribute(
"Name", iBranch.first);
688 branch.SetAttribute(
"ReadCount", iBranch.second.value().load());
689 ost << branch <<
"\n";
691 ost <<
"</SecondarySourceReadBranches>\n";
701 std::set<std::string>
const& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
702 if(clonedBranches.find(branchName) == clonedBranches.end()) {
703 ++
impl_->readBranches_[branchName];
706 ++
impl_->readBranchesSecFile_[branchName];
708 ++
impl_->readBranchesSecSource_[branchName].value();
714 std::set<std::string>& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
715 for(std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
717 if(clonedBranches.insert(*it).second) {
728 msg <<
"<RandomServiceStateFile>\n" 729 << TiXmlText(name) <<
"\n" 730 <<
"</RandomServiceStateFile>\n";
738 std::map<std::string, std::string>
const& metrics) {
741 msg <<
"<PerformanceReport>\n" 742 <<
" <PerformanceSummary Metric=\"" << metricClass <<
"\">\n";
744 typedef std::map<std::string, std::string>::const_iterator const_iterator;
745 for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
746 msg <<
" <Metric Name=\"" << iter->first <<
"\" " 747 <<
"Value=\"" << iter->second <<
"\"/>\n";
750 msg <<
" </PerformanceSummary>\n" 751 <<
"</PerformanceReport>\n";
760 std::map<std::string, std::string>
const& metrics) {
763 msg <<
"<PerformanceReport>\n" 764 <<
" <PerformanceModule Metric=\"" << metricClass <<
"\" " 765 <<
" Module=\"" << moduleName <<
"\" >\n";
767 typedef std::map<std::string, std::string>::const_iterator const_iterator;
768 for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
769 msg <<
" <Metric Name=\"" << iter->first <<
"\" " 770 <<
"Value=\"" << iter->second <<
"\"/>\n";
773 msg <<
" </PerformanceModule>\n" 774 <<
"</PerformanceReport>\n";
782 std::ostringstream
msg;
785 for(
auto const&
f :
impl_->outputFiles_) {
790 msg <<
"\n<LumiSections>";
792 typedef std::vector<JobReport::Token>::iterator iterator;
793 for(
auto const& iInput : f.contributingInputs) {
794 auto const& inpFile =
impl_->inputFiles_[iInput];
796 msg <<
"\n <LFN>" << TiXmlText(inpFile.logicalFileName) <<
"</LFN>";
797 msg <<
"\n <PFN>" << TiXmlText(inpFile.physicalFileName) <<
"</PFN>";
798 msg <<
"\n <FastCopying>" <<
findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) <<
"</FastCopying>";
801 msg <<
"\n</Inputs>";
void reportSkippedFile(std::string const &pfn, std::string const &lfn)
std::string outputModuleClassName
std::string physicalFileName
void associateRun(JobReport::Token token, unsigned int runNumber)
void reportMemoryInfo(std::vector< std::string > const &memoryData)
void reportInputRunNumber(unsigned int run)
void eventReadFromFile(InputType inputType, Token fileToken)
void reportFallbackAttempt(std::string const &pfn, std::string const &lfn, std::string const &err)
unsigned long long EventNumber_t
std::map< std::string, bool > fastCopyingInputs
std::string logicalFileName
void reportFastCopyingStatus(Token t, std::string const &inputFileName, bool fastCopying)
void reportRunNumber(JobReport::Token token, unsigned int run)
void reportRandomStateFile(std::string const &name)
S & print(S &os, JobReport::InputFile const &f)
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Token inputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &inputType, std::string const &inputSourceClassName, std::string const &moduleLabel, std::string const &guid, std::vector< std::string > const &branchNames)
std::vector< InputFile > inputFiles_
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
std::vector< Token > contributingInputs
void reportSkippedEvent(RunNumber_t run, EventNumber_t event)
void insertInputForOutputs(InputType inputType, Token t)
std::string moduleName(Provenance const &provenance)
void writeInputFile(InputFile const &f)
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
void reportPerformanceSummary(std::string const &metricClass, std::map< std::string, std::string > const &metrics)
void childAfterFork(std::string const &jobReportFile, unsigned int childIndex, unsigned int numberOfChildren)
New output file for child.
Token outputFileOpened(std::string const &physicalFileName, std::string const &logicalFileName, std::string const &catalog, std::string const &outputModuleClassName, std::string const &moduleLabel, std::string const &guid, std::string const &dataType, std::string const &branchHash, std::vector< std::string > const &branchNames)
edm::propagate_const< std::ostream * > ost_
void reportError(std::string const &shortDesc, std::string const &longDesc, int const &exitCode)
void associateInputRun(unsigned int runNumber)
S & formatFile(T const &f, S &os)
void reportReadBranch(InputType inputType, std::string const &branchName)
Inform the job report that a branch has been read.
std::size_t numEventsWritten
void reportFastClonedBranches(std::set< std::string > const &fastClonedBranches, long long nEvents)
Inform the job report that branches have been fast Cloned.
Value const & findOrDefault(std::map< Key, Value > const &m, Key const &k, Value const &defaultValue)
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
tbb::concurrent_vector< InputFile > inputFilesSecSource_
void parentAfterFork(std::string const &jobReportFile)
void reportMessageInfo(std::map< std::string, double > const &messageData)
double S(const TLorentzVector &, const TLorentzVector &)
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection, unsigned long nEvents)
std::string dumpFiles(void)
debug/test util
void parentBeforeFork(std::string const &jobReportFile, unsigned int numberOfChildren)
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
void outputFileClosed(Token fileToken)
void writeOutputFile(OutputFile const &f)
std::map< unsigned int, unsigned long > lumiSectionsToNEvents
InputFile & getInputFileForToken(InputType inputType, Token t)
tbb::concurrent_vector< OutputFile > outputFiles_
void reportDataType(Token fileToken, std::string const &dataType)
tbb::concurrent_vector< Token > contributingInputsSecSource
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void inputFileClosed(InputType inputType, Token fileToken)
void associateInputLumiSection(unsigned int runNumber, unsigned int lumiSection)
void reportReadBranches()
OutputFile & getOutputFileForToken(Token t)
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)