39 template <
typename S,
typename T>
41 tinyxml2::XMLDocument
doc;
42 if(f.fileHasBeenClosed) {
43 os <<
"\n<State Value=\"closed\"/>";
45 os <<
"\n<State Value=\"open\"/>";
47 os <<
"\n<LFN>" << doc.NewText(f.logicalFileName.c_str())->
Value() <<
"</LFN>";
48 os <<
"\n<PFN>" << doc.NewText(f.physicalFileName.c_str())->
Value() <<
"</PFN>";
49 os <<
"\n<Catalog>" << doc.NewText(f.catalog.c_str())->
Value() <<
"</Catalog>";
50 os <<
"\n<ModuleLabel>" << doc.NewText(f.moduleLabel.c_str())->
Value() <<
"</ModuleLabel>";
51 os <<
"\n<GUID>" << f.guid <<
"</GUID>";
53 for(
auto const&
branch : f.branchNames) {
54 os <<
"\n <Branch>" << doc.NewText(
branch.c_str())->
Value() <<
"</Branch>";
57 os <<
"\n</Branches>";
67 tinyxml2::XMLDocument
doc;
68 os <<
"\n<InputFile>";
70 os <<
"\n<InputType>" << f.
inputType <<
"</InputType>";
72 <<
"</InputSourceClass>";
79 tinyxml2::XMLDocument
doc;
81 os <<
"\n<OutputModuleClass>" 83 <<
"</OutputModuleClass>";
84 os <<
"\n<TotalEvents>" 86 <<
"</TotalEvents>\n";
90 os <<
"\n<BranchHash>" 105 os <<
" <LumiSection ID=\"" << il.first <<
"\"/>\n";
108 os <<
" <LumiSection ID=\"" << il.first <<
"\" NEvents=\""<<il.second<<
"\"/>\n";
131 <<
"Access reported for secondary source input file with token " 133 <<
" but no matching input file is found\n";
139 <<
"Access reported for input file with token " 141 <<
" but no matching input file is found\n";
147 <<
"Access reported for input file with token " 149 <<
" after this file has been closed.\n" 150 <<
"File record follows:\n" 160 <<
"Access reported for output file with token " 162 <<
" but no matching output file is found\n";
166 <<
"Access reported for output file with token " 168 <<
" after this file has been closed.\n" 169 <<
"File record follows:\n" 186 outputFile.contributingInputsSecSource.push_back(t);
203 for(
auto const& runReport : f.runReports) {
204 *
ost_ << runReport.second;
206 *
ost_ <<
"\n</Runs>\n";
207 *
ost_ <<
"</InputFile>\n";
227 tinyxml2::XMLDocument
doc;
233 for(
auto const& runReport : f.runReports) {
234 *
ost_ << runReport.second;
236 *
ost_ <<
"\n</Runs>\n";
238 *
ost_ <<
"\n<Inputs>";
239 for(
auto token : f.contributingInputs) {
241 *
ost_ <<
"\n<Input>";
245 *
ost_ <<
"\n</Input>";
246 doc.DeleteChildren();
248 for(
auto token : f.contributingInputsSecSource) {
250 *
ost_ <<
"\n<Input>";
254 *
ost_ <<
"\n</Input>";
255 doc.DeleteChildren();
257 *
ost_ <<
"\n</Inputs>";
258 *
ost_ <<
"\n</File>\n";
286 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
287 if(iter == theMap.end() || runNumber < iter->first) {
295 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
296 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
297 if(iter == theMap.end() || runNumber < iter->first) {
306 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
307 if(iter == theMap.end() || runNumber < iter->first) {
310 iter->second.lumiSectionsToNEvents[lumiSect]+=
nEvents;
317 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
318 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
319 if(iter == theMap.end() || runNumber < iter->first) {
331 *(
impl_->ost_) <<
"</FrameworkJobReport>\n" << std::flush;
341 *(
impl_->ost_) <<
"<FrameworkJobReport>\n";
353 std::vector<std::string>
const& branchNames) {
359 if (inputType ==
"mixingFiles") {
363 newToken = itr -
impl_->inputFilesSecSource_.begin();
365 if (inputType ==
"secondaryFiles") {
368 impl_->inputFiles_.emplace_back();
369 newFile = &
impl_->inputFiles_.back();
370 newToken =
impl_->inputFiles_.size() - 1;
374 impl_->lastOpenedPrimaryInputFile_ =
impl_->inputFiles_.size() - 1;
382 newFile->
guid = guid;
389 impl_->insertInputForOutputs(theInputType, newToken);
410 impl_->writeInputFile(f);
414 impl_->writeInputFile(f);
428 std::vector<std::string>
const& branchNames) {
429 auto itr =
impl_->outputFiles_.emplace_back();
447 if(!
impl_->inputFiles_[
i].fileHasBeenClosed) {
452 if(!
impl_->inputFilesSecSource_[
i].fileHasBeenClosed) {
456 return itr -
impl_->outputFiles_.begin();
469 impl_->writeOutputFile(f);
478 msg <<
"<SkippedEvent Run=\"" << run <<
"\"";
479 msg <<
" Event=\"" <<
event <<
"\" />\n";
493 impl_->associateLumiSection(token, run, lumiSectId,nEvents);
498 impl_->associateInputLumiSection(run, lumiSectId);
503 impl_->associateRun(token, run);
508 impl_->associateInputRun(run);
513 tinyxml2::XMLDocument
doc;
518 msg <<
"<AnalysisFile>\n" 519 <<
" <FileName>" << doc.NewText(fileName.c_str())->
Value() <<
"</FileName>\n";
521 typedef std::map<std::string, std::string>::const_iterator const_iterator;
522 for(const_iterator
pos = fileData.begin(), posEnd = fileData.end();
pos != posEnd; ++
pos) {
523 msg <<
" <" <<
pos->first
524 <<
" Value=\"" <<
pos->second <<
"\" />" 527 msg <<
"</AnalysisFile>\n";
536 int const& exitCode) {
541 msg <<
"<FrameworkError ExitStatus=\""<< exitCode
542 <<
"\" Type=\"" << shortDesc <<
"\" >\n";
543 msg <<
"<![CDATA[\n" << longDesc <<
"\n]]>\n";
544 msg <<
"</FrameworkError>\n";
555 tinyxml2::XMLDocument
doc;
556 tinyxml2::XMLPrinter printer;
557 tinyxml2::XMLElement *
skipped = doc.NewElement(
"SkippedFile");
558 skipped->SetAttribute(
"Pfn", pfn.c_str());
559 skipped->SetAttribute(
"Lfn", lfn.c_str());
562 skipped->Accept(&printer);
563 msg << printer.CStr() ;
573 tinyxml2::XMLDocument
doc;
574 tinyxml2::XMLPrinter printer;
575 tinyxml2::XMLElement *
fallback = doc.NewElement(
"FallbackAttempt");
576 fallback->SetAttribute(
"Pfn", pfn.c_str());
577 fallback->SetAttribute(
"Lfn", lfn.c_str());
580 fallback->Accept(&printer);
581 msg << printer.CStr() ;
582 msg <<
"<![CDATA[\n" << err <<
"\n]]>\n";
592 msg <<
"<MemoryService>\n";
594 typedef std::vector<std::string>::const_iterator const_iterator;
595 for(const_iterator
pos = memoryData.begin(), posEnd = memoryData.end();
pos != posEnd; ++
pos) {
598 msg <<
"</MemoryService>\n";
607 msg <<
"<MessageSummary>\n";
608 typedef std::map<std::string, double>::const_iterator const_iterator;
609 for(const_iterator
pos = messageData.begin(), posEnd = messageData.end();
pos != posEnd; ++
pos) {
610 msg <<
" <" <<
pos->first
611 <<
" Value=\"" <<
pos->second <<
"\" />" 614 msg <<
"</MessageSummary>\n";
621 if(
impl_->printedReadBranches_)
return;
622 impl_->printedReadBranches_ =
true;
624 std::ostream& ost = *(
impl_->ost_);
625 ost <<
"<ReadBranches>\n";
626 tinyxml2::XMLDocument
doc;
627 tinyxml2::XMLPrinter printer;
628 for(
auto const& iBranch :
impl_->readBranches_) {
629 tinyxml2::XMLElement *
branch = doc.NewElement(
"Branch");
630 branch->SetAttribute(
"Name", iBranch.first.c_str());
631 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second));
632 branch->Accept(&printer);
633 ost << printer.CStr();
634 printer.ClearBuffer();
636 for(
auto const& iBranch :
impl_->readBranchesSecFile_) {
637 tinyxml2::XMLElement *
branch = doc.NewElement(
"Branch");
638 branch->SetAttribute(
"Name", iBranch.first.c_str());
639 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second));
640 branch->Accept(&printer);
641 ost << printer.CStr();
642 printer.ClearBuffer();
644 ost <<
"</ReadBranches>\n";
645 if(!
impl_->readBranchesSecSource_.empty()) {
646 ost <<
"<SecondarySourceReadBranches>\n";
647 for(
auto const& iBranch :
impl_->readBranchesSecSource_) {
648 tinyxml2::XMLElement *
branch = doc.NewElement(
"Branch");
649 branch->SetAttribute(
"Name", iBranch.first.c_str());
650 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second.value().load()));
651 branch->Accept(&printer);
652 ost << printer.CStr();
653 printer.ClearBuffer();
655 ost <<
"</SecondarySourceReadBranches>\n";
665 std::set<std::string>
const& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
666 if(clonedBranches.find(branchName) == clonedBranches.end()) {
678 std::set<std::string>& clonedBranches =
impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
679 for(std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
681 if(clonedBranches.insert(*it).second) {
688 tinyxml2::XMLDocument
doc;
693 msg <<
"<RandomServiceStateFile>\n" 694 << doc.NewText(name.c_str())->
Value() <<
"\n" 695 <<
"</RandomServiceStateFile>\n";
703 std::map<std::string, std::string>
const& metrics) {
706 msg <<
"<PerformanceReport>\n" 707 <<
" <PerformanceSummary Metric=\"" << metricClass <<
"\">\n";
709 typedef std::map<std::string, std::string>::const_iterator const_iterator;
710 for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
711 msg <<
" <Metric Name=\"" << iter->first <<
"\" " 712 <<
"Value=\"" << iter->second <<
"\"/>\n";
715 msg <<
" </PerformanceSummary>\n" 716 <<
"</PerformanceReport>\n";
725 std::map<std::string, std::string>
const& metrics) {
728 msg <<
"<PerformanceReport>\n" 729 <<
" <PerformanceModule Metric=\"" << metricClass <<
"\" " 730 <<
" Module=\"" << moduleName <<
"\" >\n";
732 typedef std::map<std::string, std::string>::const_iterator const_iterator;
733 for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
734 msg <<
" <Metric Name=\"" << iter->first <<
"\" " 735 <<
"Value=\"" << iter->second <<
"\"/>\n";
738 msg <<
" </PerformanceModule>\n" 739 <<
"</PerformanceReport>\n";
747 std::ostringstream
msg;
749 tinyxml2::XMLDocument
doc;
750 for(
auto const&
f :
impl_->outputFiles_) {
755 msg <<
"\n<LumiSections>";
757 typedef std::vector<JobReport::Token>::iterator iterator;
758 for(
auto const& iInput : f.contributingInputs) {
759 auto const& inpFile =
impl_->inputFiles_[iInput];
761 msg <<
"\n <LFN>" << doc.NewText(inpFile.logicalFileName.c_str())->
Value() <<
"</LFN>";
762 msg <<
"\n <PFN>" << doc.NewText(inpFile.physicalFileName.c_str())->
Value() <<
"</PFN>";
763 msg <<
"\n <FastCopying>" <<
findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) <<
"</FastCopying>";
765 doc.DeleteChildren();
767 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)
reco::JetExtendedAssociation::JetExtendedData Value
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 reportMessageInfo(std::map< std::string, double > const &messageData)
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection, unsigned long nEvents)
std::string dumpFiles(void)
debug/test util
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)