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

bool errorLogged_ = false
 
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 345 of file JobReport.cc.

345 : 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 347 of file JobReport.cc.

References impl_, and temporarilyCloseXML().

347  : impl_(new JobReportImpl(iOstream)) {
348  if (impl_->ost_) {
349  *(impl_->ost_) << "<FrameworkJobReport>\n";
350  }
352  }
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 308 of file JobReport.cc.

References mps_fire::end, mps_fire::i, impl_, edm::kJobReportEndElement, and edm::kMinSizeOfComment.

308  {
309  impl_->flushFiles();
310  if (impl_->ost_) {
311  //are we actually at the end of the file?
312  auto pos = impl_->ost_->tellp();
313  impl_->ost_->seekp(0, std::ios_base::end);
314  auto endpos = impl_->ost_->tellp();
315  impl_->ost_->seekp(pos);
316  if ((endpos - pos) > static_cast<long int>(kJobReportEndElement.size())) {
317  //need to add some padding so use a comment element
318  // comment is used since white spaces are converted to a special node
319  // while comments are usually ignored by xml parsers
320  auto padding = (endpos - pos) - (kJobReportEndElement.size() + kMinSizeOfComment);
321  *(impl_->ost_) << "<!--";
322  for (int i = padding; i > 0; --i) {
323  (*impl_->ost_) << ' ';
324  }
325  *(impl_->ost_) << "-->\n";
326  }
327  *(impl_->ost_) << kJobReportEndElement << std::flush;
328  }
329  }
static constexpr std::string_view kJobReportEndElement
Definition: JobReport.cc:305
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431
static constexpr int kMinSizeOfComment
Definition: JobReport.cc:306

Member Function Documentation

◆ dumpFiles()

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

debug/test util

Definition at line 732 of file JobReport.cc.

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

732  {
733  std::ostringstream msg;
734 
735  tinyxml2::XMLDocument doc;
736  for (auto const& f : impl_->outputFiles_) {
737  msg << "\n<File>";
738  msg << f;
739 
740  msg << "\n<LumiSections>";
741  msg << "\n<Inputs>";
742  typedef std::vector<JobReport::Token>::iterator iterator;
743  for (auto const& iInput : f.contributingInputs) {
744  auto const& inpFile = impl_->inputFiles_[iInput];
745  msg << "\n<Input>";
746  msg << "\n <LFN>" << doc.NewText(inpFile.logicalFileName.c_str())->Value() << "</LFN>";
747  msg << "\n <PFN>" << doc.NewText(inpFile.physicalFileName.c_str())->Value() << "</PFN>";
748  msg << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
749  msg << "\n</Input>";
750  doc.DeleteChildren();
751  }
752  msg << "\n</Inputs>";
753  msg << "\n</File>";
754  }
755  return msg.str();
756  }
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 400 of file JobReport.cc.

References f, and impl_.

400  {
401  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
402  ++f.numEventsRead;
403  }
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 462 of file JobReport.cc.

References f, and impl_.

Referenced by NanoAODOutputModule::write().

462  {
463  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
464  ++f.numEventsWritten;
465  }
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 410 of file JobReport.cc.

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

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

410  {
411  JobReport::InputFile& f = impl_->getInputFileForToken(inputType, fileToken);
412  f.fileHasBeenClosed = true;
413  std::lock_guard<std::mutex> lock(write_mutex);
414  if (inputType == InputType::Primary) {
415  impl_->writeInputFile(f);
416  } else {
417  impl_->writeInputFile(f);
418  }
420  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 354 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_().

361  {
362  InputType theInputType = InputType::Primary;
363  InputFile* newFile = nullptr;
364  JobReport::Token newToken = 0;
365 
366  if (inputType == "mixingFiles") {
367  theInputType = InputType::SecondarySource;
368  auto itr = impl_->inputFilesSecSource_.push_back(InputFile());
369  newFile = &(*itr);
370  newToken = itr - impl_->inputFilesSecSource_.begin();
371  } else {
372  if (inputType == "secondaryFiles") {
373  theInputType = InputType::SecondaryFile;
374  }
375  impl_->inputFiles_.emplace_back();
376  newFile = &impl_->inputFiles_.back();
377  newToken = impl_->inputFiles_.size() - 1;
378  }
379 
380  if (theInputType == InputType::Primary) {
381  impl_->lastOpenedPrimaryInputFile_ = impl_->inputFiles_.size() - 1;
382  }
383  newFile->logicalFileName = logicalFileName;
384  newFile->physicalFileName = physicalFileName;
385  newFile->catalog = catalog;
386  newFile->inputType = inputType;
387  newFile->inputSourceClassName = inputSourceClassName;
388  newFile->moduleLabel = moduleLabel;
389  newFile->guid = guid;
390  newFile->numEventsRead = 0;
391  newFile->branchNames = branchNames;
392  newFile->fileHasBeenClosed = false;
393 
394  // Add the new input file token to all output files
395  // currently open.
396  impl_->insertInputForOutputs(theInputType, newToken);
397  return newToken;
398  }
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 467 of file JobReport.cc.

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

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

467  {
468  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
469  f.fileHasBeenClosed = true;
470  std::lock_guard<std::mutex> lock(write_mutex);
471  impl_->writeOutputFile(f);
473  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 422 of file JobReport.cc.

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

430  {
431  auto itr = impl_->outputFiles_.emplace_back();
432  JobReport::OutputFile& r = *itr;
433 
434  r.logicalFileName = logicalFileName;
435  r.physicalFileName = physicalFileName;
436  r.catalog = catalog;
437  r.outputModuleClassName = outputModuleClassName;
438  r.moduleLabel = moduleLabel;
439  r.guid = guid;
440  r.dataType = dataType;
441  r.branchHash = branchHash;
442  r.numEventsWritten = 0;
443  r.branchNames = branchNames;
444  r.fileHasBeenClosed = false;
445  //
446  // Init list of contributors to list of open input file Tokens
447  //
448  for (std::vector<Token>::size_type i = 0, iEnd = impl_->inputFiles_.size(); i < iEnd; ++i) {
449  if (!impl_->inputFiles_[i].fileHasBeenClosed) {
450  r.contributingInputs.push_back(i);
451  }
452  }
453  for (oneapi::tbb::concurrent_vector<Token>::size_type i = 0, iEnd = impl_->inputFilesSecSource_.size(); i < iEnd;
454  ++i) {
455  if (!impl_->inputFilesSecSource_[i].fileHasBeenClosed) {
456  r.contributingInputsSecSource.push_back(i);
457  }
458  }
459  return itr - impl_->outputFiles_.begin();
460  }
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 509 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().

509  {
510  tinyxml2::XMLDocument doc;
511  if (impl_->ost_) {
512  std::ostream& msg = *(impl_->ost_);
513  {
514  std::lock_guard<std::mutex> lock(write_mutex);
515  msg << "<AnalysisFile>\n"
516  << " <FileName>" << doc.NewText(fileName.c_str())->Value() << "</FileName>\n";
517 
518  typedef std::map<std::string, std::string>::const_iterator const_iterator;
519  for (const_iterator pos = fileData.begin(), posEnd = fileData.end(); pos != posEnd; ++pos) {
520  msg << " <" << pos->first << " Value=\"" << pos->second << "\" />"
521  << "\n";
522  }
523  msg << "</AnalysisFile>\n";
525  }
526  }
527  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 405 of file JobReport.cc.

References DTskim_cfg::dataType, f, and impl_.

405  {
406  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
407  f.dataType = dataType;
408  }
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 529 of file JobReport.cc.

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

Referenced by edm::printCmsException().

529  {
530  if (impl_->ost_) {
531  {
532  std::lock_guard<std::mutex> lock(write_mutex);
533  errorLogged_ = true;
534  std::ostream& msg = *(impl_->ost_);
535  msg << "<FrameworkError ExitStatus=\"" << exitCode << "\" Type=\"" << shortDesc << "\" >\n";
536  msg << "<![CDATA[\n" << longDesc << "\n]]>\n";
537  msg << "</FrameworkError>\n";
539  }
540  }
541  }
std::mutex write_mutex
Definition: JobReport.h:432
bool errorLogged_
Definition: JobReport.h:433
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 560 of file JobReport.cc.

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

560  {
561  if (impl_->ost_) {
562  std::ostream& msg = *(impl_->ost_);
563  tinyxml2::XMLDocument doc;
564  tinyxml2::XMLPrinter printer;
565  tinyxml2::XMLElement* fallback = doc.NewElement("FallbackAttempt");
566  fallback->SetAttribute("Pfn", pfn.c_str());
567  fallback->SetAttribute("Lfn", lfn.c_str());
568  {
569  std::lock_guard<std::mutex> lock(write_mutex);
570  fallback->Accept(&printer);
571  msg << printer.CStr();
572  msg << "<![CDATA[\n" << err << "\n]]>\n";
574  }
575  }
576  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 666 of file JobReport.cc.

References impl_, and createIOVlist::nEvents.

666  {
667  std::set<std::string>& clonedBranches =
668  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
669  for (std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
670  it != itEnd;
671  ++it) {
672  if (clonedBranches.insert(*it).second) {
673  impl_->readBranches_[*it] += nEvents;
674  }
675  }
676  }
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 487 of file JobReport.cc.

References f, impl_, and InefficientDoubleROC::inputFileName.

489  {
490  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
491  f.fastCopyingInputs.insert(std::make_pair(inputFileName, fastCopying));
492  }
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 501 of file JobReport.cc.

References impl_, and writedatasetfile::run.

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

501  {
502  impl_->associateInputLumiSection(run, lumiSectId);
503  }
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 507 of file JobReport.cc.

References impl_, and writedatasetfile::run.

Referenced by DQMRootSource::readRun_().

507 { 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 494 of file JobReport.cc.

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

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

497  {
498  impl_->associateLumiSection(token, run, lumiSectId, nEvents);
499  }
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 578 of file JobReport.cc.

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

578  {
579  if (impl_->ost_) {
580  std::lock_guard<std::mutex> lock(write_mutex);
581  std::ostream& msg = *(impl_->ost_);
582  msg << "<MemoryService>\n";
583 
584  typedef std::vector<std::string>::const_iterator const_iterator;
585  for (const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
586  msg << *pos << "\n";
587  }
588  msg << "</MemoryService>\n";
590  }
591  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 593 of file JobReport.cc.

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

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

593  {
594  if (impl_->ost_) {
595  std::lock_guard<std::mutex> lock(write_mutex);
596  std::ostream& msg = *(impl_->ost_);
597  msg << "<MessageSummary>\n";
598  typedef std::map<std::string, double>::const_iterator const_iterator;
599  for (const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
600  msg << " <" << pos->first << " Value=\"" << pos->second << "\" />"
601  << "\n";
602  }
603  msg << "</MessageSummary>\n";
605  }
606  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 711 of file JobReport.cc.

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

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

713  {
714  if (impl_->ost_) {
715  std::ostream& msg = *(impl_->ost_);
716  msg << "<PerformanceReport>\n"
717  << " <PerformanceModule Metric=\"" << metricClass << "\" "
718  << " Module=\"" << moduleName << "\" >\n";
719 
720  typedef std::map<std::string, std::string>::const_iterator const_iterator;
721  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
722  msg << " <Metric Name=\"" << iter->first << "\" "
723  << "Value=\"" << iter->second << "\"/>\n";
724  }
725 
726  msg << " </PerformanceModule>\n"
727  << "</PerformanceReport>\n";
729  }
730  }
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 692 of file JobReport.cc.

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

Referenced by TFileAdaptor::termination().

693  {
694  if (impl_->ost_) {
695  std::ostream& msg = *(impl_->ost_);
696  msg << "<PerformanceReport>\n"
697  << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
698 
699  typedef std::map<std::string, std::string>::const_iterator const_iterator;
700  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
701  msg << " <Metric Name=\"" << iter->first << "\" "
702  << "Value=\"" << iter->second << "\"/>\n";
703  }
704 
705  msg << " </PerformanceSummary>\n"
706  << "</PerformanceReport>\n";
708  }
709  }
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 678 of file JobReport.cc.

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

678  {
679  tinyxml2::XMLDocument doc;
680  if (impl_->ost_) {
681  std::ostream& msg = *(impl_->ost_);
682  {
683  std::lock_guard<std::mutex> lock(write_mutex);
684  msg << "<RandomServiceStateFile>\n"
685  << doc.NewText(name.c_str())->Value() << "\n"
686  << "</RandomServiceStateFile>\n";
688  }
689  }
690  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 651 of file JobReport.cc.

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

651  {
652  if (inputType == InputType::Primary) {
653  // Fast cloned branches have already been reported.
654  std::set<std::string> const& clonedBranches =
655  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
656  if (clonedBranches.find(branchName) == clonedBranches.end()) {
657  ++impl_->readBranches_[branchName];
658  }
659  } else if (inputType == InputType::SecondaryFile) {
660  ++impl_->readBranchesSecFile_[branchName];
661  } else if (inputType == InputType::SecondarySource) {
662  ++impl_->readBranchesSecSource_[branchName].value();
663  }
664  }
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 608 of file JobReport.cc.

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

608  {
609  bool expected = false;
610  if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true))
611  return;
612  if (impl_->ost_) {
613  std::lock_guard<std::mutex> lock(write_mutex);
614  std::ostream& ost = *(impl_->ost_);
615  ost << "<ReadBranches>\n";
616  tinyxml2::XMLDocument doc;
617  tinyxml2::XMLPrinter printer;
618  for (auto const& iBranch : impl_->readBranches_) {
619  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
620  branch->SetAttribute("Name", iBranch.first.c_str());
621  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
622  branch->Accept(&printer);
623  ost << printer.CStr();
624  printer.ClearBuffer();
625  }
626  for (auto const& iBranch : impl_->readBranchesSecFile_) {
627  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
628  branch->SetAttribute("Name", iBranch.first.c_str());
629  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
630  branch->Accept(&printer);
631  ost << printer.CStr();
632  printer.ClearBuffer();
633  }
634  ost << "</ReadBranches>\n";
635  if (!impl_->readBranchesSecSource_.empty()) {
636  ost << "<SecondarySourceReadBranches>\n";
637  for (auto const& iBranch : impl_->readBranchesSecSource_) {
638  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
639  branch->SetAttribute("Name", iBranch.first.c_str());
640  branch->SetAttribute("ReadCount", int64_t(iBranch.second.value().load()));
641  branch->Accept(&printer);
642  ost << printer.CStr();
643  printer.ClearBuffer();
644  }
645  ost << "</SecondarySourceReadBranches>\n";
646  }
648  }
649  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 505 of file JobReport.cc.

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

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

505 { 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 475 of file JobReport.cc.

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

475  {
476  if (impl_->ost_) {
477  std::ostream& msg = *(impl_->ost_);
478  {
479  std::lock_guard<std::mutex> lock(write_mutex);
480  msg << "<SkippedEvent Run=\"" << run << "\"";
481  msg << " Event=\"" << event << "\" />\n";
483  }
484  }
485  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 543 of file JobReport.cc.

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

543  {
544  if (impl_->ost_) {
545  std::ostream& msg = *(impl_->ost_);
546  tinyxml2::XMLDocument doc;
547  tinyxml2::XMLPrinter printer;
548  tinyxml2::XMLElement* skipped = doc.NewElement("SkippedFile");
549  skipped->SetAttribute("Pfn", pfn.c_str());
550  skipped->SetAttribute("Lfn", lfn.c_str());
551  {
552  std::lock_guard<std::mutex> lock(write_mutex);
553  skipped->Accept(&printer);
554  msg << printer.CStr();
556  }
557  }
558  }
std::mutex write_mutex
Definition: JobReport.h:432
void temporarilyCloseXML()
Definition: JobReport.cc:331
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 331 of file JobReport.cc.

References errorLogged_, impl_, and edm::kJobReportEndElement.

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

331  {
332  if (impl_->ost_) {
333  //remember where we were
334  auto pos = impl_->ost_->tellp();
335  if (not errorLogged_) {
336  *(impl_->ost_) << "<FrameworkError ExitStatus=\"8901\" Type=\"UnexpectedJobTermination\"/>\n";
337  }
338  *(impl_->ost_) << kJobReportEndElement << std::flush;
339 
340  //overwrite above during next write.
341  impl_->ost_->seekp(pos);
342  }
343  }
bool errorLogged_
Definition: JobReport.h:433
static constexpr std::string_view kJobReportEndElement
Definition: JobReport.cc:305
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:431

Member Data Documentation

◆ errorLogged_

bool edm::JobReport::errorLogged_ = false
private

Definition at line 433 of file JobReport.h.

Referenced by reportError(), and temporarilyCloseXML().

◆ impl_

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

◆ write_mutex

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