CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
edm::JobReport Class Reference

#include <JobReport.h>

Inheritance diagram for edm::JobReport:
edm::service::JobReportService

Classes

class  AtomicLongLong
 
struct  InputFile
 
struct  JobReportImpl
 
struct  OutputFile
 
struct  RunReport
 

Public Types

typedef unsigned int RunNumber
 
typedef std::size_t Token
 

Public Member Functions

std::string dumpFiles (void)
 debug/test util More...
 
void eventReadFromFile (InputType inputType, Token fileToken)
 
void eventWrittenToFile (Token fileToken, RunNumber_t run, EventNumber_t event)
 
void inputFileClosed (InputType inputType, Token fileToken)
 
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)
 
 JobReport ()
 
 JobReport (std::ostream *outputStream)
 
 JobReport (JobReport const &)=delete
 
JobReportoperator= (JobReport const &)=delete
 
void outputFileClosed (Token fileToken)
 
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)
 
void reportAnalysisFile (std::string const &fileName, std::map< std::string, std::string > const &fileData)
 
void reportDataType (Token fileToken, std::string const &dataType)
 
void reportError (std::string const &shortDesc, std::string const &longDesc, int const &exitCode)
 
void reportFallbackAttempt (std::string const &pfn, std::string const &lfn, std::string const &err)
 
void reportFastClonedBranches (std::set< std::string > const &fastClonedBranches, long long nEvents)
 Inform the job report that branches have been fast Cloned. More...
 
void reportFastCopyingStatus (Token t, std::string const &inputFileName, bool fastCopying)
 
void reportInputLumiSection (unsigned int run, unsigned int lumiSectId)
 
void reportInputRunNumber (unsigned int run)
 
void reportLumiSection (JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
 
void reportMemoryInfo (std::vector< std::string > const &memoryData)
 
void reportMessageInfo (std::map< std::string, double > const &messageData)
 
void reportPerformanceForModule (std::string const &metricClass, std::string const &moduleName, std::map< std::string, std::string > const &metrics)
 
void reportPerformanceSummary (std::string const &metricClass, std::map< std::string, std::string > const &metrics)
 
void reportRandomStateFile (std::string const &name)
 
void reportReadBranch (InputType inputType, std::string const &branchName)
 Inform the job report that a branch has been read. More...
 
void reportReadBranches ()
 
void reportRunNumber (JobReport::Token token, unsigned int run)
 
void reportSkippedEvent (RunNumber_t run, EventNumber_t event)
 
void reportSkippedFile (std::string const &pfn, std::string const &lfn)
 
 ~JobReport ()
 

Protected Member Functions

edm::propagate_const< std::unique_ptr< JobReportImpl > > & impl ()
 

Private Member Functions

void temporarilyCloseXML ()
 

Private Attributes

edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
 
std::mutex write_mutex
 

Detailed Description

Description: A service that collections job handling information.

Usage: The JobReport service collects 'job handling' information (currently file handling) from several sources, collates the information, and at appropriate intervals, reports the information to the job report, through the MessageLogger.

CMS-THREADING Some notes about thread safety:

  1. It is assumed non-experts will turn the job report on and look at the XML output and NOT call the available public functions. Many of the available service functions can be called at times that are not thread safe (causing data races or interleaved output). The following notes are for Framework experts and detail the assumptions made when modifying JobReport to run in the multithreaded Framework.
  2. We assume the primary input source performs its activity serially. There can be multiple secondary input sources running concurrently.
  3. We assume the following sequence of activities where the lines of asterisks indicate synchronization points:

open primary input file nothing else running concurrently Also respondToOpenInputFiles serially

open output files serially nothing else running concurrently

The primary source runs its other tasks concurrently with the secondary sources running their tasks and modules running their tasks.

close primary input file nothing else running concurrently

close output files serially nothing else running concurrently

repeat the above (the output file opens and closes are optional except for the first and last)

All endJob and postEndJob activities occur serially not concurrently

  1. We assume that a single instance of an OutputModule will only be running on one thread at a time. Other instances of that type of OutputModule may be running concurrently. There are several functions where this is an issue. We have discussed that in the future we might decide to run the OutputModule for multiple events concurrently. That would require further modifications of either the JobReport or the OutputModule.
  2. For Primary and SecondaryFile input sources (not SecondarySource) the calls to reportBranchName from the delayed reader need to be serialized.

Definition at line 103 of file JobReport.h.

Member Typedef Documentation

◆ RunNumber

typedef unsigned int edm::JobReport::RunNumber

Definition at line 105 of file JobReport.h.

◆ Token

typedef std::size_t edm::JobReport::Token

Definition at line 106 of file JobReport.h.

Constructor & Destructor Documentation

◆ JobReport() [1/3]

edm::JobReport::JobReport ( )

Definition at line 322 of file JobReport.cc.

322 : impl_(new JobReportImpl(nullptr)) {}
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ JobReport() [2/3]

edm::JobReport::JobReport ( std::ostream *  outputStream)

Definition at line 324 of file JobReport.cc.

References impl_, and temporarilyCloseXML().

324  : impl_(new JobReportImpl(iOstream)) {
325  if (impl_->ost_) {
326  *(impl_->ost_) << "<FrameworkJobReport>\n";
327  }
329  }
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ JobReport() [3/3]

edm::JobReport::JobReport ( JobReport const &  )
delete

◆ ~JobReport()

edm::JobReport::~JobReport ( )

Definition at line 305 of file JobReport.cc.

References impl_.

305  {
306  impl_->flushFiles();
307  if (impl_->ost_) {
308  *(impl_->ost_) << "</FrameworkJobReport>\n" << std::flush;
309  }
310  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

Member Function Documentation

◆ dumpFiles()

std::string edm::JobReport::dumpFiles ( void  )

debug/test util

Definition at line 708 of file JobReport.cc.

References boostedTaus_cff::doc, f, edm::findOrDefault(), impl_, and mps_check::msg.

708  {
709  std::ostringstream msg;
710 
711  tinyxml2::XMLDocument doc;
712  for (auto const& f : impl_->outputFiles_) {
713  msg << "\n<File>";
714  msg << f;
715 
716  msg << "\n<LumiSections>";
717  msg << "\n<Inputs>";
718  typedef std::vector<JobReport::Token>::iterator iterator;
719  for (auto const& iInput : f.contributingInputs) {
720  auto const& inpFile = impl_->inputFiles_[iInput];
721  msg << "\n<Input>";
722  msg << "\n <LFN>" << doc.NewText(inpFile.logicalFileName.c_str())->Value() << "</LFN>";
723  msg << "\n <PFN>" << doc.NewText(inpFile.physicalFileName.c_str())->Value() << "</PFN>";
724  msg << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
725  msg << "\n</Input>";
726  doc.DeleteChildren();
727  }
728  msg << "\n</Inputs>";
729  msg << "\n</File>";
730  }
731  return msg.str();
732  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
reco::JetExtendedAssociation::JetExtendedData Value
double f[11][100]
Value const & findOrDefault(std::map< Key, Value > const &m, Key const &k, Value const &defaultValue)
Definition: Map.h:24
tuple msg
Definition: mps_check.py:286

◆ eventReadFromFile()

void edm::JobReport::eventReadFromFile ( InputType  inputType,
JobReport::Token  fileToken 
)

Report that an event has been read from the file identified by the given Token.

Definition at line 377 of file JobReport.cc.

References f, and impl_.

377  {
378  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
379  ++f.numEventsRead;
380  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ eventWrittenToFile()

void edm::JobReport::eventWrittenToFile ( JobReport::Token  fileToken,
RunNumber_t  run,
EventNumber_t  event 
)

Report that the event with the given id has been written to the file identified by the given Token.

Definition at line 439 of file JobReport.cc.

References f, and impl_.

Referenced by NanoAODOutputModule::write().

439  {
440  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
441  ++f.numEventsWritten;
442  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ impl()

edm::propagate_const<std::unique_ptr<JobReportImpl> >& edm::JobReport::impl ( )
inlineprotected

Definition at line 427 of file JobReport.h.

References impl_.

Referenced by edm::service::JobReportService::frameworkShutdownOnFailure(), and edm::service::JobReportService::postEndJob().

427 { return impl_; }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ inputFileClosed()

void edm::JobReport::inputFileClosed ( InputType  inputType,
JobReport::Token  fileToken 
)

Report that the input file identified by the given Token has been closed. An exception will be thrown if the given Token was not obtained from inputFileOpened.

Definition at line 387 of file JobReport.cc.

References f, impl_, CommonMethods::lock(), edm::Primary, temporarilyCloseXML(), and write_mutex.

Referenced by DQMRootSource::OpenFileInfo::~OpenFileInfo().

387  {
388  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
389  f.fileHasBeenClosed = true;
390  std::lock_guard<std::mutex> lock(write_mutex);
391  if (inputType == InputType::Primary) {
392  impl_->writeInputFile(f);
393  } else {
394  impl_->writeInputFile(f);
395  }
397  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ inputFileOpened()

JobReport::Token edm::JobReport::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 
)

Report that an input file has been opened. The returned Token should be used for later identification of this file.

Definition at line 331 of file JobReport.cc.

References haddnano::branchNames, edm::JobReport::InputFile::branchNames, getEcalConditions_orcoffint2r_cff::catalog, edm::JobReport::InputFile::catalog, edm::JobReport::InputFile::fileHasBeenClosed, edm::JobReport::InputFile::guid, impl_, RPC_Client_on_RootFile::InputFile, edm::JobReport::InputFile::inputSourceClassName, edm::JobReport::InputFile::inputType, edm::JobReport::InputFile::logicalFileName, HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::JobReport::InputFile::moduleLabel, edm::JobReport::InputFile::numEventsRead, edm::JobReport::InputFile::physicalFileName, edm::Primary, edm::SecondaryFile, and edm::SecondarySource.

Referenced by DQMRootSource::readFile_().

338  {
339  InputType theInputType = InputType::Primary;
340  InputFile* newFile = nullptr;
341  JobReport::Token newToken = 0;
342 
343  if (inputType == "mixingFiles") {
344  theInputType = InputType::SecondarySource;
345  auto itr = impl_->inputFilesSecSource_.push_back(InputFile());
346  newFile = &(*itr);
347  newToken = itr - impl_->inputFilesSecSource_.begin();
348  } else {
349  if (inputType == "secondaryFiles") {
350  theInputType = InputType::SecondaryFile;
351  }
352  impl_->inputFiles_.emplace_back();
353  newFile = &impl_->inputFiles_.back();
354  newToken = impl_->inputFiles_.size() - 1;
355  }
356 
357  if (theInputType == InputType::Primary) {
358  impl_->lastOpenedPrimaryInputFile_ = impl_->inputFiles_.size() - 1;
359  }
360  newFile->logicalFileName = logicalFileName;
361  newFile->physicalFileName = physicalFileName;
362  newFile->catalog = catalog;
363  newFile->inputType = inputType;
364  newFile->inputSourceClassName = inputSourceClassName;
365  newFile->moduleLabel = moduleLabel;
366  newFile->guid = guid;
367  newFile->numEventsRead = 0;
368  newFile->branchNames = branchNames;
369  newFile->fileHasBeenClosed = false;
370 
371  // Add the new input file token to all output files
372  // currently open.
373  impl_->insertInputForOutputs(theInputType, newToken);
374  return newToken;
375  }
InputType
Definition: InputType.h:5
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
std::size_t Token
Definition: JobReport.h:106
branchNames
Definition: haddnano.py:54

◆ operator=()

JobReport& edm::JobReport::operator= ( JobReport const &  )
delete

◆ outputFileClosed()

void edm::JobReport::outputFileClosed ( JobReport::Token  fileToken)

Report that the output file identified by the given Token has been closed. An exception will be thrown if the given Token was not obtained from outputFileOpened.

Definition at line 444 of file JobReport.cc.

References f, impl_, CommonMethods::lock(), temporarilyCloseXML(), and write_mutex.

Referenced by DQMRootOutputModule::finishEndFile(), and NanoAODOutputModule::reallyCloseFile().

444  {
445  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
446  f.fileHasBeenClosed = true;
447  std::lock_guard<std::mutex> lock(write_mutex);
448  impl_->writeOutputFile(f);
450  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ outputFileOpened()

JobReport::Token edm::JobReport::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 
)

Report that an output file has been opened. The returned Token should be used for later identification of this file.

Definition at line 399 of file JobReport.cc.

References haddnano::branchNames, getEcalConditions_orcoffint2r_cff::catalog, DTskim_cfg::dataType, mps_fire::i, impl_, and HerwigMaxPtPartonFilter_cfi::moduleLabel.

407  {
408  auto itr = impl_->outputFiles_.emplace_back();
409  JobReport::OutputFile& r = *itr;
410 
411  r.logicalFileName = logicalFileName;
412  r.physicalFileName = physicalFileName;
413  r.catalog = catalog;
414  r.outputModuleClassName = outputModuleClassName;
415  r.moduleLabel = moduleLabel;
416  r.guid = guid;
417  r.dataType = dataType;
418  r.branchHash = branchHash;
419  r.numEventsWritten = 0;
420  r.branchNames = branchNames;
421  r.fileHasBeenClosed = false;
422  //
423  // Init list of contributors to list of open input file Tokens
424  //
425  for (std::vector<Token>::size_type i = 0, iEnd = impl_->inputFiles_.size(); i < iEnd; ++i) {
426  if (!impl_->inputFiles_[i].fileHasBeenClosed) {
427  r.contributingInputs.push_back(i);
428  }
429  }
430  for (oneapi::tbb::concurrent_vector<Token>::size_type i = 0, iEnd = impl_->inputFilesSecSource_.size(); i < iEnd;
431  ++i) {
432  if (!impl_->inputFilesSecSource_[i].fileHasBeenClosed) {
433  r.contributingInputsSecSource.push_back(i);
434  }
435  }
436  return itr - impl_->outputFiles_.begin();
437  }
uint16_t size_type
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
branchNames
Definition: haddnano.py:54

◆ reportAnalysisFile()

void edm::JobReport::reportAnalysisFile ( std::string const &  fileName,
std::map< std::string, std::string > const &  fileData 
)

Definition at line 486 of file JobReport.cc.

References boostedTaus_cff::doc, MillePedeFileConverter_cfg::fileName, impl_, CommonMethods::lock(), mps_check::msg, temporarilyCloseXML(), and write_mutex.

Referenced by TFileService::afterBeginJob(), DQMStoreStats::calcstats(), AlcaBeamSpotHarvester::endRun(), PCLMetadataWriter::endRun(), DQMFileSaver::saveJobReport(), and dqm::DQMFileSaverBase::saveJobReport().

486  {
487  tinyxml2::XMLDocument doc;
488  if (impl_->ost_) {
489  std::ostream& msg = *(impl_->ost_);
490  {
491  std::lock_guard<std::mutex> lock(write_mutex);
492  msg << "<AnalysisFile>\n"
493  << " <FileName>" << doc.NewText(fileName.c_str())->Value() << "</FileName>\n";
494 
495  typedef std::map<std::string, std::string>::const_iterator const_iterator;
496  for (const_iterator pos = fileData.begin(), posEnd = fileData.end(); pos != posEnd; ++pos) {
497  msg << " <" << pos->first << " Value=\"" << pos->second << "\" />"
498  << "\n";
499  }
500  msg << "</AnalysisFile>\n";
502  }
503  }
504  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
reco::JetExtendedAssociation::JetExtendedData Value
tuple msg
Definition: mps_check.py:286

◆ reportDataType()

void edm::JobReport::reportDataType ( Token  fileToken,
std::string const &  dataType 
)

Report the data type of a file after it has been opened Needed since the data type isn't known until an event has been read

Definition at line 382 of file JobReport.cc.

References DTskim_cfg::dataType, f, and impl_.

382  {
383  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
384  f.dataType = dataType;
385  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ reportError()

void edm::JobReport::reportError ( std::string const &  shortDesc,
std::string const &  longDesc,
int const &  exitCode 
)

Report an exception, providing details of the problem as a short description (Eg "XXXError") and a long description (Eg "XXX crashed because...") Also overload this method to accept an optional standard exit code

Definition at line 506 of file JobReport.cc.

References impl_, CommonMethods::lock(), mps_check::msg, temporarilyCloseXML(), and write_mutex.

Referenced by edm::printCmsException().

506  {
507  if (impl_->ost_) {
508  {
509  std::lock_guard<std::mutex> lock(write_mutex);
510  std::ostream& msg = *(impl_->ost_);
511  msg << "<FrameworkError ExitStatus=\"" << exitCode << "\" Type=\"" << shortDesc << "\" >\n";
512  msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
513  msg << "</FrameworkError>\n";
515  }
516  }
517  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportFallbackAttempt()

void edm::JobReport::reportFallbackAttempt ( std::string const &  pfn,
std::string const &  lfn,
std::string const &  err 
)

Definition at line 536 of file JobReport.cc.

References boostedTaus_cff::doc, submitPVResolutionJobs::err, trackingPlots::fallback, impl_, CommonMethods::lock(), mps_check::msg, temporarilyCloseXML(), and write_mutex.

536  {
537  if (impl_->ost_) {
538  std::ostream& msg = *(impl_->ost_);
539  tinyxml2::XMLDocument doc;
540  tinyxml2::XMLPrinter printer;
541  tinyxml2::XMLElement* fallback = doc.NewElement("FallbackAttempt");
542  fallback->SetAttribute("Pfn", pfn.c_str());
543  fallback->SetAttribute("Lfn", lfn.c_str());
544  {
545  std::lock_guard<std::mutex> lock(write_mutex);
546  fallback->Accept(&printer);
547  msg << printer.CStr();
548  msg << "<![CDATA[\n" << err << "\n]]>\n";
550  }
551  }
552  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportFastClonedBranches()

void edm::JobReport::reportFastClonedBranches ( std::set< std::string > const &  fastClonedBranches,
long long  nEvents 
)

Inform the job report that branches have been fast Cloned.

Definition at line 642 of file JobReport.cc.

References impl_, and createIOVlist::nEvents.

642  {
643  std::set<std::string>& clonedBranches =
644  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
645  for (std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
646  it != itEnd;
647  ++it) {
648  if (clonedBranches.insert(*it).second) {
649  impl_->readBranches_[*it] += nEvents;
650  }
651  }
652  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportFastCopyingStatus()

void edm::JobReport::reportFastCopyingStatus ( JobReport::Token  fileToken,
std::string const &  inputFileName,
bool  fastCopying 
)

Definition at line 464 of file JobReport.cc.

References f, impl_, and InefficientDoubleROC::inputFileName.

466  {
467  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
468  f.fastCopyingInputs.insert(std::make_pair(inputFileName, fastCopying));
469  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
double f[11][100]

◆ reportInputLumiSection()

void edm::JobReport::reportInputLumiSection ( unsigned int  run,
unsigned int  lumiSectId 
)

API for reporting a Lumi Section to the job report. for input files, call only if lumi section is physically read from the input file

Definition at line 478 of file JobReport.cc.

References impl_, and writedatasetfile::run.

Referenced by dqmservices::DQMProtobufReader::readLuminosityBlock_(), and DQMRootSource::readLuminosityBlock_().

478  {
479  impl_->associateInputLumiSection(run, lumiSectId);
480  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportInputRunNumber()

void edm::JobReport::reportInputRunNumber ( unsigned int  run)

API to report a run read from input

Definition at line 484 of file JobReport.cc.

References impl_, and writedatasetfile::run.

Referenced by DQMRootSource::readRun_().

484 { impl_->associateInputRun(run); }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportLumiSection()

void edm::JobReport::reportLumiSection ( JobReport::Token  token,
unsigned int  run,
unsigned int  lumiSectId,
unsigned long  nEvents = 0 
)

API for reporting a Lumi Section to the job report. for output files, call only if lumi section is written to the output file

Definition at line 471 of file JobReport.cc.

References impl_, createIOVlist::nEvents, writedatasetfile::run, and unpackBuffers-CaloStage2::token.

Referenced by NanoAODOutputModule::writeLuminosityBlock(), and DQMRootOutputModule::writeLuminosityBlock().

474  {
475  impl_->associateLumiSection(token, run, lumiSectId, nEvents);
476  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportMemoryInfo()

void edm::JobReport::reportMemoryInfo ( std::vector< std::string > const &  memoryData)

Report Memory statistics ALTERNATE FORM - USING THIS MAY NECESSITATE CHANGES IN PARSING XML! Invoked by the Memory service to send an end of job summary about memory usage for inclusion in the job report

Definition at line 554 of file JobReport.cc.

References impl_, CommonMethods::lock(), mps_check::msg, temporarilyCloseXML(), and write_mutex.

554  {
555  if (impl_->ost_) {
556  std::lock_guard<std::mutex> lock(write_mutex);
557  std::ostream& msg = *(impl_->ost_);
558  msg << "<MemoryService>\n";
559 
560  typedef std::vector<std::string>::const_iterator const_iterator;
561  for (const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
562  msg << *pos << "\n";
563  }
564  msg << "</MemoryService>\n";
566  }
567  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportMessageInfo()

void edm::JobReport::reportMessageInfo ( std::map< std::string, double > const &  messageData)

Report Message statistics Invoked by the MessageLogger service to send an end of job summary about numbers of various categories messages issued for inclusion in the job report

Definition at line 569 of file JobReport.cc.

References impl_, CommonMethods::lock(), mps_check::msg, temporarilyCloseXML(), and write_mutex.

Referenced by edm::service::MessageLogger::summarizeInJobReport().

569  {
570  if (impl_->ost_) {
571  std::lock_guard<std::mutex> lock(write_mutex);
572  std::ostream& msg = *(impl_->ost_);
573  msg << "<MessageSummary>\n";
574  typedef std::map<std::string, double>::const_iterator const_iterator;
575  for (const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
576  msg << " <" << pos->first << " Value=\"" << pos->second << "\" />"
577  << "\n";
578  }
579  msg << "</MessageSummary>\n";
581  }
582  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportPerformanceForModule()

void edm::JobReport::reportPerformanceForModule ( std::string const &  metricClass,
std::string const &  moduleName,
std::map< std::string, std::string > const &  metrics 
)

Definition at line 687 of file JobReport.cc.

References impl_, PostProcessorHGCAL_cfi::metrics, edm::moduleName(), mps_check::msg, and temporarilyCloseXML().

Referenced by XrdAdaptor::XrdStatisticsService::postEndJob().

689  {
690  if (impl_->ost_) {
691  std::ostream& msg = *(impl_->ost_);
692  msg << "<PerformanceReport>\n"
693  << " <PerformanceModule Metric=\"" << metricClass << "\" "
694  << " Module=\"" << moduleName << "\" >\n";
695 
696  typedef std::map<std::string, std::string>::const_iterator const_iterator;
697  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
698  msg << " <Metric Name=\"" << iter->first << "\" "
699  << "Value=\"" << iter->second << "\"/>\n";
700  }
701 
702  msg << " </PerformanceModule>\n"
703  << "</PerformanceReport>\n";
705  }
706  }
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27

◆ reportPerformanceSummary()

void edm::JobReport::reportPerformanceSummary ( std::string const &  metricClass,
std::map< std::string, std::string > const &  metrics 
)

Performance Reports

Two categories: Summary for entire job and module for a specific module Each one requires a performance metric class such as Timing, Memory, CPU, Trigger etc.

Definition at line 668 of file JobReport.cc.

References impl_, PostProcessorHGCAL_cfi::metrics, mps_check::msg, and temporarilyCloseXML().

Referenced by TFileAdaptor::termination().

669  {
670  if (impl_->ost_) {
671  std::ostream& msg = *(impl_->ost_);
672  msg << "<PerformanceReport>\n"
673  << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
674 
675  typedef std::map<std::string, std::string>::const_iterator const_iterator;
676  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
677  msg << " <Metric Name=\"" << iter->first << "\" "
678  << "Value=\"" << iter->second << "\"/>\n";
679  }
680 
681  msg << " </PerformanceSummary>\n"
682  << "</PerformanceReport>\n";
684  }
685  }
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportRandomStateFile()

void edm::JobReport::reportRandomStateFile ( std::string const &  name)

Report the name of the random engine persistency file

Definition at line 654 of file JobReport.cc.

References boostedTaus_cff::doc, impl_, CommonMethods::lock(), mps_check::msg, Skims_PA_cff::name, temporarilyCloseXML(), and write_mutex.

654  {
655  tinyxml2::XMLDocument doc;
656  if (impl_->ost_) {
657  std::ostream& msg = *(impl_->ost_);
658  {
659  std::lock_guard<std::mutex> lock(write_mutex);
660  msg << "<RandomServiceStateFile>\n"
661  << doc.NewText(name.c_str())->Value() << "\n"
662  << "</RandomServiceStateFile>\n";
664  }
665  }
666  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
reco::JetExtendedAssociation::JetExtendedData Value
tuple msg
Definition: mps_check.py:286

◆ reportReadBranch()

void edm::JobReport::reportReadBranch ( InputType  inputType,
std::string const &  branchName 
)

Inform the job report that a branch has been read.

Definition at line 627 of file JobReport.cc.

References electrons_cff::branchName, impl_, edm::Primary, edm::SecondaryFile, and edm::SecondarySource.

627  {
628  if (inputType == InputType::Primary) {
629  // Fast cloned branches have already been reported.
630  std::set<std::string> const& clonedBranches =
631  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
632  if (clonedBranches.find(branchName) == clonedBranches.end()) {
633  ++impl_->readBranches_[branchName];
634  }
635  } else if (inputType == InputType::SecondaryFile) {
636  ++impl_->readBranchesSecFile_[branchName];
637  } else if (inputType == InputType::SecondarySource) {
638  ++impl_->readBranchesSecSource_[branchName].value();
639  }
640  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportReadBranches()

void edm::JobReport::reportReadBranches ( )

Report read branches Invoked by the source that reads ROOT/EDM files at the end of a job to report which product branches in the Events tree have been read, with a count of the number of events for which the branch was read.

Definition at line 584 of file JobReport.cc.

References MicroEventContent_cff::branch, boostedTaus_cff::doc, impl_, CommonMethods::lock(), temporarilyCloseXML(), and write_mutex.

584  {
585  bool expected = false;
586  if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true))
587  return;
588  if (impl_->ost_) {
589  std::lock_guard<std::mutex> lock(write_mutex);
590  std::ostream& ost = *(impl_->ost_);
591  ost << "<ReadBranches>\n";
592  tinyxml2::XMLDocument doc;
593  tinyxml2::XMLPrinter printer;
594  for (auto const& iBranch : impl_->readBranches_) {
595  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
596  branch->SetAttribute("Name", iBranch.first.c_str());
597  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
598  branch->Accept(&printer);
599  ost << printer.CStr();
600  printer.ClearBuffer();
601  }
602  for (auto const& iBranch : impl_->readBranchesSecFile_) {
603  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
604  branch->SetAttribute("Name", iBranch.first.c_str());
605  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
606  branch->Accept(&printer);
607  ost << printer.CStr();
608  printer.ClearBuffer();
609  }
610  ost << "</ReadBranches>\n";
611  if (!impl_->readBranchesSecSource_.empty()) {
612  ost << "<SecondarySourceReadBranches>\n";
613  for (auto const& iBranch : impl_->readBranchesSecSource_) {
614  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
615  branch->SetAttribute("Name", iBranch.first.c_str());
616  branch->SetAttribute("ReadCount", int64_t(iBranch.second.value().load()));
617  branch->Accept(&printer);
618  ost << printer.CStr();
619  printer.ClearBuffer();
620  }
621  ost << "</SecondarySourceReadBranches>\n";
622  }
624  }
625  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportRunNumber()

void edm::JobReport::reportRunNumber ( JobReport::Token  token,
unsigned int  run 
)

API for reporting a Run to the job report. for output files, call only if Run is written to the output file

Definition at line 482 of file JobReport.cc.

References impl_, writedatasetfile::run, and unpackBuffers-CaloStage2::token.

Referenced by NanoAODOutputModule::writeRun(), and DQMRootOutputModule::writeRun().

482 { impl_->associateRun(token, run); }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

◆ reportSkippedEvent()

void edm::JobReport::reportSkippedEvent ( RunNumber_t  run,
EventNumber_t  event 
)

Definition at line 452 of file JobReport.cc.

References impl_, CommonMethods::lock(), mps_check::msg, writedatasetfile::run, temporarilyCloseXML(), and write_mutex.

452  {
453  if (impl_->ost_) {
454  std::ostream& msg = *(impl_->ost_);
455  {
456  std::lock_guard<std::mutex> lock(write_mutex);
457  msg << "<SkippedEvent Run=\"" << run << "\"";
458  msg << " Event=\"" << event << "\" />\n";
460  }
461  }
462  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ reportSkippedFile()

void edm::JobReport::reportSkippedFile ( std::string const &  pfn,
std::string const &  lfn 
)

Report Skipped File

Report that a file has been skipped due to it not being found.

Definition at line 519 of file JobReport.cc.

References boostedTaus_cff::doc, impl_, CommonMethods::lock(), mps_check::msg, runEdmFileComparison::skipped, temporarilyCloseXML(), and write_mutex.

519  {
520  if (impl_->ost_) {
521  std::ostream& msg = *(impl_->ost_);
522  tinyxml2::XMLDocument doc;
523  tinyxml2::XMLPrinter printer;
524  tinyxml2::XMLElement* skipped = doc.NewElement("SkippedFile");
525  skipped->SetAttribute("Pfn", pfn.c_str());
526  skipped->SetAttribute("Lfn", lfn.c_str());
527  {
528  std::lock_guard<std::mutex> lock(write_mutex);
529  skipped->Accept(&printer);
530  msg << printer.CStr();
532  }
533  }
534  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:312
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
tuple msg
Definition: mps_check.py:286

◆ temporarilyCloseXML()

void edm::JobReport::temporarilyCloseXML ( )
private

Definition at line 312 of file JobReport.cc.

References impl_.

Referenced by inputFileClosed(), JobReport(), outputFileClosed(), reportAnalysisFile(), reportError(), reportFallbackAttempt(), reportMemoryInfo(), reportMessageInfo(), reportPerformanceForModule(), reportPerformanceSummary(), reportRandomStateFile(), reportReadBranches(), reportSkippedEvent(), and reportSkippedFile().

312  {
313  if (impl_->ost_) {
314  //remember where we were
315  auto pos = impl_->ost_->tellp();
316  *(impl_->ost_) << "</FrameworkJobReport>\n" << std::flush;
317  //overwrite above during next write.
318  impl_->ost_->seekp(pos);
319  }
320  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

Member Data Documentation

◆ impl_

edm::propagate_const<std::unique_ptr<JobReportImpl> > edm::JobReport::impl_
private

◆ write_mutex

std::mutex edm::JobReport::write_mutex
private