CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
24 
25 #include <fstream>
26 #include <iomanip>
27 #include <iostream>
28 #include <sstream>
29 
30 namespace edm {
31  /*
32  * Note that output formatting is spattered across these classes
33  * If something outside these classes requires access to the
34  * same formatting then we need to refactor it into a common library
35  */
36  template <typename S>
37  S&
38  print(S& os, JobReport::InputFile const& f) {
39 
40  os << "\n<InputFile>";
41  formatFile(f, os);
42  os << "\n<InputType>" << f.inputType << "</InputType>";
43  os << "\n<InputSourceClass>" << TiXmlText(f.inputSourceClassName)
44  << "</InputSourceClass>";
45  os << "\n<EventsRead>" << f.numEventsRead << "</EventsRead>";
46  return os;
47  }
48 
49  template <typename S>
50  S&
51  print(S& os, JobReport::OutputFile const& f) {
52  formatFile(f, os);
53  os << "\n<OutputModuleClass>"
55  << "</OutputModuleClass>";
56  os << "\n<TotalEvents>"
57  << f.numEventsWritten
58  << "</TotalEvents>\n";
59  os << "\n<DataType>"
60  << TiXmlText(f.dataType)
61  << "</DataType>\n";
62  os << "\n<BranchHash>"
63  << TiXmlText(f.branchHash)
64  << "</BranchHash>\n";
65 
66  return os;
67  }
68 
69  template <typename S>
70  S&
71  print(S& os,
72  JobReport::RunReport const& rep) {
73  os << "\n<Run ID=\""
74  << rep.runNumber
75  << "\">\n";
76 
77  typedef std::set<unsigned int>::iterator iterator;
78  for (iterator il = rep.lumiSections.begin(), ilEnd = rep.lumiSections.end(); il != ilEnd; ++il) {
79  os << " <LumiSection ID=\"" << *il << "\"/>\n";
80 
81  }
82  os << "</Run>\n";
83  return os;
84  }
85 
86  std::ostream& operator<< (std::ostream& os, JobReport::InputFile const& f) {
87  return print(os,f);
88  }
89  std::ostream& operator<< (std::ostream& os, JobReport::OutputFile const& f) {
90  return print(os,f);
91  }
92 
93  std::ostream& operator<< (std::ostream& os, JobReport::RunReport const& f) {
94  return print(os,f);
95  }
96 
97  //To talk to MessageLogger directly
99  return print(os,f);
100  }
102  return print(os,f);
103  }
105  return print(os,f);
106  }
107 // edm::MessageSender& operator<< (edm::MessageSender& os, JobReport::LumiSectionReport const& rep) {
108 // return print(os,rep);
109 // }
110 //
111 
113  if (t >= inputFiles_.size()) {
115  << "Access reported for input file with token "
116  << t
117  << " but no matching input file is found\n";
118  }
119 
120  if (inputFiles_[t].fileHasBeenClosed) {
122  << "Access reported for input file with token "
123  << t
124  << " after this file has been closed.\n"
125  << "File record follows:\n"
126  << inputFiles_[t]
127  << '\n';
128  }
129 
130  return inputFiles_[t];
131  }
132 
134  if (t >= outputFiles_.size()) {
136  << "Access reported for output file with token "
137  << t
138  << " but no matching output file is found\n";
139  }
140  if (outputFiles_[t].fileHasBeenClosed) {
142  << "Access reported for output file with token "
143  << t
144  << " after this file has been closed.\n"
145  << "File record follows:\n"
146  << outputFiles_[t]
147  << '\n';
148  }
149  return outputFiles_[t];
150  }
151 
152  /*
153  * Add the input file token provided to every output
154  * file currently available.
155  * Used whenever a new input file is opened, it's token
156  * is added to all open output files as a contributor
157  */
159  typedef std::vector<JobReport::OutputFile>::iterator iterator;
160  for (iterator outFile = outputFiles_.begin(), outFileEnd = outputFiles_.end(); outFile != outFileEnd; ++outFile) {
161  outFile->contributingInputs.push_back(t);
162  }
163  }
164  /*
165  * get a vector of Tokens for all currently open
166  * input files.
167  * Used when a new output file is opened, all currently open
168  * input file tokens are used to initialize its list of contributors
169  */
170  void JobReport::JobReportImpl::openInputFiles(std::vector<JobReport::Token>& result) {
171  result.reserve(inputFiles_.size());
172  for (unsigned int i = 0; i < inputFiles_.size(); ++i) {
173  if (inputFiles_[i].fileHasBeenClosed == false) {
174  result.push_back(i);
175  }
176  }
177  }
178 
179  /*
180  * get a vector of Tokens for all currently open
181  * output files.
182  *
183  */
184  void JobReport::JobReportImpl::openOutputFiles(std::vector<JobReport::Token>& result) {
185  result.reserve(outputFiles_.size());
186  for (unsigned int i = 0; i < outputFiles_.size(); ++i) {
187  if (outputFiles_[i].fileHasBeenClosed == false) {
188  result.push_back(i);
189  }
190  }
191  }
192 
193  /*
194  * Write anJobReport::InputFile object to the Logger
195  * Generate XML string forJobReport::InputFile instance and dispatch to
196  * job report via MessageLogger
197  */
199  if(ost_) {
200  *ost_ << f ;
201  *ost_ << "\n<Runs>";
202  typedef std::map<JobReport::RunNumber, JobReport::RunReport>::const_iterator const_iterator;
203  for (const_iterator iRun = f.runReports.begin(), iRunEnd = f.runReports.end(); iRun != iRunEnd; ++iRun) {
204  *ost_ << iRun->second;
205  }
206  *ost_ << "\n</Runs>\n";
207  *ost_ << "</InputFile>\n";
208  *ost_ << std::flush;
209  }
210  //LogInfo("FwkJob") << f;
211  }
212 
213  /*
214  * Write an OutputFile object to the Logger
215  * Generate an XML string for the OutputFile provided and
216  * dispatch it to the logger
217  * Contributing input tokens are resolved to the input LFN and PFN
218  *
219  * TODO: We have not yet addressed the issue where we cleanup not
220  * contributing input files.
221  * Also, it is possible to get fake input to output file mappings
222  * if an input file is open already when a new output file is opened
223  * but the input gets closed without contributing events to the
224  * output file due to filtering etc.
225  *
226  */
228  if (ost_) {
229  *ost_ << "\n<File>";
230  *ost_ << f;
231 
232  *ost_ << "\n<Runs>";
233  typedef std::map<JobReport::RunNumber, JobReport::RunReport>::const_iterator const_iterator;
234  for (const_iterator iRun = f.runReports.begin(), iRunEnd = f.runReports.end(); iRun != iRunEnd; ++iRun) {
235  *ost_ << iRun->second;
236  }
237  *ost_ << "\n</Runs>\n";
238 
239  *ost_ << "\n<Inputs>";
240  for (std::vector<JobReport::Token>::const_iterator
241  iInput = f.contributingInputs.begin(),
242  iInputEnd = f.contributingInputs.end();
243  iInput != iInputEnd; ++iInput) {
244  JobReport::InputFile inpFile = inputFiles_[*iInput];
245  *ost_ << "\n<Input>";
246  *ost_ << "\n <LFN>" << TiXmlText(inpFile.logicalFileName) << "</LFN>";
247  *ost_ << "\n <PFN>" << TiXmlText(inpFile.physicalFileName) << "</PFN>";
248  *ost_ << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
249  *ost_ << "\n</Input>";
250  }
251  *ost_ << "\n</Inputs>";
252  *ost_ << "\n</File>\n";
253  }
254  }
255 
256  /*
257  * Flush all open files to logger in event of a problem.
258  * Called from JobReport dtor to flush any remaining open files
259  */
261  for (std::vector<JobReport::InputFile>::iterator ipos = inputFiles_.begin(), iposEnd = inputFiles_.end();
262  ipos != iposEnd; ++ipos) {
263  if (!(ipos->fileHasBeenClosed)) {
264  writeInputFile(*ipos);
265  }
266  }
267  for (std::vector<JobReport::OutputFile>::iterator opos = outputFiles_.begin(), oposEnd = outputFiles_.end();
268  opos != oposEnd; ++opos) {
269  if (!(opos->fileHasBeenClosed)) {
270  writeOutputFile(*opos);
271  }
272  }
273  }
274 
276  std::string const& value) {
277 
278  generatorInfo_[name] = value;
279  }
280 
282  if(ost_) {
283  *ost_ << "\n<GeneratorInfo>\n";
284  for (std::map<std::string, std::string>::iterator pos = generatorInfo_.begin(),
285  posEnd = generatorInfo_.end();
286  pos != posEnd; ++pos) {
287  std::ostringstream msg;
288  msg << "\n<Data Name=\"" << pos->first
289  << "\" Value=\"" << pos->second << "\"/>";
290  *ost_ << msg.str();
291  }
292  *ost_ << "</GeneratorInfo>\n";
293  }
294  }
295 
297  std::vector<Token> openFiles;
298  openOutputFiles(openFiles);
299  for (std::vector<Token>::iterator iToken = openFiles.begin(), iTokenEnd = openFiles.end(); iToken != iTokenEnd; ++iToken) {
300  JobReport::OutputFile & theFile = outputFiles_[*iToken];
301 
302  //
303  // check run is known to file
304  // if not, add a run report for that run
305  if (theFile.runReports.count(runNumber) == 0) {
307  newReport.runNumber = runNumber;
308  theFile.runReports.insert(
309  std::make_pair(runNumber, newReport)
310  );
311  }
312 
313  }
314  }
315 
317  std::vector<Token> openFiles;
318  openInputFiles(openFiles);
319  for (std::vector<Token>::iterator iToken = openFiles.begin(), iTokenEnd = openFiles.end(); iToken != iTokenEnd; ++iToken) {
320  JobReport::InputFile & theFile = inputFiles_[*iToken];
321 
322  //
323  // check run is known to file
324  // if not, add a run report for that run
325  if (theFile.runReports.count(runNumber) == 0) {
327  newReport.runNumber = runNumber;
328  theFile.runReports.insert(std::make_pair(runNumber, newReport));
329  }
330 
331  }
332  }
333 
334  void JobReport::JobReportImpl::associateLumiSection(unsigned int runNumber, unsigned int lumiSect) {
335  std::vector<Token> openFiles;
336  openOutputFiles(openFiles);
337  for (std::vector<Token>::iterator iToken = openFiles.begin(), iTokenEnd = openFiles.end(); iToken != iTokenEnd; ++iToken) {
338  //
339  // Loop over all open output files
340  //
341  JobReport::OutputFile & theFile = outputFiles_[*iToken];
342 
343  //
344  // check run is known to file
345  // if not, add a run report for that run
346  if (theFile.runReports.count(runNumber) == 0) {
348  newReport.runNumber = runNumber;
349  theFile.runReports.insert(std::make_pair(runNumber, newReport));
350  }
351 
352  //
353  // Get the run report for this run, now that it either was created
354  // or already existed
355  std::map<JobReport::RunNumber, JobReport::RunReport>::iterator finder;
356  finder = theFile.runReports.find(runNumber);
357 
358  //
359  // add the lumi section to the report, the lumi list is a Set
360  // so duplicates dont matter
361  (finder->second).lumiSections.insert(lumiSect);
362  }
363  }
364 
365  void JobReport::JobReportImpl::associateInputLumiSection(unsigned int runNumber, unsigned int lumiSect) {
366  std::vector<Token> openFiles;
367  openInputFiles(openFiles);
368  for (std::vector<Token>::iterator iToken = openFiles.begin(), iTokenEnd = openFiles.end(); iToken != iTokenEnd; ++iToken) {
369  //
370  // Loop over all open input files
371  //
372  JobReport::InputFile & theFile = inputFiles_[*iToken];
373 
374  //
375  // check run is known to file
376  // if not, add a run report for that run
377  if (theFile.runReports.count(runNumber) == 0) {
379  newReport.runNumber = runNumber;
380  theFile.runReports.insert(std::make_pair(runNumber, newReport));
381  }
382 
383  //
384  // Get the run report for this run, now that it either was created
385  // or already existed
386  std::map<JobReport::RunNumber, JobReport::RunReport>::iterator finder;
387  finder = theFile.runReports.find(runNumber);
388 
389  //
390  // add the lumi section to the report, the lumi list is a Set
391  // so duplicates dont matter
392  (finder->second).lumiSections.insert(lumiSect);
393  }
394  }
395 
397  impl_->writeGeneratorInfo();
398  impl_->flushFiles();
399  if(impl_->ost_) {
400  *(impl_->ost_) << "</FrameworkJobReport>\n" << std::flush;
401  }
402  }
403 
405  impl_(new JobReportImpl(0)) {
406  }
407 
408  JobReport::JobReport(std::ostream* iOstream) : impl_(new JobReportImpl(iOstream)) {
409  if(impl_->ost_) {
410  *(impl_->ost_) << "<FrameworkJobReport>\n";
411  }
412  }
413 
414  namespace {
415  void
416  toFileName(std::string const& jobReportFile, unsigned int childIndex, unsigned int numberOfChildren, std::ostringstream& ofilename) {
417  unsigned int numberOfDigitsInIndex = 0U;
418  while (numberOfChildren != 0) {
419  ++numberOfDigitsInIndex;
420  numberOfChildren /= 10;
421  }
422  if (numberOfDigitsInIndex == 0) {
423  numberOfDigitsInIndex = 3; // Protect against zero numberOfChildren
424  }
425  std::string::size_type offset = jobReportFile.rfind('.');
426  if (offset == std::string::npos) {
427  ofilename << jobReportFile;
428  ofilename << '_' << std::setw(numberOfDigitsInIndex) << std::setfill('0') << childIndex;
429  } else {
430  ofilename << jobReportFile.substr(0, offset);
431  ofilename << '_' << std::setw(numberOfDigitsInIndex) << std::setfill('0') << childIndex;
432  ofilename << jobReportFile.substr(offset);
433  }
434  }
435  }
436 
437  void
438  JobReport::parentBeforeFork(std::string const& jobReportFile, unsigned int numberOfChildren) {
439  if(impl_->ost_) {
440  *(impl_->ost_) << "<ChildProcessFiles>\n";
441  for (unsigned int i = 0; i < numberOfChildren; ++i) {
442  std::ostringstream ofilename;
443  toFileName(jobReportFile, i, numberOfChildren, ofilename);
444  *(impl_->ost_) << " <ChildProcessFile>" << ofilename.str() << "</ChildProcessFile>\n";
445  }
446  *(impl_->ost_) << "</ChildProcessFiles>\n";
447  *(impl_->ost_) << "</FrameworkJobReport>\n";
448  std::ofstream* p = dynamic_cast<std::ofstream *>(impl_->ost_);
449  if (p) {
450  p->close();
451  }
452  }
453  }
454 
455  void
456  JobReport::parentAfterFork(std::string const& jobReportFile) {
457  }
458 
459  void
460  JobReport::childAfterFork(std::string const& jobReportFile, unsigned int childIndex, unsigned int numberOfChildren) {
461  std::ofstream* p = dynamic_cast<std::ofstream *>(impl_->ost_);
462  if (!p) return;
463  std::ostringstream ofilename;
464  toFileName(jobReportFile, childIndex, numberOfChildren, ofilename);
465  p->open(ofilename.str().c_str());
466  *p << "<FrameworkJobReport>\n";
467  }
468 
470  JobReport::inputFileOpened(std::string const& physicalFileName,
471  std::string const& logicalFileName,
472  std::string const& catalog,
473  std::string const& inputType,
474  std::string const& inputSourceClassName,
475  std::string const& moduleLabel,
476  std::string const& guid,
477  std::vector<std::string> const& branchNames) {
478  // Do we have to worry about thread safety here? Or is this
479  // service used in a way to make this safe?
480  impl_->inputFiles_.push_back(JobReport::InputFile());
481  JobReport::InputFile& r = impl_->inputFiles_.back();
482 
483  r.logicalFileName = logicalFileName;
484  r.physicalFileName = physicalFileName;
485  r.catalog = catalog;
486  r.inputType = inputType;
487  r.inputSourceClassName = inputSourceClassName;
489  r.guid = guid;
490  // r.runsSeen is not modified
491  r.numEventsRead = 0;
492  r.branchNames = branchNames;
493  r.fileHasBeenClosed = false;
494 
495  JobReport::Token newToken = impl_->inputFiles_.size()-1;
496  //
497  // Add the new input file token to all output files
498  // currently open.
499  impl_->insertInputForOutputs(newToken);
500  return newToken;
501  }
502 
503  void
504  JobReport::eventReadFromFile(JobReport::Token fileToken, unsigned int run, unsigned int) {
505  JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
506  ++f.numEventsRead;
507  //f.runsSeen.insert(run);
508  }
509 
510  void
511  JobReport::reportDataType(Token fileToken, std::string const& dataType) {
512  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
513  f.dataType = dataType;
514  }
515 
516  void
518  JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
519  // Dump information to the MessageLogger's JobSummary
520  // about this file.
521  // After setting the file to 'closed', we will no longer be able
522  // to reference it by ID.
523  f.fileHasBeenClosed = true;
524  impl_->writeInputFile(f);
525  }
526 
528  JobReport::outputFileOpened(std::string const& physicalFileName,
529  std::string const& logicalFileName,
530  std::string const& catalog,
531  std::string const& outputModuleClassName,
532  std::string const& moduleLabel,
533  std::string const& guid,
534  std::string const& dataType,
535  std::string const& branchHash,
536  std::vector<std::string> const& branchNames) {
537  impl_->outputFiles_.push_back(JobReport::OutputFile());
538  JobReport::OutputFile& r = impl_->outputFiles_.back();
539 
540  r.logicalFileName = logicalFileName;
541  r.physicalFileName = physicalFileName;
542  r.catalog = catalog;
543  r.outputModuleClassName = outputModuleClassName;
545  r.guid = guid;
546  r.dataType = dataType;
547  r.branchHash = branchHash;
548  // r.runsSeen is not modified
549  r.numEventsWritten = 0;
550  r.branchNames = branchNames;
551  r.fileHasBeenClosed = false;
552  //
553  // Init list of contributors to list of open input file Tokens
554  //
555  impl_->openInputFiles(r.contributingInputs);
556  return impl_->outputFiles_.size()-1;
557  }
558 
559  void
560  JobReport::eventWrittenToFile(JobReport::Token fileToken, unsigned int run, unsigned int) {
561  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
562  ++f.numEventsWritten;
563  //f.runsSeen.insert(run);
564  }
565 
566  void
568  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
569  // Dump information to the MessageLogger's JobSummary
570  // about this file.
571  // After setting the file to 'closed', we will no longer be able
572  // to reference it by ID.
573  f.fileHasBeenClosed = true;
574  impl_->writeOutputFile(f);
575  }
576 
577  void
578  JobReport:: reportFastCopyingStatus(JobReport::Token fileToken, std::string const& inputFileName, bool fastCopying) {
579  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
580  f.fastCopyingInputs.insert(std::make_pair(inputFileName, fastCopying));
581  }
582 
583  void
584  JobReport::overrideEventsWritten(Token fileToken, int const eventsWritten) {
585  // Get the required output file instance using the token
586  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
587  // set the eventsWritten parameter to the provided value
588  f.numEventsWritten = eventsWritten;
589  }
590 
591  void
592  JobReport::overrideEventsRead(Token fileToken, int const eventsRead) {
593  // Get the required input file instance using the token
594  JobReport::InputFile& f = impl_->getInputFileForToken(fileToken);
595  // set the events read parameter to the provided value
596  f.numEventsRead = eventsRead;
597  }
598 
599  void
601  std::vector<Token> const& inputTokens) {
602  // Get the required output file instance using the token
603  JobReport::OutputFile& f = impl_->getOutputFileForToken(outputToken);
604  // override its contributing inputs data
605  f.contributingInputs = inputTokens;
606  }
607 
608  void
609  JobReport::reportSkippedEvent(unsigned int run, unsigned int event) {
610  if(impl_->ost_) {
611  std::ostream& msg = *(impl_->ost_);
612  msg << "<SkippedEvent Run=\"" << run << "\"";
613  msg << " Event=\"" << event << "\" />\n";
614  msg << std::flush;
615  //LogInfo("FwkJob") << msg.str();
616  }
617  }
618 
619  void
620  JobReport::reportLumiSection(unsigned int run, unsigned int lumiSectId) {
621  impl_->associateLumiSection(run, lumiSectId);
622  }
623 
624  void
625  JobReport::reportInputLumiSection(unsigned int run, unsigned int lumiSectId) {
626  impl_->associateInputLumiSection(run, lumiSectId);
627  }
628 
629  void
631  impl_->associateRun(run);
632  }
633  void
635  impl_->associateInputRun(run);
636  }
637 
638  void
639  JobReport::reportError(std::string const& shortDesc,
640  std::string const& longDesc) {
641  if(impl_->ost_) {
642  std::ostream& msg = *(impl_->ost_);
643  msg << "<FrameworkError ExitStatus=\"1\" Type=\"" << shortDesc << "\" >\n";
644  msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
645  msg << "</FrameworkError>\n";
646  //LogError("FwkJob") << msg.str();
647  msg << std::flush;
648  }
649  }
650 
651  void
652  JobReport::reportAnalysisFile(std::string const& fileName, std::map<std::string, std::string> const& fileData) {
653  if(impl_->ost_) {
654  std::ostream& msg = *(impl_->ost_);
655  //std::ostringstream msg;
656  msg << "<AnalysisFile>\n"
657  << " <FileName>" << TiXmlText(fileName) << "</FileName>\n";
658 
659  typedef std::map<std::string, std::string>::const_iterator const_iterator;
660  for (const_iterator pos = fileData.begin(), posEnd = fileData.end(); pos != posEnd; ++pos) {
661  msg << " <" << pos->first
662  << " Value=\"" << pos->second << "\" />"
663  << "\n";
664  }
665  msg << "</AnalysisFile>\n";
666  //LogError("FwkJob") << msg.str();
667  msg << std::flush;
668  }
669  }
670 
671  void
672  JobReport::reportError(std::string const& shortDesc,
673  std::string const& longDesc,
674  int const& exitCode) {
675  if(impl_->ost_) {
676  std::ostream& msg = *(impl_->ost_);
677  //std::ostringstream msg;
678  msg << "<FrameworkError ExitStatus=\""<< exitCode
679  << "\" Type=\"" << shortDesc << "\" >\n";
680  msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
681  msg << "</FrameworkError>\n";
682  //LogError("FwkJob") << msg.str();
683  msg << std::flush;
684  }
685  }
686 
687  void
688  JobReport::reportSkippedFile(std::string const& pfn,
689  std::string const& lfn) {
690  if(impl_->ost_) {
691  std::ostream& msg = *(impl_->ost_);
692  TiXmlElement skipped("SkippedFile");
693  skipped.SetAttribute("Pfn", pfn);
694  skipped.SetAttribute("Lfn", lfn);
695  msg << skipped << "\n";
696  msg << std::flush;
697  //LogInfo("FwkJob") << msg.str();
698  }
699  }
700 
701  void
702  JobReport::reportMemoryInfo(std::vector<std::string> const& memoryData) {
703  if(impl_->ost_) {
704  std::ostream& msg = *(impl_->ost_);
705  msg << "<MemoryService>\n";
706 
707  typedef std::vector<std::string>::const_iterator const_iterator;
708  for (const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
709  msg << *pos << "\n";
710  }
711  msg << "</MemoryService>\n";
712  msg << std::flush;
713  }
714  }
715 
716  void
717  JobReport::reportMessageInfo(std::map<std::string, double> const& messageData) {
718  if(impl_->ost_) {
719  std::ostream& msg = *(impl_->ost_);
720  msg << "<MessageSummary>\n";
721  typedef std::map<std::string, double>::const_iterator const_iterator;
722  for (const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
723  msg << " <" << pos->first
724  << " Value=\"" << pos->second << "\" />"
725  << "\n";
726  }
727  msg << "</MessageSummary>\n";
728  msg << std::flush;
729  }
730  }
731 
732  void
733  JobReport::reportGeneratorInfo(std::string const& name, std::string const& value) {
734  impl_->addGeneratorInfo(name, value);
735  }
736 
737  void JobReport::reportRandomStateFile(std::string const& name) {
738  if(impl_->ost_) {
739  std::ostream& msg = *(impl_->ost_);
740  msg << "<RandomServiceStateFile>\n"
741  << TiXmlText(name) << "\n"
742  << "</RandomServiceStateFile>\n";
743  //LogInfo("FwkJob") << msg.str();
744  msg << std::flush;
745  }
746  }
747 
748  void
749  JobReport::reportPSetHash(std::string const& hashValue) {
750  if(impl_->ost_) {
751  std::ostream& msg = *(impl_->ost_);
752  msg << "<PSetHash>"
753  << hashValue
754  << "</PSetHash>\n";
755  //LogInfo("FwkJob") << msg.str();
756  msg << std::flush;
757  }
758  }
759 
760  void
761  JobReport::reportPerformanceSummary(std::string const& metricClass,
762  std::map<std::string, std::string> const& metrics) {
763  if(impl_->ost_) {
764  std::ostream& msg = *(impl_->ost_);
765  msg << "<PerformanceReport>\n"
766  << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
767 
768  typedef std::map<std::string, std::string>::const_iterator const_iterator;
769  for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
770  msg << " <Metric Name=\"" << iter->first << "\" "
771  << "Value=\"" << iter->second << "\"/>\n";
772  }
773 
774  msg << " </PerformanceSummary>\n"
775  << "</PerformanceReport>\n";
776  msg << std::flush;
777  //LogInfo("FwkJob") << msg.str();
778  }
779  }
780 
781  void
782  JobReport::reportPerformanceForModule(std::string const& metricClass,
783  std::string const& moduleName,
784  std::map<std::string, std::string> const& metrics) {
785  if(impl_->ost_) {
786  std::ostream& msg = *(impl_->ost_);
787  msg << "<PerformanceReport>\n"
788  << " <PerformanceModule Metric=\"" << metricClass << "\" "
789  << " Module=\"" << moduleName << "\" >\n";
790 
791  typedef std::map<std::string, std::string>::const_iterator const_iterator;
792  for(const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
793  msg << " <Metric Name=\"" << iter->first << "\" "
794  << "Value=\"" << iter->second << "\"/>\n";
795  }
796 
797  msg << " </PerformanceModule>\n"
798  << "</PerformanceReport>\n";
799  msg << std::flush;
800  //LogInfo("FwkJob") << msg.str();
801  }
802  }
803 
804  std::string
806  std::ostringstream msg;
807 
808  typedef std::vector<JobReport::OutputFile>::iterator iterator;
809 
810  for (iterator f = impl_->outputFiles_.begin(), fEnd = impl_->outputFiles_.end(); f != fEnd; ++f) {
811 
812  msg << "\n<File>";
813  msg << *f;
814 
815  msg << "\n<LumiSections>";
816  //typedef std::vector<JobReport::LumiSectionReport>::iterator Iter;
817  //for (Iter iLumi = f->lumiSections.begin(),
818  // iLumiEnd = f->lumiSections.end();
819  // iLumi != iLumiEnd; ++iLumi) {
820  // msg << *iLumi;
821  //}
822  //msg << "\n</LumiSections>\n";
823  msg << "\n<Inputs>";
824  typedef std::vector<JobReport::Token>::iterator iterator;
825  for (iterator iInput = f->contributingInputs.begin(),
826  iInputEnd = f->contributingInputs.end();
827  iInput != iInputEnd; ++iInput) {
828  JobReport::InputFile inpFile = impl_->inputFiles_[*iInput];
829  msg << "\n<Input>";
830  msg << "\n <LFN>" << TiXmlText(inpFile.logicalFileName) << "</LFN>";
831  msg << "\n <PFN>" << TiXmlText(inpFile.physicalFileName) << "</PFN>";
832  msg << "\n <FastCopying>" << findOrDefault(f->fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
833  msg << "\n</Input>";
834  }
835  msg << "\n</Inputs>";
836  msg << "\n</File>";
837 
838  }
839  return msg.str();
840  }
841 
842 } //namspace edm
void openInputFiles(std::vector< Token > &tokens)
Definition: JobReport.cc:170
void associateRun(unsigned int runNumber)
Definition: JobReport.cc:296
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:528
int i
Definition: DBlmapReader.cc:9
std::string inputSourceClassName
Definition: JobReport.h:87
list pfn
Definition: dbtoconf.py:76
void eventWrittenToFile(Token fileToken, unsigned int run, unsigned int event)
Definition: JobReport.cc:560
std::string outputModuleClassName
Definition: JobReport.h:112
std::string physicalFileName
Definition: JobReport.h:110
void reportFastCopyingStatus(Token t, std::string const &inputFileName, bool fastCopying)
Definition: JobReport.cc:578
std::string logicalFileName
Definition: JobReport.h:83
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:470
void overrideEventsWritten(Token fileToken, int const eventsWritten)
Definition: JobReport.cc:584
void reportAnalysisFile(std::string const &fileName, std::map< std::string, std::string > const &fileData)
Definition: JobReport.cc:652
void reportRandomStateFile(std::string const &name)
Definition: JobReport.cc:737
std::map< std::string, bool > fastCopyingInputs
Definition: JobReport.h:120
std::string logicalFileName
Definition: JobReport.h:109
void reportDataType(Token fileToken, std::string const &dataType)
Definition: JobReport.cc:511
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:38
uint16_t size_type
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:567
std::vector< InputFile > inputFiles_
Definition: JobReport.h:225
std::map< RunNumber, RunReport > runReports
Definition: JobReport.h:92
std::vector< Token > contributingInputs
Definition: JobReport.h:119
std::string physicalFileName
Definition: JobReport.h:84
void writeInputFile(InputFile const &f)
Definition: JobReport.cc:198
void inputFileClosed(Token fileToken)
Definition: JobReport.cc:517
StringVector branchNames
Definition: JobReport.h:118
tuple result
Definition: query.py:137
void SetAttribute(const char *name, const char *_value)
Definition: tinyxml.cc:719
std::map< RunNumber, RunReport > runReports
Definition: JobReport.h:121
std::set< unsigned int > lumiSections
Definition: JobReport.h:68
double f[11][100]
void parentAfterFork(std::string const &jobReportFile)
Definition: JobReport.cc:456
void reportSkippedEvent(unsigned int run, unsigned int event)
Definition: JobReport.cc:609
void openOutputFiles(std::vector< Token > &tokens)
Definition: JobReport.cc:184
unsigned int offset(bool)
void reportPSetHash(std::string const &hashValue)
Definition: JobReport.cc:749
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void eventReadFromFile(Token fileToken, unsigned int run, unsigned int event)
Definition: JobReport.cc:504
void reportInputRunNumber(unsigned int run)
Definition: JobReport.cc:634
std::size_t Token
Definition: JobReport.h:44
void associateInputRun(unsigned int runNumber)
Definition: JobReport.cc:316
InputFile & getInputFileForToken(Token t)
Definition: JobReport.cc:112
S & formatFile(T const &f, S &os)
Definition: JobReport.h:430
void childAfterFork(std::string const &jobReportFile, unsigned int childIndex, unsigned int numberOfChildren)
New output file for child.
Definition: JobReport.cc:460
boost::scoped_ptr< JobReportImpl > impl_
Definition: JobReport.h:416
void reportGeneratorInfo(std::string const &name, std::string const &value)
Definition: JobReport.cc:733
void reportLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:620
Value const & findOrDefault(std::map< Key, Value > const &m, Key const &k, Value const &defaultValue)
Definition: Map.h:28
void reportMemoryInfo(std::vector< std::string > const &memoryData)
Definition: JobReport.cc:702
std::string moduleLabel
Definition: JobReport.h:88
std::string dumpFiles(void)
debug/test util
Definition: JobReport.cc:805
void reportError(std::string const &shortDesc, std::string const &longDesc)
Definition: JobReport.cc:639
void reportInputLumiSection(unsigned int run, unsigned int lumiSectId)
Definition: JobReport.cc:625
void writeOutputFile(OutputFile const &f)
Definition: JobReport.cc:227
void overrideEventsRead(Token fileToken, int const eventsRead)
Definition: JobReport.cc:592
void reportPerformanceSummary(std::string const &metricClass, std::map< std::string, std::string > const &metrics)
Definition: JobReport.cc:761
void insertInputForOutputs(Token t)
Definition: JobReport.cc:158
StringVector branchNames
Definition: JobReport.h:91
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
void parentBeforeFork(std::string const &jobReportFile, unsigned int numberOfChildren)
Definition: JobReport.cc:438
void associateInputLumiSection(unsigned int runNumber, unsigned int lumiSection)
Definition: JobReport.cc:365
void addGeneratorInfo(std::string const &name, std::string const &value)
Definition: JobReport.cc:275
void reportPerformanceForModule(std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
Definition: JobReport.cc:782
void reportMessageInfo(std::map< std::string, double > const &messageData)
Definition: JobReport.cc:717
void overrideContributingInputs(Token outputToken, std::vector< Token > const &inputTokens)
Definition: JobReport.cc:600
void associateLumiSection(unsigned int runNumber, unsigned int lumiSection)
Definition: JobReport.cc:334
OutputFile & getOutputFileForToken(Token t)
Definition: JobReport.cc:133
void reportRunNumber(unsigned int run)
Definition: JobReport.cc:630
void reportSkippedFile(std::string const &pfn, std::string const &lfn)
Definition: JobReport.cc:688
const std::string * moduleLabel() const
Definition: HLTadd.h:40