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 reportShutdownSignal ()
 
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:436

◆ 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:436

◆ 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:436
static constexpr int kMinSizeOfComment
Definition: JobReport.cc:306

Member Function Documentation

◆ dumpFiles()

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

debug/test util

Definition at line 743 of file JobReport.cc.

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

743  {
744  std::ostringstream msg;
745 
746  tinyxml2::XMLDocument doc;
747  for (auto const& f : impl_->outputFiles_) {
748  msg << "\n<File>";
749  msg << f;
750 
751  msg << "\n<LumiSections>";
752  msg << "\n<Inputs>";
753  typedef std::vector<JobReport::Token>::iterator iterator;
754  for (auto const& iInput : f.contributingInputs) {
755  auto const& inpFile = impl_->inputFiles_[iInput];
756  msg << "\n<Input>";
757  msg << "\n <LFN>" << doc.NewText(inpFile.logicalFileName.c_str())->Value() << "</LFN>";
758  msg << "\n <PFN>" << doc.NewText(inpFile.physicalFileName.c_str())->Value() << "</PFN>";
759  msg << "\n <FastCopying>" << findOrDefault(f.fastCopyingInputs, inpFile.physicalFileName) << "</FastCopying>";
760  msg << "\n</Input>";
761  doc.DeleteChildren();
762  }
763  msg << "\n</Inputs>";
764  msg << "\n</File>";
765  }
766  return msg.str();
767  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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:436
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(), and NanoAODRNTupleOutputModule::write().

462  {
463  JobReport::OutputFile& f = impl_->getOutputFileForToken(fileToken);
464  ++f.numEventsWritten;
465  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
double f[11][100]

◆ impl()

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

Definition at line 432 of file JobReport.h.

References impl_.

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

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

◆ 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:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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:436
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(), NanoAODRNTupleOutputModule::reallyCloseFile(), 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:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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:436
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 hcalRecHitTable_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:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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:436
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:437
bool errorLogged_
Definition: JobReport.h:438
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 571 of file JobReport.cc.

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

571  {
572  if (impl_->ost_) {
573  std::ostream& msg = *(impl_->ost_);
574  tinyxml2::XMLDocument doc;
575  tinyxml2::XMLPrinter printer;
576  tinyxml2::XMLElement* fallback = doc.NewElement("FallbackAttempt");
577  fallback->SetAttribute("Pfn", pfn.c_str());
578  fallback->SetAttribute("Lfn", lfn.c_str());
579  {
580  std::lock_guard<std::mutex> lock(write_mutex);
581  fallback->Accept(&printer);
582  msg << printer.CStr();
583  msg << "<![CDATA[\n" << err << "\n]]>\n";
585  }
586  }
587  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 677 of file JobReport.cc.

References impl_, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and createIOVlist::nEvents.

677  {
678  std::set<std::string>& clonedBranches =
679  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
680  for (std::set<std::string>::const_iterator it = fastClonedBranches.begin(), itEnd = fastClonedBranches.end();
681  it != itEnd;
682  ++it) {
683  if (clonedBranches.insert(*it).second) {
684  impl_->readBranches_[*it] += nEvents;
685  }
686  }
687  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436

◆ 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:436
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:436

◆ 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:436

◆ 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(), NanoAODRNTupleOutputModule::writeLuminosityBlock(), and DQMRootOutputModule::writeLuminosityBlock().

497  {
498  impl_->associateLumiSection(token, run, lumiSectId, nEvents);
499  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436

◆ 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 589 of file JobReport.cc.

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

589  {
590  if (impl_->ost_) {
591  std::lock_guard<std::mutex> lock(write_mutex);
592  std::ostream& msg = *(impl_->ost_);
593  msg << "<MemoryService>\n";
594 
595  typedef std::vector<std::string>::const_iterator const_iterator;
596  for (const_iterator pos = memoryData.begin(), posEnd = memoryData.end(); pos != posEnd; ++pos) {
597  msg << *pos << "\n";
598  }
599  msg << "</MemoryService>\n";
601  }
602  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 604 of file JobReport.cc.

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

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

604  {
605  if (impl_->ost_) {
606  std::lock_guard<std::mutex> lock(write_mutex);
607  std::ostream& msg = *(impl_->ost_);
608  msg << "<MessageSummary>\n";
609  typedef std::map<std::string, double>::const_iterator const_iterator;
610  for (const_iterator pos = messageData.begin(), posEnd = messageData.end(); pos != posEnd; ++pos) {
611  msg << " <" << pos->first << " Value=\"" << pos->second << "\" />"
612  << "\n";
613  }
614  msg << "</MessageSummary>\n";
616  }
617  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 722 of file JobReport.cc.

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

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

724  {
725  if (impl_->ost_) {
726  std::ostream& msg = *(impl_->ost_);
727  msg << "<PerformanceReport>\n"
728  << " <PerformanceModule Metric=\"" << metricClass << "\" "
729  << " Module=\"" << moduleName << "\" >\n";
730 
731  typedef std::map<std::string, std::string>::const_iterator const_iterator;
732  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
733  msg << " <Metric Name=\"" << iter->first << "\" "
734  << "Value=\"" << iter->second << "\"/>\n";
735  }
736 
737  msg << " </PerformanceModule>\n"
738  << "</PerformanceReport>\n";
740  }
741  }
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 703 of file JobReport.cc.

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

Referenced by TFileAdaptor::termination().

704  {
705  if (impl_->ost_) {
706  std::ostream& msg = *(impl_->ost_);
707  msg << "<PerformanceReport>\n"
708  << " <PerformanceSummary Metric=\"" << metricClass << "\">\n";
709 
710  typedef std::map<std::string, std::string>::const_iterator const_iterator;
711  for (const_iterator iter = metrics.begin(), iterEnd = metrics.end(); iter != iterEnd; ++iter) {
712  msg << " <Metric Name=\"" << iter->first << "\" "
713  << "Value=\"" << iter->second << "\"/>\n";
714  }
715 
716  msg << " </PerformanceSummary>\n"
717  << "</PerformanceReport>\n";
719  }
720  }
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 689 of file JobReport.cc.

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

689  {
690  tinyxml2::XMLDocument doc;
691  if (impl_->ost_) {
692  std::ostream& msg = *(impl_->ost_);
693  {
694  std::lock_guard<std::mutex> lock(write_mutex);
695  msg << "<RandomServiceStateFile>\n"
696  << doc.NewText(name.c_str())->Value() << "\n"
697  << "</RandomServiceStateFile>\n";
699  }
700  }
701  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 662 of file JobReport.cc.

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

662  {
663  if (inputType == InputType::Primary) {
664  // Fast cloned branches have already been reported.
665  std::set<std::string> const& clonedBranches =
666  impl_->inputFiles_.at(impl_->lastOpenedPrimaryInputFile_).fastClonedBranches;
667  if (clonedBranches.find(branchName) == clonedBranches.end()) {
668  ++impl_->readBranches_[branchName];
669  }
670  } else if (inputType == InputType::SecondaryFile) {
671  ++impl_->readBranchesSecFile_[branchName];
672  } else if (inputType == InputType::SecondarySource) {
673  ++impl_->readBranchesSecSource_[branchName].value();
674  }
675  }
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436

◆ 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 619 of file JobReport.cc.

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

619  {
620  bool expected = false;
621  if (not impl_->printedReadBranches_.compare_exchange_strong(expected, true))
622  return;
623  if (impl_->ost_) {
624  std::lock_guard<std::mutex> lock(write_mutex);
625  std::ostream& ost = *(impl_->ost_);
626  ost << "<ReadBranches>\n";
627  tinyxml2::XMLDocument doc;
628  tinyxml2::XMLPrinter printer;
629  for (auto const& iBranch : impl_->readBranches_) {
630  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
631  branch->SetAttribute("Name", iBranch.first.c_str());
632  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
633  branch->Accept(&printer);
634  ost << printer.CStr();
635  printer.ClearBuffer();
636  }
637  for (auto const& iBranch : impl_->readBranchesSecFile_) {
638  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
639  branch->SetAttribute("Name", iBranch.first.c_str());
640  branch->SetAttribute("ReadCount", int64_t(iBranch.second));
641  branch->Accept(&printer);
642  ost << printer.CStr();
643  printer.ClearBuffer();
644  }
645  ost << "</ReadBranches>\n";
646  if (!impl_->readBranchesSecSource_.empty()) {
647  ost << "<SecondarySourceReadBranches>\n";
648  for (auto const& iBranch : impl_->readBranchesSecSource_) {
649  tinyxml2::XMLElement* branch = doc.NewElement("Branch");
650  branch->SetAttribute("Name", iBranch.first.c_str());
651  branch->SetAttribute("ReadCount", int64_t(iBranch.second.value().load()));
652  branch->Accept(&printer);
653  ost << printer.CStr();
654  printer.ClearBuffer();
655  }
656  ost << "</SecondarySourceReadBranches>\n";
657  }
659  }
660  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436

◆ 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(), NanoAODRNTupleOutputModule::writeRun(), and DQMRootOutputModule::writeRun().

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

◆ reportShutdownSignal()

void edm::JobReport::reportShutdownSignal ( )

Report a unix signal sent to early terminate the job

Definition at line 543 of file JobReport.cc.

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

Referenced by edm::EventProcessor::checkForAsyncStopRequest().

543  {
544  if (impl_->ost_) {
545  {
546  std::lock_guard<std::mutex> lock(write_mutex);
547  std::ostream& msg = *(impl_->ost_);
548  msg << "<ShutdownSignal/>\n";
550  }
551  }
552  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
tuple msg
Definition: mps_check.py:286

◆ 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:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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 554 of file JobReport.cc.

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

554  {
555  if (impl_->ost_) {
556  std::ostream& msg = *(impl_->ost_);
557  tinyxml2::XMLDocument doc;
558  tinyxml2::XMLPrinter printer;
559  tinyxml2::XMLElement* skipped = doc.NewElement("SkippedFile");
560  skipped->SetAttribute("Pfn", pfn.c_str());
561  skipped->SetAttribute("Lfn", lfn.c_str());
562  {
563  std::lock_guard<std::mutex> lock(write_mutex);
564  skipped->Accept(&printer);
565  msg << printer.CStr();
567  }
568  }
569  }
std::mutex write_mutex
Definition: JobReport.h:437
void temporarilyCloseXML()
Definition: JobReport.cc:331
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436
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(), reportShutdownSignal(), 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:438
static constexpr std::string_view kJobReportEndElement
Definition: JobReport.cc:305
edm::propagate_const< std::unique_ptr< JobReportImpl > > impl_
Definition: JobReport.h:436

Member Data Documentation

◆ errorLogged_

bool edm::JobReport::errorLogged_ = false
private

Definition at line 438 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