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>";
71 os <<
"\n<InputSourceClass>" <<
doc.NewText(
f.inputSourceClassName.c_str())->
Value() <<
"</InputSourceClass>";
72 os <<
"\n<EventsRead>" <<
f.numEventsRead <<
"</EventsRead>";
78 tinyxml2::XMLDocument
doc;
80 os <<
"\n<OutputModuleClass>" <<
doc.NewText(
f.outputModuleClassName.c_str())->
Value() <<
"</OutputModuleClass>";
81 os <<
"\n<TotalEvents>" <<
f.numEventsWritten <<
"</TotalEvents>\n";
82 os <<
"\n<DataType>" <<
doc.NewText(
f.dataType.c_str())->
Value() <<
"</DataType>\n";
83 os <<
"\n<BranchHash>" <<
doc.NewText(
f.branchHash.c_str())->
Value() <<
"</BranchHash>\n";
89 os <<
"\n<Run ID=\"" <<
rep.runNumber <<
"\">\n";
91 for (
auto const& il :
rep.lumiSectionsToNEvents) {
93 os <<
" <LumiSection ID=\"" << il.first <<
"\"/>\n";
96 os <<
" <LumiSection ID=\"" << il.first <<
"\" NEvents=\"" << il.second <<
"\"/>\n";
112 <<
t <<
" but no matching input file is found\n";
118 <<
"Access reported for input file with token " <<
t <<
" but no matching input file is found\n";
124 <<
"Access reported for input file with token " <<
t <<
" after this file has been closed.\n"
125 <<
"File record follows:\n"
132 if (
t >= outputFiles_.size()) {
134 <<
"Access reported for output file with token " <<
t <<
" but no matching output file is found\n";
136 if (outputFiles_[
t].fileHasBeenClosed) {
138 <<
"Access reported for output file with token " <<
t <<
" after this file has been closed.\n"
139 <<
"File record follows:\n"
140 << outputFiles_[
t] <<
'\n';
142 return outputFiles_[
t];
155 outputFile.contributingInputsSecSource.push_back(
t);
172 for (
auto const& runReport :
f.runReports) {
173 *ost_ << runReport.second;
175 *ost_ <<
"\n</Runs>\n";
176 *ost_ <<
"</InputFile>\n";
196 tinyxml2::XMLDocument
doc;
202 for (
auto const& runReport :
f.runReports) {
203 *ost_ << runReport.second;
205 *ost_ <<
"\n</Runs>\n";
207 *ost_ <<
"\n<Inputs>";
208 for (
auto token :
f.contributingInputs) {
210 *ost_ <<
"\n<Input>";
215 *ost_ <<
"\n</Input>";
216 doc.DeleteChildren();
218 for (
auto token :
f.contributingInputsSecSource) {
220 *ost_ <<
"\n<Input>";
225 *ost_ <<
"\n</Input>";
226 doc.DeleteChildren();
228 *ost_ <<
"\n</Inputs>";
229 *ost_ <<
"\n</File>\n";
238 for (
auto const&
inputFile : inputFiles_) {
243 for (
auto const&
inputFile : inputFilesSecSource_) {
256 auto& theMap = outputFiles_.at(
token).runReports;
257 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(
runNumber));
258 if (iter == theMap.end() ||
runNumber < iter->first) {
266 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
267 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(
runNumber));
268 if (iter == theMap.end() ||
runNumber < iter->first) {
277 unsigned int lumiSect,
279 auto& theMap = outputFiles_.at(
token).runReports;
280 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(
runNumber));
281 if (iter == theMap.end() ||
runNumber < iter->first) {
284 iter->second.lumiSectionsToNEvents[lumiSect] +=
nEvents;
291 std::map<RunNumber, RunReport>& theMap =
inputFile.runReports;
292 std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(
runNumber));
293 if (iter == theMap.end() ||
runNumber < iter->first) {
308 *(
impl_->ost_) <<
"</FrameworkJobReport>\n" << std::flush;
316 *(
impl_->ost_) <<
"<FrameworkJobReport>\n";
327 std::vector<std::string>
const& branchNames) {
332 if (inputType ==
"mixingFiles") {
336 newToken =
itr -
impl_->inputFilesSecSource_.begin();
338 if (inputType ==
"secondaryFiles") {
341 impl_->inputFiles_.emplace_back();
342 newFile = &
impl_->inputFiles_.back();
343 newToken =
impl_->inputFiles_.size() - 1;
347 impl_->lastOpenedPrimaryInputFile_ =
impl_->inputFiles_.size() - 1;
355 newFile->
guid = guid;
362 impl_->insertInputForOutputs(theInputType, newToken);
378 f.fileHasBeenClosed =
true;
397 std::vector<std::string>
const& branchNames) {
398 auto itr =
impl_->outputFiles_.emplace_back();
401 r.logicalFileName = logicalFileName;
402 r.physicalFileName = physicalFileName;
404 r.outputModuleClassName = outputModuleClassName;
408 r.branchHash = branchHash;
409 r.numEventsWritten = 0;
410 r.branchNames = branchNames;
411 r.fileHasBeenClosed =
false;
416 if (!
impl_->inputFiles_[
i].fileHasBeenClosed) {
417 r.contributingInputs.push_back(
i);
421 if (!
impl_->inputFilesSecSource_[
i].fileHasBeenClosed) {
422 r.contributingInputsSecSource.push_back(
i);
425 return itr -
impl_->outputFiles_.begin();
430 ++
f.numEventsWritten;
435 f.fileHasBeenClosed =
true;
436 impl_->writeOutputFile(
f);
444 msg <<
"<SkippedEvent Run=\"" <<
run <<
"\"";
445 msg <<
" Event=\"" <<
event <<
"\" />\n";
455 f.fastCopyingInputs.insert(std::make_pair(
inputFileName, fastCopying));
460 unsigned int lumiSectId,
466 impl_->associateInputLumiSection(
run, lumiSectId);
474 tinyxml2::XMLDocument
doc;
479 msg <<
"<AnalysisFile>\n"
480 <<
" <FileName>" <<
doc.NewText(
fileName.c_str())->
Value() <<
"</FileName>\n";
482 typedef std::map<std::string, std::string>::const_iterator const_iterator;
483 for (const_iterator
pos = fileData.begin(), posEnd = fileData.end();
pos != posEnd; ++
pos) {
484 msg <<
" <" <<
pos->first <<
" Value=\"" <<
pos->second <<
"\" />"
487 msg <<
"</AnalysisFile>\n";
498 msg <<
"<FrameworkError ExitStatus=\"" << exitCode <<
"\" Type=\"" << shortDesc <<
"\" >\n";
499 msg <<
"<![CDATA[\n" << longDesc <<
"\n]]>\n";
500 msg <<
"</FrameworkError>\n";
509 tinyxml2::XMLDocument
doc;
510 tinyxml2::XMLPrinter printer;
511 tinyxml2::XMLElement*
skipped =
doc.NewElement(
"SkippedFile");
512 skipped->SetAttribute(
"Pfn", pfn.c_str());
513 skipped->SetAttribute(
"Lfn", lfn.c_str());
517 msg << printer.CStr();
526 tinyxml2::XMLDocument
doc;
527 tinyxml2::XMLPrinter printer;
528 tinyxml2::XMLElement*
fallback =
doc.NewElement(
"FallbackAttempt");
529 fallback->SetAttribute(
"Pfn", pfn.c_str());
530 fallback->SetAttribute(
"Lfn", lfn.c_str());
534 msg << printer.CStr();
535 msg <<
"<![CDATA[\n" <<
err <<
"\n]]>\n";
544 msg <<
"<MemoryService>\n";
546 typedef std::vector<std::string>::const_iterator const_iterator;
547 for (const_iterator
pos = memoryData.begin(), posEnd = memoryData.end();
pos != posEnd; ++
pos) {
550 msg <<
"</MemoryService>\n";
558 msg <<
"<MessageSummary>\n";
559 typedef std::map<std::string, double>::const_iterator const_iterator;
560 for (const_iterator
pos = messageData.begin(), posEnd = messageData.end();
pos != posEnd; ++
pos) {
561 msg <<
" <" <<
pos->first <<
" Value=\"" <<
pos->second <<
"\" />"
564 msg <<
"</MessageSummary>\n";
570 if (
impl_->printedReadBranches_)
572 impl_->printedReadBranches_ =
true;
574 std::ostream& ost = *(
impl_->ost_);
575 ost <<
"<ReadBranches>\n";
576 tinyxml2::XMLDocument
doc;
577 tinyxml2::XMLPrinter printer;
578 for (
auto const& iBranch :
impl_->readBranches_) {
579 tinyxml2::XMLElement*
branch =
doc.NewElement(
"Branch");
580 branch->SetAttribute(
"Name", iBranch.first.c_str());
581 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second));
583 ost << printer.CStr();
584 printer.ClearBuffer();
586 for (
auto const& iBranch :
impl_->readBranchesSecFile_) {
587 tinyxml2::XMLElement*
branch =
doc.NewElement(
"Branch");
588 branch->SetAttribute(
"Name", iBranch.first.c_str());
589 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second));
591 ost << printer.CStr();
592 printer.ClearBuffer();
594 ost <<
"</ReadBranches>\n";
595 if (!
impl_->readBranchesSecSource_.empty()) {
596 ost <<
"<SecondarySourceReadBranches>\n";
597 for (
auto const& iBranch :
impl_->readBranchesSecSource_) {
598 tinyxml2::XMLElement*
branch =
doc.NewElement(
"Branch");
599 branch->SetAttribute(
"Name", iBranch.first.c_str());
600 branch->SetAttribute(
"ReadCount", int64_t(iBranch.second.value().load()));
602 ost << printer.CStr();
603 printer.ClearBuffer();
605 ost <<
"</SecondarySourceReadBranches>\n";
614 std::set<std::string>
const& clonedBranches =
615 impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
616 if (clonedBranches.find(
branchName) == clonedBranches.end()) {
627 std::set<std::string>& clonedBranches =
628 impl_->inputFiles_.at(
impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
629 for (std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
632 if (clonedBranches.insert(*it).second) {
639 tinyxml2::XMLDocument
doc;
644 msg <<
"<RandomServiceStateFile>\n"
646 <<
"</RandomServiceStateFile>\n";
653 std::map<std::string, std::string>
const& metrics) {
656 msg <<
"<PerformanceReport>\n"
657 <<
" <PerformanceSummary Metric=\"" << metricClass <<
"\">\n";
659 typedef std::map<std::string, std::string>::const_iterator const_iterator;
660 for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
661 msg <<
" <Metric Name=\"" << iter->first <<
"\" "
662 <<
"Value=\"" << iter->second <<
"\"/>\n";
665 msg <<
" </PerformanceSummary>\n"
666 <<
"</PerformanceReport>\n";
673 std::map<std::string, std::string>
const& metrics) {
676 msg <<
"<PerformanceReport>\n"
677 <<
" <PerformanceModule Metric=\"" << metricClass <<
"\" "
680 typedef std::map<std::string, std::string>::const_iterator const_iterator;
681 for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
682 msg <<
" <Metric Name=\"" << iter->first <<
"\" "
683 <<
"Value=\"" << iter->second <<
"\"/>\n";
686 msg <<
" </PerformanceModule>\n"
687 <<
"</PerformanceReport>\n";
693 std::ostringstream
msg;
695 tinyxml2::XMLDocument
doc;
696 for (
auto const&
f :
impl_->outputFiles_) {
700 msg <<
"\n<LumiSections>";
702 typedef std::vector<JobReport::Token>::iterator iterator;
703 for (
auto const& iInput :
f.contributingInputs) {
704 auto const& inpFile =
impl_->inputFiles_[iInput];
706 msg <<
"\n <LFN>" <<
doc.NewText(inpFile.logicalFileName.c_str())->
Value() <<
"</LFN>";
707 msg <<
"\n <PFN>" <<
doc.NewText(inpFile.physicalFileName.c_str())->
Value() <<
"</PFN>";
708 msg <<
"\n <FastCopying>" <<
findOrDefault(
f.fastCopyingInputs, inpFile.physicalFileName) <<
"</FastCopying>";
710 doc.DeleteChildren();
712 msg <<
"\n</Inputs>";