CMS 3D CMS Logo

JobReport.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 //
5 // 10/23/07 mf In an attempt to get clues about (or ene) the
6 // does-not-output-branches behavior, changed the
7 // generic os<< lines in JobReport::JobReportImpl::writeOutputFile
8 // to direct use of LogInfo.
9 //
10 // 4/8/08 mf Encase the logdesc for in <CDATA> ... </CDATA>
11 //
12 // 6/19/08 mf reportMessageInfo()
13 //
14 // 24 June 2008 ewv Correct format for CDATA and for second instance of reportError
15 
16 //
17 // Original Author: Marc Paterno
18 //
19 
23 
24 // The part of tinyxml used in JobReport was reviewed and
25 // determined to be threadsafe.
26 #include "tinyxml.h"
27 #include <fstream>
28 #include <iomanip>
29 #include <ostream>
30 #include <sstream>
31 
32 namespace edm {
33  /*
34  * Note that output formatting is spattered across these classes
35  * If something outside these classes requires access to the
36  * same formatting then we need to refactor it into a common library
37  */
38  template <typename S, typename T>
39  S& formatFile(T const& f, S& os) {
40 
41  if(f.fileHasBeenClosed) {
42  os << "\n<State Value=\"closed\"/>";
43  } else {
44  os << "\n<State Value=\"open\"/>";
45  }
46 
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>";
52  os << "\n<Branches>";
53  for(auto const& branch : f.branchNames) {
54  os << "\n <Branch>" << TiXmlText(branch) << "</Branch>";
55  }
56  os << "\n</Branches>";
57  return os;
58  }
59  /*
60  * Note that output formatting is spattered across these classes
61  * If something outside these classes requires access to the
62  * same formatting then we need to refactor it into a common library
63  */
64  template <typename S>
65  S& print(S& os, JobReport::InputFile const& f) {
66 
67  os << "\n<InputFile>";
68  formatFile(f, os);
69  os << "\n<InputType>" << f.inputType << "</InputType>";
70  os << "\n<InputSourceClass>" << TiXmlText(f.inputSourceClassName)
71  << "</InputSourceClass>";
72  os << "\n<EventsRead>" << f.numEventsRead << "</EventsRead>";
73  return os;
74  }
75 
76  template <typename S>
77  S& print(S& os, JobReport::OutputFile const& f) {
78  formatFile(f, os);
79  os << "\n<OutputModuleClass>"
80  << TiXmlText(f.outputModuleClassName)
81  << "</OutputModuleClass>";
82  os << "\n<TotalEvents>"
83  << f.numEventsWritten
84  << "</TotalEvents>\n";
85  os << "\n<DataType>"
86  << TiXmlText(f.dataType)
87  << "</DataType>\n";
88  os << "\n<BranchHash>"
89  << TiXmlText(f.branchHash)
90  << "</BranchHash>\n";
91  return os;
92  }
93 
94  template <typename S>
95  S& print(S& os,
96  JobReport::RunReport const& rep) {
97  os << "\n<Run ID=\""
98  << rep.runNumber
99  << "\">\n";
100 
101  for(auto const& il : rep.lumiSectionsToNEvents) {
102  if(std::numeric_limits<unsigned long>::max() == il.second) {
103  os << " <LumiSection ID=\"" << il.first << "\"/>\n";
104 
105  } else {
106  os << " <LumiSection ID=\"" << il.first << "\" NEvents=\""<<il.second<< "\"/>\n";
107  }
108  }
109  os << "</Run>\n";
110  return os;
111  }
112 
113  std::ostream& operator<< (std::ostream& os, JobReport::InputFile const& f) {
114  return print(os,f);
115  }
116  std::ostream& operator<< (std::ostream& os, JobReport::OutputFile const& f) {
117  return print(os,f);
118  }
119  std::ostream& operator<< (std::ostream& os, JobReport::RunReport const& f) {
120  return print(os,f);
121  }
122 
124 
125  InputFile* inputFile = nullptr;
126  if(inputType == InputType::SecondarySource) {
127  if(t >= inputFilesSecSource_.size()) {
129  << "Access reported for secondary source input file with token "
130  << t
131  << " but no matching input file is found\n";
132  }
133  inputFile = &inputFilesSecSource_[t];
134  } else {
135  if(t >= inputFiles_.size()) {
137  << "Access reported for input file with token "
138  << t
139  << " but no matching input file is found\n";
140  }
141  inputFile = &inputFiles_[t];
142  }
143  if(inputFile->fileHasBeenClosed) {
145  << "Access reported for input file with token "
146  << t
147  << " after this file has been closed.\n"
148  << "File record follows:\n"
149  << *inputFile
150  << '\n';
151  }
152  return *inputFile;
153  }
154 
156  if(t >= outputFiles_.size()) {
158  << "Access reported for output file with token "
159  << t
160  << " but no matching output file is found\n";
161  }
162  if(outputFiles_[t].fileHasBeenClosed) {
164  << "Access reported for output file with token "
165  << t
166  << " after this file has been closed.\n"
167  << "File record follows:\n"
168  << outputFiles_[t]
169  << '\n';
170  }
171  return outputFiles_[t];
172  }
173 
174  /*
175  * Add the input file token provided to every output
176  * file currently available.
177  * Used whenever a new input file is opened, it's token
178  * is added to all open output files as a contributor
179  */
181  for(auto & outputFile : outputFiles_) {
182  if(!outputFile.fileHasBeenClosed) {
183  if(inputType == InputType::SecondarySource) {
184  outputFile.contributingInputsSecSource.push_back(t);
185  } else {
186  outputFile.contributingInputs.push_back(t);
187  }
188  }
189  }
190  }
191 
192  /*
193  * Write anJobReport::InputFile object to the Logger
194  * Generate XML string forJobReport::InputFile instance and dispatch to
195  * job report via MessageLogger
196  */
198  if(ost_) {
199  *ost_ << f ;
200  *ost_ << "\n<Runs>";
201  for(auto const& runReport : f.runReports) {
202  *ost_ << runReport.second;
203  }
204  *ost_ << "\n</Runs>\n";
205  *ost_ << "</InputFile>\n";
206  *ost_ << std::flush;
207  }
208  }
209 
210  /*
211  * Write an OutputFile object to the Logger
212  * Generate an XML string for the OutputFile provided and
213  * dispatch it to the logger
214  * Contributing input tokens are resolved to the input LFN and PFN
215  *
216  * TODO: We have not yet addressed the issue where we cleanup not
217  * contributing input files.
218  * Also, it is possible to get fake input to output file mappings
219  * if an input file is open already when a new output file is opened
220  * but the input gets closed without contributing events to the
221  * output file due to filtering etc.
222  *
223  */
225  if(ost_) {
226  *ost_ << "\n<File>";
227  *ost_ << f;
228 
229  *ost_ << "\n<Runs>";
230  for(auto const& runReport : f.runReports) {
231  *ost_ << runReport.second;
232  }
233  *ost_ << "\n</Runs>\n";
234 
235  *ost_ << "\n<Inputs>";
236  for(auto token : f.contributingInputs) {
237  JobReport::InputFile inpFile = inputFiles_.at(token);
238  *ost_ << "\n<Input>";
239  *ost_ << "\n <LFN>" << TiXmlText(inpFile.logicalFileName) << "</LFN>";
240  *ost_ << "\n <PFN>" << TiXmlText(inpFile.physicalFileName) << "</PFN>";
241  *ost_ << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
242  *ost_ << "\n</Input>";
243  }
244  for(auto token : f.contributingInputsSecSource) {
245  JobReport::InputFile inpFile = inputFilesSecSource_.at(token);
246  *ost_ << "\n<Input>";
247  *ost_ << "\n <LFN>" << TiXmlText(inpFile.logicalFileName) << "</LFN>";
248  *ost_ << "\n <PFN>" << TiXmlText(inpFile.physicalFileName) << "</PFN>";
249  *ost_ << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
250  *ost_ << "\n</Input>";
251  }
252  *ost_ << "\n</Inputs>";
253  *ost_ << "\n</File>\n";
254  }
255  }
256 
257  /*
258  * Flush all open files to logger in event of a problem.
259  * Called from JobReport dtor to flush any remaining open files
260  */
262  for(auto const& inputFile : inputFiles_) {
263  if(!(inputFile.fileHasBeenClosed)) {
265  }
266  }
267  for(auto const& inputFile : inputFilesSecSource_) {
268  if(!(inputFile.fileHasBeenClosed)) {
270  }
271  }
272  for(auto const& outputFile : outputFiles_) {
273  if(!(outputFile.fileHasBeenClosed)) {
275  }
276  }
277  }
278 
280  auto& theMap = outputFiles_.at(token).runReports;
281  std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
282  if(iter == theMap.end() || runNumber < iter->first) { // not found
283  theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {}}); // insert it
284  }
285  }
286 
288  for(auto& inputFile : inputFiles_) {
289  if(!inputFile.fileHasBeenClosed) {
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) { // not found
293  theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {}}); // insert it
294  }
295  }
296  }
297  }
298 
299  void JobReport::JobReportImpl::associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSect, unsigned long nEvents) {
300  auto& theMap = outputFiles_.at(token).runReports;
301  std::map<RunNumber, RunReport>::iterator iter(theMap.lower_bound(runNumber));
302  if(iter == theMap.end() || runNumber < iter->first) { // not found
303  theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {{{lumiSect,nEvents}}}}); // insert it
304  } else {
305  iter->second.lumiSectionsToNEvents[lumiSect]+=nEvents;
306  }
307  }
308 
309  void JobReport::JobReportImpl::associateInputLumiSection(unsigned int runNumber, unsigned int lumiSect) {
310  for(auto& inputFile : inputFiles_) {
311  if(!inputFile.fileHasBeenClosed) {
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) { // not found
315  theMap.emplace_hint(iter, runNumber, JobReport::RunReport{ runNumber, {{lumiSect,std::numeric_limits<unsigned long>::max()}}}); // insert it
316  } else {
317  iter->second.lumiSectionsToNEvents[lumiSect]=std::numeric_limits<unsigned long>::max();
318  }
319  }
320  }
321  }
322 
324  impl_->flushFiles();
325  if(impl_->ost_) {
326  *(impl_->ost_) << "</FrameworkJobReport>\n" << std::flush;
327  }
328  }
329 
331  impl_(new JobReportImpl(0)) {
332  }
333 
334  JobReport::JobReport(std::ostream* iOstream) : impl_(new JobReportImpl(iOstream)) {
335  if(impl_->ost_) {
336  *(impl_->ost_) << "<FrameworkJobReport>\n";
337  }
338  }
339 
341  JobReport::inputFileOpened(std::string const& physicalFileName,
342  std::string const& logicalFileName,
343  std::string const& catalog,
344  std::string const& inputType,
345  std::string const& inputSourceClassName,
346  std::string const& moduleLabel,
347  std::string const& guid,
348  std::vector<std::string> const& branchNames) {
349 
350  InputType theInputType = InputType::Primary;
351  InputFile* newFile = nullptr;
352  JobReport::Token newToken = 0;
353 
354  if (inputType == "mixingFiles") {
355  theInputType = InputType::SecondarySource;
356  auto itr = impl_->inputFilesSecSource_.push_back(InputFile());
357  newFile = &(*itr);
358  newToken = itr - impl_->inputFilesSecSource_.begin();
359  } else {
360  if (inputType == "secondaryFiles") {
361  theInputType = InputType::SecondaryFile;
362  }
363  impl_->inputFiles_.emplace_back();
364  newFile = &impl_->inputFiles_.back();
365  newToken = impl_->inputFiles_.size() - 1;
366  }
367 
368  if(theInputType == InputType::Primary) {
369  impl_->lastOpenedPrimaryInputFile_ = impl_->inputFiles_.size() - 1;
370  }
371  newFile->logicalFileName = logicalFileName;
372  newFile->physicalFileName = physicalFileName;
373  newFile->catalog = catalog;
374  newFile->inputType = inputType;
375  newFile->inputSourceClassName = inputSourceClassName;
376  newFile->moduleLabel = moduleLabel;
377  newFile->guid = guid;
378  newFile->numEventsRead = 0;
379  newFile->branchNames = branchNames;
380  newFile->fileHasBeenClosed = false;
381 
382  // Add the new input file token to all output files
383  // currently open.
384  impl_->insertInputForOutputs(theInputType, newToken);
385  return newToken;
386  }
387 
388  void
390  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
391  ++f.numEventsRead;
392  }
393 
394  void
396  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
397  f.dataType = dataType;
398  }
399 
400  void
402  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
403  f.fileHasBeenClosed = true;
404  if(inputType == InputType::Primary) {
405  impl_->writeInputFile(f);
406  } else {
407  {
408  std::lock_guard<std::mutex> lock(write_mutex);
409  impl_->writeInputFile(f);
410  }
411  }
412  }
413 
415  JobReport::outputFileOpened(std::string const& physicalFileName,
416  std::string const& logicalFileName,
417  std::string const& catalog,
418  std::string const& outputModuleClassName,
419  std::string const& moduleLabel,
420  std::string const& guid,
421  std::string const& dataType,
422  std::string const& branchHash,
423  std::vector<std::string> const& branchNames) {
424  auto itr = impl_->outputFiles_.emplace_back();
425  JobReport::OutputFile& r = *itr;
426 
427  r.logicalFileName = logicalFileName;
428  r.physicalFileName = physicalFileName;
429  r.catalog = catalog;
430  r.outputModuleClassName = outputModuleClassName;
431  r.moduleLabel = moduleLabel;
432  r.guid = guid;
433  r.dataType = dataType;
434  r.branchHash = branchHash;
435  r.numEventsWritten = 0;
436  r.branchNames = branchNames;
437  r.fileHasBeenClosed = false;
438  //
439  // Init list of contributors to list of open input file Tokens
440  //
441  for(std::vector<Token>::size_type i = 0, iEnd = impl_->inputFiles_.size(); i < iEnd; ++i) {
442  if(!impl_->inputFiles_[i].fileHasBeenClosed) {
443  r.contributingInputs.push_back(i);
444  }
445  }
446  for(tbb::concurrent_vector<Token>::size_type i = 0, iEnd = impl_->inputFilesSecSource_.size(); i < iEnd; ++i) {
447  if(!impl_->inputFilesSecSource_[i].fileHasBeenClosed) {
448  r.contributingInputsSecSource.push_back(i);
449  }
450  }
451  return itr - impl_->outputFiles_.begin();
452  }
453 
454  void
456  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
457  ++f.numEventsWritten;
458  }
459 
460  void
462  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
463  f.fileHasBeenClosed = true;
464  impl_->writeOutputFile(f);
465  }
466 
467  void
469  if(impl_->ost_) {
470  std::ostream& msg = *(impl_->ost_);
471  {
472  std::lock_guard<std::mutex> lock(write_mutex);
473  msg << "<SkippedEvent Run=\"" << run << "\"";
474  msg << " Event=\"" << event << "\" />\n";
475  msg << std::flush;
476  }
477  }
478  }
479 
480  void
482  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
483  f.fastCopyingInputs.insert(std::make_pair(inputFileName, fastCopying));
484  }
485 
486  void
487  JobReport::reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents) {
488  impl_->associateLumiSection(token, run, lumiSectId,nEvents);
489  }
490 
491  void
492  JobReport::reportInputLumiSection(unsigned int run, unsigned int lumiSectId) {
493  impl_->associateInputLumiSection(run, lumiSectId);
494  }
495 
496  void
498  impl_->associateRun(token, run);
499  }
500 
501  void
503  impl_->associateInputRun(run);
504  }
505 
506  void
507  JobReport::reportAnalysisFile(std::string const& fileName, std::map<std::string, std::string> const& fileData) {
508  if(impl_->ost_) {
509  std::ostream& msg = *(impl_->ost_);
510  {
511  std::lock_guard<std::mutex> lock(write_mutex);
512  msg << "<AnalysisFile>\n"
513  << " <FileName>" << TiXmlText(fileName) << "</FileName>\n";
514 
515  typedef std::map<std::string, std::string>::const_iterator const_iterator;
516  for(const_iterator pos = fileData.begin(), posEnd = fileData.end(); pos != posEnd; ++pos) {
517  msg << " <" << pos->first
518  << " Value=\"" << pos->second << "\" />"
519  << "\n";
520  }
521  msg << "</AnalysisFile>\n";
522  msg << std::flush;
523  }
524  }
525  }
526 
527  void
529  std::string const& longDesc,
530  int const& exitCode) {
531  if(impl_->ost_) {
532  {
533  std::lock_guard<std::mutex> lock(write_mutex);
534  std::ostream& msg = *(impl_->ost_);
535  msg << "<FrameworkError ExitStatus=\""<< exitCode
536  << "\" Type=\"" << shortDesc << "\" >\n";
537  msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
538  msg << "</FrameworkError>\n";
539  msg << std::flush;
540  }
541  }
542  }
543 
544  void
546  std::string const& lfn) {
547  if(impl_->ost_) {
548  std::ostream& msg = *(impl_->ost_);
549  TiXmlElement skipped("SkippedFile");
550  skipped.SetAttribute("Pfn", pfn);
551  skipped.SetAttribute("Lfn", lfn);
552  {
553  std::lock_guard<std::mutex> lock(write_mutex);
554  msg << skipped << "\n";
555  msg << std::flush;
556  }
557  }
558  }
559 
560  void
562  if(impl_->ost_) {
563  std::ostream& msg = *(impl_->ost_);
564  TiXmlElement fallback("FallbackAttempt");
565  fallback.SetAttribute("Pfn", pfn);
566  fallback.SetAttribute("Lfn", lfn);
567  {
568  std::lock_guard<std::mutex> lock(write_mutex);
569  msg << fallback << "\n";
570  msg << "<![CDATA[\n" << err << "\n]]>\n";
571  msg << std::flush;
572  }
573  }
574  }
575 
576  void
577  JobReport::reportMemoryInfo(std::vector<std::string> const& memoryData) {
578  if(impl_->ost_) {
579  std::ostream& msg = *(impl_->ost_);
580  msg << "<MemoryService>\n";
581 
582  typedef std::vector<std::string>::const_iterator const_iterator;
583  for(const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
584  msg << *pos << "\n";
585  }
586  msg << "</MemoryService>\n";
587  msg << std::flush;
588  }
589  }
590 
591  void
592  JobReport::reportMessageInfo(std::map<std::string, double> const& messageData) {
593  if(impl_->ost_) {
594  std::ostream& msg = *(impl_->ost_);
595  msg << "<MessageSummary>\n";
596  typedef std::map<std::string, double>::const_iterator const_iterator;
597  for(const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
598  msg << " <" << pos->first
599  << " Value=\"" << pos->second << "\" />"
600  << "\n";
601  }
602  msg << "</MessageSummary>\n";
603  msg << std::flush;
604  }
605  }
606 
607  void
609  if(impl_->printedReadBranches_) return;
610  impl_->printedReadBranches_ = true;
611  if(impl_->ost_) {
612  std::ostream& ost = *(impl_->ost_);
613  ost << "<ReadBranches>\n";
614  for(auto const& iBranch : impl_->readBranches_) {
615  TiXmlElement branch("Branch");
616  branch.SetAttribute("Name", iBranch.first);
617  branch.SetAttribute("ReadCount", iBranch.second);
618  ost << branch << "\n";
619  }
620  for(auto const& iBranch : impl_->readBranchesSecFile_) {
621  TiXmlElement branch("Branch");
622  branch.SetAttribute("Name", iBranch.first);
623  branch.SetAttribute("ReadCount", iBranch.second);
624  ost << branch << "\n";
625  }
626  ost << "</ReadBranches>\n";
627  if(!impl_->readBranchesSecSource_.empty()) {
628  ost << "<SecondarySourceReadBranches>\n";
629  for(auto const& iBranch : impl_->readBranchesSecSource_) {
630  TiXmlElement branch("Branch");
631  branch.SetAttribute("Name", iBranch.first);
632  branch.SetAttribute("ReadCount", iBranch.second.value().load());
633  ost << branch << "\n";
634  }
635  ost << "</SecondarySourceReadBranches>\n";
636  }
637  ost << std::flush;
638  }
639  }
640 
641  void
642  JobReport::reportReadBranch(InputType inputType, std::string const& branchName) {
643  if(inputType == InputType::Primary) {
644  // Fast cloned branches have already been reported.
645  std::set<std::string> const& clonedBranches = impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
646  if(clonedBranches.find(branchName) == clonedBranches.end()) {
647  ++impl_->readBranches_[branchName];
648  }
649  } else if (inputType == InputType::SecondaryFile) {
650  ++impl_->readBranchesSecFile_[branchName];
651  } else if (inputType == InputType::SecondarySource) {
652  ++impl_->readBranchesSecSource_[branchName].value();
653  }
654  }
655 
656  void
657  JobReport::reportFastClonedBranches(std::set<std::string> const& fastClonedBranches, long long nEvents) {
658  std::set<std::string>& clonedBranches = impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
659  for(std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
660  it != itEnd; ++it) {
661  if(clonedBranches.insert(*it).second) {
662  impl_->readBranches_[*it] += nEvents;
663  }
664  }
665  }
666 
668  if(impl_->ost_) {
669  std::ostream& msg = *(impl_->ost_);
670  {
671  std::lock_guard<std::mutex> lock(write_mutex);
672  msg << "<RandomServiceStateFile>\n"
673  << TiXmlText(name) << "\n"
674  << "</RandomServiceStateFile>\n";
675  msg << std::flush;
676  }
677  }
678  }
679 
680  void
682  std::map<std::string, std::string> const& metrics) {
683  if(impl_->ost_) {
684  std::ostream& msg = *(impl_->ost_);
685  msg << "<PerformanceReport>\n"
686  << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
687 
688  typedef std::map<std::string, std::string>::const_iterator const_iterator;
689  for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
690  msg << " <Metric Name=\"" << iter->first << "\" "
691  << "Value=\"" << iter->second << "\"/>\n";
692  }
693 
694  msg << " </PerformanceSummary>\n"
695  << "</PerformanceReport>\n";
696  msg << std::flush;
697  //LogInfo("FwkJob") << msg.str();
698  }
699  }
700 
701  void
703  std::string const& moduleName,
704  std::map<std::string, std::string> const& metrics) {
705  if(impl_->ost_) {
706  std::ostream& msg = *(impl_->ost_);
707  msg << "<PerformanceReport>\n"
708  << " <PerformanceModule Metric=\"" << metricClass << "\" "
709  << " Module=\"" << moduleName << "\" >\n";
710 
711  typedef std::map<std::string, std::string>::const_iterator const_iterator;
712  for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
713  msg << " <Metric Name=\"" << iter->first << "\" "
714  << "Value=\"" << iter->second << "\"/>\n";
715  }
716 
717  msg << " </PerformanceModule>\n"
718  << "</PerformanceReport>\n";
719  msg << std::flush;
720  //LogInfo("FwkJob") << msg.str();
721  }
722  }
723 
726  std::ostringstream msg;
727 
728 
729  for(auto const& f :impl_->outputFiles_) {
730 
731  msg << "\n<File>";
732  msg << f;
733 
734  msg << "\n<LumiSections>";
735  msg << "\n<Inputs>";
736  typedef std::vector<JobReport::Token>::iterator iterator;
737  for(auto const& iInput : f.contributingInputs) {
738  auto const& inpFile = impl_->inputFiles_[iInput];
739  msg << "\n<Input>";
740  msg << "\n <LFN>" << TiXmlText(inpFile.logicalFileName) << "</LFN>";
741  msg << "\n <PFN>" << TiXmlText(inpFile.physicalFileName) << "</PFN>";
742  msg << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
743  msg << "\n</Input>";
744  }
745  msg << "\n</Inputs>";
746  msg << "\n</File>";
747 
748  }
749  return msg.str();
750  }
751 
752 } //namspace edm
InputType
Definition: InputType.h:5
void reportSkippedFile(std::string const &pfn, std::string const &lfn)
Definition: JobReport.cc:545
std::string inputSourceClassName
Definition: JobReport.h:130
std::string outputModuleClassName
Definition: JobReport.h:156
std::string physicalFileName
Definition: JobReport.h:154
void associateRun(JobReport::Token token, unsigned int runNumber)
Definition: JobReport.cc:279
void reportMemoryInfo(std::vector< std::string > const &memoryData)
Definition: JobReport.cc:577
void reportInputRunNumber(unsigned int run)
Definition: JobReport.cc:502
void eventReadFromFile(InputType inputType, Token fileToken)
Definition: JobReport.cc:389
std::mutex write_mutex
Definition: JobReport.h:435
void reportFallbackAttempt(std::string const &pfn, std::string const &lfn, std::string const &err)
Definition: JobReport.cc:561
std::string logicalFileName
Definition: JobReport.h:126
unsigned long long EventNumber_t
std::map< std::string, bool > fastCopyingInputs
Definition: JobReport.h:165
std::string logicalFileName
Definition: JobReport.h:153
void reportFastCopyingStatus(Token t, std::string const &inputFileName, bool fastCopying)
Definition: JobReport.cc:481
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:497
void reportRandomStateFile(std::string const &name)
Definition: JobReport.cc:667
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:65
uint16_t size_type
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:434
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)
Definition: JobReport.cc:341
std::vector< InputFile > inputFiles_
Definition: JobReport.h:251
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
Definition: JobReport.cc:702
std::vector< Token > contributingInputs
Definition: JobReport.h:163
std::string physicalFileName
Definition: JobReport.h:127
void reportSkippedEvent(RunNumber_t run, EventNumber_t event)
Definition: JobReport.cc:468
void insertInputForOutputs(InputType inputType, Token t)
Definition: JobReport.cc:180
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
std::size_t numEventsRead
Definition: JobReport.h:133
void writeInputFile(InputFile const &f)
Definition: JobReport.cc:197
StringVector branchNames
Definition: JobReport.h:162
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:492
void reportPerformanceSummary(std::string const &metricClass, std::map< std::string, std::string > const &metrics)
Definition: JobReport.cc:681
double f[11][100]
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)
Definition: JobReport.cc:415
edm::propagate_const< std::ostream * > ost_
Definition: JobReport.h:259
rep
Definition: cuy.py:1188
void reportError(std::string const &shortDesc, std::string const &longDesc, int const &exitCode)
Definition: JobReport.cc:528
std::size_t Token
Definition: JobReport.h:107
void associateInputRun(unsigned int runNumber)
Definition: JobReport.cc:287
S & formatFile(T const &f, S &os)
Definition: JobReport.cc:39
void reportReadBranch(InputType inputType, std::string const &branchName)
Inform the job report that a branch has been read.
Definition: JobReport.cc:642
std::size_t numEventsWritten
Definition: JobReport.h:161
void reportFastClonedBranches(std::set< std::string > const &fastClonedBranches, long long nEvents)
Inform the job report that branches have been fast Cloned.
Definition: JobReport.cc:657
Value const & findOrDefault(std::map< Key, Value > const &m, Key const &k, Value const &defaultValue)
Definition: Map.h:28
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
Definition: JobReport.cc:455
tbb::concurrent_vector< InputFile > inputFilesSecSource_
Definition: JobReport.h:252
void reportMessageInfo(std::map< std::string, double > const &messageData)
Definition: JobReport.cc:592
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
void associateLumiSection(JobReport::Token token, unsigned int runNumber, unsigned int lumiSection, unsigned long nEvents)
Definition: JobReport.cc:299
std::string dumpFiles(void)
debug/test util
Definition: JobReport.cc:725
HLT enums.
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:507
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:461
void writeOutputFile(OutputFile const &f)
Definition: JobReport.cc:224
std::map< unsigned int, unsigned long > lumiSectionsToNEvents
Definition: JobReport.h:111
unsigned int RunNumber_t
InputFile & getInputFileForToken(InputType inputType, Token t)
Definition: JobReport.cc:123
tbb::concurrent_vector< OutputFile > outputFiles_
Definition: JobReport.h:253
void reportDataType(Token fileToken, std::string const &dataType)
Definition: JobReport.cc:395
UInt_t nEvents
Definition: hcalCalib.cc:42
tbb::concurrent_vector< Token > contributingInputsSecSource
Definition: JobReport.h:164
StringVector branchNames
Definition: JobReport.h:134
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
long double T
void inputFileClosed(InputType inputType, Token fileToken)
Definition: JobReport.cc:401
void associateInputLumiSection(unsigned int runNumber, unsigned int lumiSection)
Definition: JobReport.cc:309
Definition: event.py:1
void reportReadBranches()
Definition: JobReport.cc:608
OutputFile & getOutputFileForToken(Token t)
Definition: JobReport.cc:155
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
Definition: JobReport.cc:487