CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
edm::EventProcessor Class Reference

#include <EventProcessor.h>

Inheritance diagram for edm::EventProcessor:
edm::IEventProcessor

Public Member Functions

virtual bool alreadyHandlingException () const
 
void beginJob ()
 
virtual void beginLumi (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
 
virtual void beginRun (statemachine::Run const &run)
 
void clearCounters ()
 Clears counters used by trigger report. More...
 
virtual void closeInputFile (bool cleaningUpAfterException)
 
virtual void closeOutputFiles ()
 
virtual void deleteLumiFromCache (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
 
virtual void deleteRunFromCache (statemachine::Run const &run)
 
virtual void doErrorStuff ()
 
void enableEndPaths (bool active)
 
void endJob ()
 
virtual void endLumi (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi, bool cleaningUpAfterException)
 
virtual bool endOfLoop ()
 
bool endPathsEnabled () const
 
virtual void endRun (statemachine::Run const &run, bool cleaningUpAfterException)
 
 EventProcessor (std::string const &config, ServiceToken const &token=ServiceToken(), serviceregistry::ServiceLegacy=serviceregistry::kOverlapIsError, std::vector< std::string > const &defaultServices=std::vector< std::string >(), std::vector< std::string > const &forcedServices=std::vector< std::string >())
 
 EventProcessor (std::string const &config, std::vector< std::string > const &defaultServices, std::vector< std::string > const &forcedServices=std::vector< std::string >())
 
 EventProcessor (boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy legacy)
 
 EventProcessor (std::string const &config, bool isPython)
 meant for unit tests More...
 
 EventProcessor (EventProcessor const &)=delete
 
bool forkProcess (std::string const &jobReportFile)
 
std::vector< ModuleDescription
const * > 
getAllModuleDescriptions () const
 
ServiceToken getToken ()
 
void getTriggerReport (TriggerReport &rep) const
 
virtual void openOutputFiles ()
 
EventProcessoroperator= (EventProcessor const &)=delete
 
virtual void prepareForNextLoop ()
 
virtual int readAndMergeLumi ()
 
virtual statemachine::Run readAndMergeRun ()
 
virtual void readAndProcessEvent ()
 
virtual void readFile ()
 
virtual int readLuminosityBlock ()
 
virtual statemachine::Run readRun ()
 
virtual void respondToCloseInputFile ()
 
virtual void respondToOpenInputFile ()
 
virtual void rewindInput ()
 
StatusCode run ()
 
virtual StatusCode runToCompletion ()
 
virtual void setExceptionMessageFiles (std::string &message)
 
virtual void setExceptionMessageLumis (std::string &message)
 
virtual void setExceptionMessageRuns (std::string &message)
 
virtual bool shouldWeCloseOutput () const
 
virtual bool shouldWeStop () const
 
virtual void startingNewLoop ()
 
int totalEvents () const
 
int totalEventsFailed () const
 
int totalEventsPassed () const
 
virtual void writeLumi (ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
 
virtual void writeRun (statemachine::Run const &run)
 
 ~EventProcessor ()
 
- Public Member Functions inherited from edm::IEventProcessor
virtual ~IEventProcessor ()
 

Private Types

typedef std::set< std::pair
< std::string, std::string > > 
ExcludedData
 
typedef std::map< std::string,
ExcludedData
ExcludedDataMap
 

Private Member Functions

bool checkForAsyncStopRequest (StatusCode &)
 
std::auto_ptr
< statemachine::Machine
createStateMachine ()
 
bool hasSubProcess () const
 
void init (boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
 
void possiblyContinueAfterForkChildFailure ()
 
void processEvent (unsigned int iStreamIndex)
 
void readEvent (unsigned int iStreamIndex)
 
void setupSignal ()
 
void terminateMachine (std::auto_ptr< statemachine::Machine > &)
 

Private Attributes

std::unique_ptr
< ExceptionToActionTable const > 
act_table_
 
boost::shared_ptr
< ActivityRegistry
actReg_
 
bool alreadyHandlingException_
 
bool asyncStopRequestedWhileProcessingEvents_
 
StatusCode asyncStopStatusCodeFromProcessingEvents_
 
bool beginJobCalled_
 
boost::shared_ptr
< BranchIDListHelper
branchIDListHelper_
 
bool continueAfterChildFailure_
 
std::string emptyRunLumiMode_
 
boost::shared_ptr
< eventsetup::EventSetupProvider
esp_
 
std::unique_ptr
< eventsetup::EventSetupsController
espController_
 
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
 
std::string exceptionMessageFiles_
 
std::string exceptionMessageLumis_
 
std::string exceptionMessageRuns_
 
std::unique_ptr< FileBlockfb_
 
std::string fileMode_
 
bool forceESCacheClearOnNewRun_
 
bool forceLooperToEnd_
 
std::unique_ptr< HistoryAppenderhistoryAppender_
 
std::unique_ptr< InputSourceinput_
 
boost::shared_ptr< EDLooperBaselooper_
 
bool looperBeginJobRun_
 
InputSource::ItemType nextItemTypeFromProcessingEvents_
 
int numberOfForkedChildren_
 
unsigned int numberOfSequentialEventsPerChild_
 
PreallocationConfiguration preallocations_
 
boost::shared_ptr
< ProductRegistry const > 
preg_
 
PrincipalCache principalCache_
 
boost::shared_ptr
< ProcessConfiguration const > 
processConfiguration_
 
ProcessContext processContext_
 
std::auto_ptr< Scheduleschedule_
 
ServiceToken serviceToken_
 
bool setCpuAffinity_
 
bool shouldWeStop_
 
bool stateMachineWasInErrorState_
 
std::auto_ptr< SubProcesssubProcess_
 

Additional Inherited Members

- Public Types inherited from edm::IEventProcessor
enum  Status {
  epSuccess =0, epException =1, epOther =2, epSignal =3,
  epInputComplete =4, epTimedOut =5, epCountComplete =6
}
 
typedef Status StatusCode
 

Detailed Description

Definition at line 56 of file EventProcessor.h.

Member Typedef Documentation

typedef std::set<std::pair<std::string, std::string> > edm::EventProcessor::ExcludedData
private

Definition at line 290 of file EventProcessor.h.

typedef std::map<std::string, ExcludedData> edm::EventProcessor::ExcludedDataMap
private

Definition at line 291 of file EventProcessor.h.

Constructor & Destructor Documentation

edm::EventProcessor::EventProcessor ( std::string const &  config,
ServiceToken const &  token = ServiceToken(),
serviceregistry::ServiceLegacy  iLegacy = serviceregistry::kOverlapIsError,
std::vector< std::string > const &  defaultServices = std::vector<std::string>(),
std::vector< std::string > const &  forcedServices = std::vector<std::string>() 
)
explicit

Definition at line 202 of file EventProcessor.cc.

References init(), edm::parameterSet(), and PythonProcessDesc::parameterSet().

206  :
207  actReg_(),
208  preg_(),
210  serviceToken_(),
211  input_(),
212  espController_(new eventsetup::EventSetupsController),
213  esp_(),
214  act_table_(),
216  schedule_(),
217  subProcess_(),
218  historyAppender_(new HistoryAppender),
219  fb_(),
220  looper_(),
221  principalCache_(),
222  beginJobCalled_(false),
223  shouldWeStop_(false),
225  fileMode_(),
231  forceLooperToEnd_(false),
232  looperBeginJobRun_(false),
236  setCpuAffinity_(false),
238  boost::shared_ptr<ParameterSet> parameterSet = PythonProcessDesc(config).parameterSet();
239  boost::shared_ptr<ProcessDesc> processDesc(new ProcessDesc(parameterSet));
240  processDesc->addServices(defaultServices, forcedServices);
241  init(processDesc, iToken, iLegacy);
242  }
std::string emptyRunLumiMode_
unsigned int numberOfSequentialEventsPerChild_
std::unique_ptr< ExceptionToActionTable const > act_table_
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
std::string exceptionMessageRuns_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
boost::shared_ptr< edm::ParameterSet > parameterSet()
ServiceToken serviceToken_
std::string exceptionMessageLumis_
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
std::unique_ptr< FileBlock > fb_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
std::auto_ptr< Schedule > schedule_
std::string exceptionMessageFiles_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
void init(boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
PrincipalCache principalCache_
edm::EventProcessor::EventProcessor ( std::string const &  config,
std::vector< std::string > const &  defaultServices,
std::vector< std::string > const &  forcedServices = std::vector<std::string>() 
)

Definition at line 244 of file EventProcessor.cc.

References init(), edm::serviceregistry::kOverlapIsError, edm::parameterSet(), and PythonProcessDesc::parameterSet().

246  :
247  actReg_(),
248  preg_(),
250  serviceToken_(),
251  input_(),
252  espController_(new eventsetup::EventSetupsController),
253  esp_(),
254  act_table_(),
256  schedule_(),
257  subProcess_(),
258  historyAppender_(new HistoryAppender),
259  fb_(),
260  looper_(),
261  principalCache_(),
262  beginJobCalled_(false),
263  shouldWeStop_(false),
265  fileMode_(),
271  forceLooperToEnd_(false),
272  looperBeginJobRun_(false),
276  setCpuAffinity_(false),
280  {
281  boost::shared_ptr<ParameterSet> parameterSet = PythonProcessDesc(config).parameterSet();
282  boost::shared_ptr<ProcessDesc> processDesc(new ProcessDesc(parameterSet));
283  processDesc->addServices(defaultServices, forcedServices);
285  }
std::string emptyRunLumiMode_
unsigned int numberOfSequentialEventsPerChild_
std::unique_ptr< ExceptionToActionTable const > act_table_
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
std::string exceptionMessageRuns_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
boost::shared_ptr< edm::ParameterSet > parameterSet()
ServiceToken serviceToken_
std::string exceptionMessageLumis_
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
std::unique_ptr< FileBlock > fb_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
InputSource::ItemType nextItemTypeFromProcessingEvents_
std::auto_ptr< Schedule > schedule_
std::string exceptionMessageFiles_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
void init(boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
std::auto_ptr< SubProcess > subProcess_
bool asyncStopRequestedWhileProcessingEvents_
std::unique_ptr< eventsetup::EventSetupsController > espController_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
PrincipalCache principalCache_
edm::EventProcessor::EventProcessor ( boost::shared_ptr< ProcessDesc > &  processDesc,
ServiceToken const &  token,
serviceregistry::ServiceLegacy  legacy 
)

Definition at line 287 of file EventProcessor.cc.

References init().

289  :
290  actReg_(),
291  preg_(),
293  serviceToken_(),
294  input_(),
295  espController_(new eventsetup::EventSetupsController),
296  esp_(),
297  act_table_(),
299  schedule_(),
300  subProcess_(),
301  historyAppender_(new HistoryAppender),
302  fb_(),
303  looper_(),
304  principalCache_(),
305  beginJobCalled_(false),
306  shouldWeStop_(false),
308  fileMode_(),
314  forceLooperToEnd_(false),
315  looperBeginJobRun_(false),
319  setCpuAffinity_(false),
323  {
324  init(processDesc, token, legacy);
325  }
std::string emptyRunLumiMode_
unsigned int numberOfSequentialEventsPerChild_
std::unique_ptr< ExceptionToActionTable const > act_table_
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
std::string exceptionMessageRuns_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
ServiceToken serviceToken_
std::string exceptionMessageLumis_
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
std::unique_ptr< FileBlock > fb_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
InputSource::ItemType nextItemTypeFromProcessingEvents_
std::auto_ptr< Schedule > schedule_
std::string exceptionMessageFiles_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
void init(boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
std::auto_ptr< SubProcess > subProcess_
bool asyncStopRequestedWhileProcessingEvents_
std::unique_ptr< eventsetup::EventSetupsController > espController_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
PrincipalCache principalCache_
edm::EventProcessor::EventProcessor ( std::string const &  config,
bool  isPython 
)

meant for unit tests

Definition at line 328 of file EventProcessor.cc.

References init(), edm::serviceregistry::kOverlapIsError, edm::parameterSet(), and PythonProcessDesc::parameterSet().

328  :
329  actReg_(),
330  preg_(),
332  serviceToken_(),
333  input_(),
334  espController_(new eventsetup::EventSetupsController),
335  esp_(),
336  act_table_(),
338  schedule_(),
339  subProcess_(),
340  historyAppender_(new HistoryAppender),
341  fb_(),
342  looper_(),
343  principalCache_(),
344  beginJobCalled_(false),
345  shouldWeStop_(false),
347  fileMode_(),
353  forceLooperToEnd_(false),
354  looperBeginJobRun_(false),
358  setCpuAffinity_(false),
362 {
363  if(isPython) {
364  boost::shared_ptr<ParameterSet> parameterSet = PythonProcessDesc(config).parameterSet();
365  boost::shared_ptr<ProcessDesc> processDesc(new ProcessDesc(parameterSet));
367  }
368  else {
369  boost::shared_ptr<ProcessDesc> processDesc(new ProcessDesc(config));
371  }
372  }
std::string emptyRunLumiMode_
unsigned int numberOfSequentialEventsPerChild_
std::unique_ptr< ExceptionToActionTable const > act_table_
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
std::string exceptionMessageRuns_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
boost::shared_ptr< edm::ParameterSet > parameterSet()
ServiceToken serviceToken_
std::string exceptionMessageLumis_
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
std::unique_ptr< FileBlock > fb_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
InputSource::ItemType nextItemTypeFromProcessingEvents_
std::auto_ptr< Schedule > schedule_
std::string exceptionMessageFiles_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
void init(boost::shared_ptr< ProcessDesc > &processDesc, ServiceToken const &token, serviceregistry::ServiceLegacy)
std::auto_ptr< SubProcess > subProcess_
bool asyncStopRequestedWhileProcessingEvents_
std::unique_ptr< eventsetup::EventSetupsController > espController_
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
PrincipalCache principalCache_
edm::EventProcessor::~EventProcessor ( )

Definition at line 538 of file EventProcessor.cc.

References actReg_, edm::ParentageRegistry::clear(), edm::pset::Registry::clear(), esp_, espController_, getToken(), input_, edm::ParentageRegistry::instance(), edm::pset::Registry::instance(), looper_, schedule_, and subProcess_.

538  {
539  // Make the services available while everything is being deleted.
540  ServiceToken token = getToken();
541  ServiceRegistry::Operate op(token);
542 
543  // manually destroy all these thing that may need the services around
544  espController_.reset();
545  subProcess_.reset();
546  esp_.reset();
547  schedule_.reset();
548  input_.reset();
549  looper_.reset();
550  actReg_.reset();
551 
554  }
void clear()
Not thread safe.
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
void clear()
Not thread safe.
Definition: Registry.cc:42
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
ServiceToken getToken()
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
static ParentageRegistry * instance()
static Registry * instance()
Definition: Registry.cc:14
edm::EventProcessor::EventProcessor ( EventProcessor const &  )
delete

Member Function Documentation

bool edm::EventProcessor::alreadyHandlingException ( ) const
virtual

Implements edm::IEventProcessor.

Definition at line 1881 of file EventProcessor.cc.

1881  {
1883  }
void edm::EventProcessor::beginJob ( void  )

This should be called before the first call to 'run' If this is not called in time, it will automatically be called the first time 'run' is called

Definition at line 557 of file EventProcessor.cc.

References actReg_, cms::Exception::addContext(), edm::convertException::badAllocToEDM(), bk::beginJob(), beginJobCalled_, trackerHits::c, edm::convertException::charPtrToEDM(), alignCSCRings::e, cppFunctionSkipper::exception, hasSubProcess(), i, input_, edm::PreallocationConfiguration::numberOfLuminosityBlocks(), edm::PreallocationConfiguration::numberOfRuns(), edm::PreallocationConfiguration::numberOfStreams(), edm::PreallocationConfiguration::numberOfThreads(), cmsPerfStripChart::operate(), preallocations_, preg_, alignCSCRings::s, schedule_, serviceToken_, edm::convertException::stdToEDM(), AlCaHLTBitMon_QueryRunRegistry::string, edm::convertException::stringToEDM(), subProcess_, and edm::convertException::unknownToEDM().

557  {
558  if(beginJobCalled_) return;
559  beginJobCalled_=true;
560  bk::beginJob();
561 
562  // StateSentry toerror(this); // should we add this ?
563  //make the services available
565 
566  service::SystemBounds bounds(preallocations_.numberOfStreams(),
570  actReg_->preallocateSignal_(bounds);
571  //NOTE: This implementation assumes 'Job' means one call
572  // the EventProcessor::run
573  // If it really means once per 'application' then this code will
574  // have to be changed.
575  // Also have to deal with case where have 'run' then new Module
576  // added and do 'run'
577  // again. In that case the newly added Module needs its 'beginJob'
578  // to be called.
579 
580  //NOTE: in future we should have a beginOfJob for looper that takes no arguments
581  // For now we delay calling beginOfJob until first beginOfRun
582  //if(looper_) {
583  // looper_->beginOfJob(es);
584  //}
585  try {
586  try {
587  input_->doBeginJob();
588  }
589  catch (cms::Exception& e) { throw; }
590  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
591  catch (std::exception& e) { convertException::stdToEDM(e); }
593  catch(char const* c) { convertException::charPtrToEDM(c); }
594  catch (...) { convertException::unknownToEDM(); }
595  }
596  catch(cms::Exception& ex) {
597  ex.addContext("Calling beginJob for the source");
598  throw;
599  }
600  schedule_->beginJob(*preg_);
601  // toerror.succeeded(); // should we add this?
602  if(hasSubProcess()) subProcess_->doBeginJob();
603  actReg_->postBeginJobSignal_();
604 
605  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
606  schedule_->beginStream(i);
607  if(hasSubProcess()) subProcess_->doBeginStream(i);
608  }
609  }
int i
Definition: DBlmapReader.cc:9
boost::shared_ptr< ActivityRegistry > actReg_
PreallocationConfiguration preallocations_
void beginJob()
Definition: Breakpoints.cc:15
ServiceToken serviceToken_
void stdToEDM(std::exception const &e)
std::auto_ptr< Schedule > schedule_
boost::shared_ptr< ProductRegistry const > preg_
void charPtrToEDM(char const *c)
void stringToEDM(std::string &s)
std::unique_ptr< InputSource > input_
void addContext(std::string const &context)
Definition: Exception.cc:227
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
void edm::EventProcessor::beginLumi ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)
virtual

Implements edm::IEventProcessor.

Definition at line 1619 of file EventProcessor.cc.

References edm::LuminosityBlockPrincipal::beginTime(), FDEBUG, i, edm::Service< T >::isAvailable(), edm::LuminosityBlockPrincipal::luminosityBlock(), and edm::LuminosityBlockPrincipal::run().

1619  {
1620  LuminosityBlockPrincipal& lumiPrincipal = principalCache_.lumiPrincipal(phid, run, lumi);
1621  input_->doBeginLumi(lumiPrincipal, &processContext_);
1622 
1624  if(rng.isAvailable()) {
1625  LuminosityBlock lb(lumiPrincipal, ModuleDescription(), nullptr);
1626  rng->preBeginLumi(lb);
1627  }
1628 
1629  // NOTE: Using 0 as the event number for the begin of a lumi block is a bad idea
1630  // lumi blocks know their start and end times why not also start and end events?
1631  IOVSyncValue ts(EventID(lumiPrincipal.run(), lumiPrincipal.luminosityBlock(), 0), lumiPrincipal.beginTime());
1632  espController_->eventSetupForInstance(ts);
1633  EventSetup const& es = esp_->eventSetup();
1634  {
1635  typedef OccurrenceTraits<LuminosityBlockPrincipal, BranchActionGlobalBegin> Traits;
1636  schedule_->processOneGlobal<Traits>(lumiPrincipal, es);
1637  if(hasSubProcess()) {
1638  subProcess_->doBeginLuminosityBlock(lumiPrincipal, ts);
1639  }
1640  }
1641  FDEBUG(1) << "\tbeginLumi " << run << "/" << lumi << "\n";
1642  if(looper_) {
1643  looper_->doBeginLuminosityBlock(lumiPrincipal, es, &processContext_);
1644  }
1645  {
1646  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
1647  typedef OccurrenceTraits<LuminosityBlockPrincipal, BranchActionStreamBegin> Traits;
1648  schedule_->processOneStream<Traits>(i,lumiPrincipal, es);
1649  if(hasSubProcess()) {
1650  subProcess_->doStreamBeginLuminosityBlock(i,lumiPrincipal, ts);
1651  }
1652  }
1653  }
1654  FDEBUG(1) << "\tstreamBeginLumi " << run << "/" << lumi << "\n";
1655  if(looper_) {
1656  //looper_->doStreamBeginLuminosityBlock(schedule_->streamID(),lumiPrincipal, es);
1657  }
1658  }
int i
Definition: DBlmapReader.cc:9
ProcessContext processContext_
boost::shared_ptr< EDLooperBase > looper_
tuple lumi
Definition: fjr2json.py:35
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
#define FDEBUG(lev)
Definition: DebugMacros.h:18
PreallocationConfiguration preallocations_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
PrincipalCache principalCache_
bool hasSubProcess() const
void edm::EventProcessor::beginRun ( statemachine::Run const &  run)
virtual

Implements edm::IEventProcessor.

Definition at line 1544 of file EventProcessor.cc.

References edm::RunPrincipal::beginTime(), FDEBUG, i, statemachine::Run::processHistoryID(), edm::RunPrincipal::run(), and statemachine::Run::runNumber().

1544  {
1545  RunPrincipal& runPrincipal = principalCache_.runPrincipal(run.processHistoryID(), run.runNumber());
1546  input_->doBeginRun(runPrincipal, &processContext_);
1547  IOVSyncValue ts(EventID(runPrincipal.run(), 0, 0),
1548  runPrincipal.beginTime());
1550  espController_->forceCacheClear();
1551  }
1552  espController_->eventSetupForInstance(ts);
1553  EventSetup const& es = esp_->eventSetup();
1554  if(looper_ && looperBeginJobRun_== false) {
1555  looper_->copyInfo(ScheduleInfo(schedule_.get()));
1556  looper_->beginOfJob(es);
1557  looperBeginJobRun_ = true;
1558  looper_->doStartingNewLoop();
1559  }
1560  {
1561  typedef OccurrenceTraits<RunPrincipal, BranchActionGlobalBegin> Traits;
1562  schedule_->processOneGlobal<Traits>(runPrincipal, es);
1563  if(hasSubProcess()) {
1564  subProcess_->doBeginRun(runPrincipal, ts);
1565  }
1566  }
1567  FDEBUG(1) << "\tbeginRun " << run.runNumber() << "\n";
1568  if(looper_) {
1569  looper_->doBeginRun(runPrincipal, es, &processContext_);
1570  }
1571  {
1572  typedef OccurrenceTraits<RunPrincipal, BranchActionStreamBegin> Traits;
1573  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
1574  schedule_->processOneStream<Traits>(i,runPrincipal, es);
1575  if(hasSubProcess()) {
1576  subProcess_->doStreamBeginRun(i, runPrincipal, ts);
1577  }
1578  }
1579  }
1580  FDEBUG(1) << "\tstreamBeginRun " << run.runNumber() << "\n";
1581  if(looper_) {
1582  //looper_->doStreamBeginRun(schedule_->streamID(),runPrincipal, es);
1583  }
1584  }
int i
Definition: DBlmapReader.cc:9
ProcessContext processContext_
boost::shared_ptr< EDLooperBase > looper_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
PreallocationConfiguration preallocations_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
PrincipalCache principalCache_
bool hasSubProcess() const
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const
bool edm::EventProcessor::checkForAsyncStopRequest ( StatusCode returnCode)
private

Definition at line 1244 of file EventProcessor.cc.

References edm::shutdown_flag.

1244  {
1245  bool returnValue = false;
1246 
1247  // Look for a shutdown signal
1248  if(shutdown_flag.load(std::memory_order_relaxed)) {
1249  returnValue = true;
1250  returnCode = epSignal;
1251  }
1252  return returnValue;
1253  }
volatile std::atomic< bool > shutdown_flag
void edm::EventProcessor::clearCounters ( )

Clears counters used by trigger report.

Definition at line 1207 of file EventProcessor.cc.

1207  {
1208  schedule_->clearCounters();
1209  }
std::auto_ptr< Schedule > schedule_
void edm::EventProcessor::closeInputFile ( bool  cleaningUpAfterException)
virtual

Implements edm::IEventProcessor.

Definition at line 1455 of file EventProcessor.cc.

References FDEBUG.

1455  {
1456  if (fb_.get() != nullptr) {
1457  input_->closeFile(fb_.get(), cleaningUpAfterException);
1458  }
1459  FDEBUG(1) << "\tcloseInputFile\n";
1460  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< FileBlock > fb_
std::unique_ptr< InputSource > input_
void edm::EventProcessor::closeOutputFiles ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1470 of file EventProcessor.cc.

References FDEBUG.

1470  {
1471  if (fb_.get() != nullptr) {
1472  schedule_->closeOutputFiles();
1473  if(hasSubProcess()) subProcess_->closeOutputFiles();
1474  }
1475  FDEBUG(1) << "\tcloseOutputFiles\n";
1476  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< FileBlock > fb_
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
std::auto_ptr< statemachine::Machine > edm::EventProcessor::createStateMachine ( )
private

Definition at line 1213 of file EventProcessor.cc.

References edm::errors::Configuration, statemachine::doNotHandleEmptyRunsAndLumis, edm::hlt::Exception, dtDQMClient_cfg::fileMode, statemachine::FULLMERGE, statemachine::handleEmptyRuns, statemachine::handleEmptyRunsAndLumis, statemachine::NOMERGE, and AlCaHLTBitMon_QueryRunRegistry::string.

1213  {
1215  if(fileMode_.empty()) fileMode = statemachine::FULLMERGE;
1216  else if(fileMode_ == std::string("NOMERGE")) fileMode = statemachine::NOMERGE;
1217  else if(fileMode_ == std::string("FULLMERGE")) fileMode = statemachine::FULLMERGE;
1218  else {
1219  throw Exception(errors::Configuration, "Illegal fileMode parameter value: ")
1220  << fileMode_ << ".\n"
1221  << "Legal values are 'NOMERGE' and 'FULLMERGE'.\n";
1222  }
1223 
1224  statemachine::EmptyRunLumiMode emptyRunLumiMode;
1225  if(emptyRunLumiMode_.empty()) emptyRunLumiMode = statemachine::handleEmptyRunsAndLumis;
1226  else if(emptyRunLumiMode_ == std::string("handleEmptyRunsAndLumis")) emptyRunLumiMode = statemachine::handleEmptyRunsAndLumis;
1227  else if(emptyRunLumiMode_ == std::string("handleEmptyRuns")) emptyRunLumiMode = statemachine::handleEmptyRuns;
1228  else if(emptyRunLumiMode_ == std::string("doNotHandleEmptyRunsAndLumis")) emptyRunLumiMode = statemachine::doNotHandleEmptyRunsAndLumis;
1229  else {
1230  throw Exception(errors::Configuration, "Illegal emptyMode parameter value: ")
1231  << emptyRunLumiMode_ << ".\n"
1232  << "Legal values are 'handleEmptyRunsAndLumis', 'handleEmptyRuns', and 'doNotHandleEmptyRunsAndLumis'.\n";
1233  }
1234 
1235  std::auto_ptr<statemachine::Machine> machine(new statemachine::Machine(this,
1236  fileMode,
1237  emptyRunLumiMode));
1238 
1239  machine->initiate();
1240  return machine;
1241  }
std::string emptyRunLumiMode_
void edm::EventProcessor::deleteLumiFromCache ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)
virtual

Implements edm::IEventProcessor.

Definition at line 1770 of file EventProcessor.cc.

References FDEBUG.

1770  {
1772  if(hasSubProcess()) subProcess_->deleteLumiFromCache(phid, run, lumi);
1773  FDEBUG(1) << "\tdeleteLumiFromCache " << run << "/" << lumi << "\n";
1774  }
void deleteLumi(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi)
tuple lumi
Definition: fjr2json.py:35
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::auto_ptr< SubProcess > subProcess_
PrincipalCache principalCache_
bool hasSubProcess() const
void edm::EventProcessor::deleteRunFromCache ( statemachine::Run const &  run)
virtual

Implements edm::IEventProcessor.

Definition at line 1758 of file EventProcessor.cc.

References FDEBUG, statemachine::Run::processHistoryID(), and statemachine::Run::runNumber().

1758  {
1759  principalCache_.deleteRun(run.processHistoryID(), run.runNumber());
1760  if(hasSubProcess()) subProcess_->deleteRunFromCache(run.processHistoryID(), run.runNumber());
1761  FDEBUG(1) << "\tdeleteRunFromCache " << run.runNumber() << "\n";
1762  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void deleteRun(ProcessHistoryID const &phid, RunNumber_t run)
std::auto_ptr< SubProcess > subProcess_
PrincipalCache principalCache_
bool hasSubProcess() const
void edm::EventProcessor::doErrorStuff ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1533 of file EventProcessor.cc.

References FDEBUG.

1533  {
1534  FDEBUG(1) << "\tdoErrorStuff\n";
1535  LogError("StateMachine")
1536  << "The EventProcessor state machine encountered an unexpected event\n"
1537  << "and went to the error state\n"
1538  << "Will attempt to terminate processing normally\n"
1539  << "(IF using the looper the next loop will be attempted)\n"
1540  << "This likely indicates a bug in an input module or corrupted input or both\n";
1542  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::EventProcessor::enableEndPaths ( bool  active)

Turn end_paths "off" if "active" is false; turn end_paths "on" if "active" is true.

Definition at line 1192 of file EventProcessor.cc.

1192  {
1193  schedule_->enableEndPaths(active);
1194  }
std::auto_ptr< Schedule > schedule_
void edm::EventProcessor::endJob ( void  )

This should be called before the EventProcessor is destroyed throws if any module's endJob throws an exception.

Definition at line 612 of file EventProcessor.cc.

References actReg_, trackerHits::c, edm::ExceptionCollector::call(), edm::SubProcess::doEndJob(), edm::InputSource::doEndJob(), edm::EDLooperBase::endOfJob(), hasSubProcess(), edm::ExceptionCollector::hasThrown(), i, input_, looper_, edm::PreallocationConfiguration::numberOfStreams(), cmsPerfStripChart::operate(), preallocations_, edm::ExceptionCollector::rethrow(), schedule_, serviceToken_, and subProcess_.

612  {
613  // Collects exceptions, so we don't throw before all operations are performed.
614  ExceptionCollector c("Multiple exceptions were thrown while executing endJob. An exception message follows for each.\n");
615 
616  //make the services available
618 
619  //NOTE: this really should go elsewhere in the future
620  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
621  c.call([this,i](){this->schedule_->endStream(i);});
622  if(hasSubProcess()) {
623  c.call([this,i](){ this->subProcess_->doEndStream(i); } );
624  }
625  }
626  schedule_->endJob(c);
627  if(hasSubProcess()) {
628  c.call(boost::bind(&SubProcess::doEndJob, subProcess_.get()));
629  }
630  c.call(boost::bind(&InputSource::doEndJob, input_.get()));
631  if(looper_) {
632  c.call(boost::bind(&EDLooperBase::endOfJob, looper_));
633  }
634  auto actReg = actReg_.get();
635  c.call([actReg](){actReg->postEndJobSignal_();});
636  if(c.hasThrown()) {
637  c.rethrow();
638  }
639  }
int i
Definition: DBlmapReader.cc:9
void doEndJob()
Called by framework at end of job.
Definition: InputSource.cc:252
boost::shared_ptr< EDLooperBase > looper_
boost::shared_ptr< ActivityRegistry > actReg_
PreallocationConfiguration preallocations_
ServiceToken serviceToken_
virtual void endOfJob()
Definition: EDLooperBase.cc:93
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
void edm::EventProcessor::endLumi ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
bool  cleaningUpAfterException 
)
virtual

Implements edm::IEventProcessor.

Definition at line 1660 of file EventProcessor.cc.

References edm::LuminosityBlockPrincipal::endTime(), FDEBUG, i, edm::LuminosityBlockPrincipal::luminosityBlock(), and edm::LuminosityBlockPrincipal::run().

Referenced by Types.EventRange::cppID().

1660  {
1661  LuminosityBlockPrincipal& lumiPrincipal = principalCache_.lumiPrincipal(phid, run, lumi);
1662  input_->doEndLumi(lumiPrincipal, cleaningUpAfterException, &processContext_);
1663  //NOTE: Using the max event number for the end of a lumi block is a bad idea
1664  // lumi blocks know their start and end times why not also start and end events?
1665  IOVSyncValue ts(EventID(lumiPrincipal.run(), lumiPrincipal.luminosityBlock(), EventID::maxEventNumber()),
1666  lumiPrincipal.endTime());
1667  espController_->eventSetupForInstance(ts);
1668  EventSetup const& es = esp_->eventSetup();
1669  {
1670  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
1671  typedef OccurrenceTraits<LuminosityBlockPrincipal, BranchActionStreamEnd> Traits;
1672  schedule_->processOneStream<Traits>(i,lumiPrincipal, es, cleaningUpAfterException);
1673  if(hasSubProcess()) {
1674  subProcess_->doStreamEndLuminosityBlock(i,lumiPrincipal, ts, cleaningUpAfterException);
1675  }
1676  }
1677  }
1678  FDEBUG(1) << "\tendLumi " << run << "/" << lumi << "\n";
1679  if(looper_) {
1680  //looper_->doStreamEndLuminosityBlock(schedule_->streamID(),lumiPrincipal, es);
1681  }
1682  {
1683  typedef OccurrenceTraits<LuminosityBlockPrincipal, BranchActionGlobalEnd> Traits;
1684  schedule_->processOneGlobal<Traits>(lumiPrincipal, es, cleaningUpAfterException);
1685  if(hasSubProcess()) {
1686  subProcess_->doEndLuminosityBlock(lumiPrincipal, ts, cleaningUpAfterException);
1687  }
1688  }
1689  FDEBUG(1) << "\tendLumi " << run << "/" << lumi << "\n";
1690  if(looper_) {
1691  looper_->doEndLuminosityBlock(lumiPrincipal, es, &processContext_);
1692  }
1693  }
int i
Definition: DBlmapReader.cc:9
ProcessContext processContext_
boost::shared_ptr< EDLooperBase > looper_
tuple lumi
Definition: fjr2json.py:35
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
#define FDEBUG(lev)
Definition: DebugMacros.h:18
PreallocationConfiguration preallocations_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
static EventNumber_t maxEventNumber()
Definition: EventID.h:106
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
PrincipalCache principalCache_
bool hasSubProcess() const
bool edm::EventProcessor::endOfLoop ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1504 of file EventProcessor.cc.

References FDEBUG, and ntuplemaker::status.

1504  {
1505  if(looper_) {
1506  ModuleChanger changer(schedule_.get());
1507  looper_->setModuleChanger(&changer);
1508  EDLooperBase::Status status = looper_->doEndOfLoop(esp_->eventSetup());
1509  looper_->setModuleChanger(nullptr);
1510  if(status != EDLooperBase::kContinue || forceLooperToEnd_) return true;
1511  else return false;
1512  }
1513  FDEBUG(1) << "\tendOfLoop\n";
1514  return true;
1515  }
boost::shared_ptr< EDLooperBase > looper_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
std::auto_ptr< Schedule > schedule_
tuple status
Definition: ntuplemaker.py:245
bool edm::EventProcessor::endPathsEnabled ( ) const

Return true if end_paths are active, and false if they are inactive.

Definition at line 1197 of file EventProcessor.cc.

1197  {
1198  return schedule_->endPathsEnabled();
1199  }
std::auto_ptr< Schedule > schedule_
void edm::EventProcessor::endRun ( statemachine::Run const &  run,
bool  cleaningUpAfterException 
)
virtual

Implements edm::IEventProcessor.

Definition at line 1586 of file EventProcessor.cc.

References edm::RunPrincipal::endTime(), FDEBUG, i, statemachine::Run::processHistoryID(), edm::RunPrincipal::run(), and statemachine::Run::runNumber().

1586  {
1587  RunPrincipal& runPrincipal = principalCache_.runPrincipal(run.processHistoryID(), run.runNumber());
1588  input_->doEndRun(runPrincipal, cleaningUpAfterException, &processContext_);
1590  runPrincipal.endTime());
1591  espController_->eventSetupForInstance(ts);
1592  EventSetup const& es = esp_->eventSetup();
1593  {
1594  for(unsigned int i=0; i<preallocations_.numberOfStreams();++i) {
1595  typedef OccurrenceTraits<RunPrincipal, BranchActionStreamEnd> Traits;
1596  schedule_->processOneStream<Traits>(i,runPrincipal, es, cleaningUpAfterException);
1597  if(hasSubProcess()) {
1598  subProcess_->doStreamEndRun(i,runPrincipal, ts, cleaningUpAfterException);
1599  }
1600  }
1601  }
1602  FDEBUG(1) << "\tstreamEndRun " << run.runNumber() << "\n";
1603  if(looper_) {
1604  //looper_->doStreamEndRun(schedule_->streamID(),runPrincipal, es);
1605  }
1606  {
1607  typedef OccurrenceTraits<RunPrincipal, BranchActionGlobalEnd> Traits;
1608  schedule_->processOneGlobal<Traits>(runPrincipal, es, cleaningUpAfterException);
1609  if(hasSubProcess()) {
1610  subProcess_->doEndRun(runPrincipal, ts, cleaningUpAfterException);
1611  }
1612  }
1613  FDEBUG(1) << "\tendRun " << run.runNumber() << "\n";
1614  if(looper_) {
1615  looper_->doEndRun(runPrincipal, es, &processContext_);
1616  }
1617  }
int i
Definition: DBlmapReader.cc:9
ProcessContext processContext_
boost::shared_ptr< EDLooperBase > looper_
static LuminosityBlockNumber_t maxLuminosityBlockNumber()
#define FDEBUG(lev)
Definition: DebugMacros.h:18
PreallocationConfiguration preallocations_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
static EventNumber_t maxEventNumber()
Definition: EventID.h:106
std::auto_ptr< SubProcess > subProcess_
std::unique_ptr< eventsetup::EventSetupsController > espController_
PrincipalCache principalCache_
bool hasSubProcess() const
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const
bool edm::EventProcessor::forkProcess ( std::string const &  jobReportFile)

Definition at line 871 of file EventProcessor.cc.

References bk::beginJob(), edm::eventsetup::EventSetupRecord::doGet(), alignCSCRings::e, edm::hlt::Exception, cmsRelvalreport::exit, edm::EventSetup::fillAvailableRecordKeys(), edm::eventsetup::EventSetupRecord::fillRegisteredDataKeys(), edm::EventSetup::find(), edm::eventsetup::EventSetupRecord::find(), edm::installCustomHandler(), NULL, O_NONBLOCK, cmsPerfStripChart::operate(), or, pipe::pipe(), edm::shutdown_flag, relativeConstraints::value, and cms::Exception::what().

871  {
872 
873  if(0 == numberOfForkedChildren_) {return true;}
874  assert(0<numberOfForkedChildren_);
875  //do what we want done in common
876  {
877  beginJob(); //make sure this was run
878  // make the services available
880 
881  InputSource::ItemType itemType;
882  itemType = input_->nextItemType();
883 
884  assert(itemType == InputSource::IsFile);
885  {
886  readFile();
887  }
888  itemType = input_->nextItemType();
889  assert(itemType == InputSource::IsRun);
890 
891  LogSystem("ForkingEventSetupPreFetching") << " prefetching for run " << input_->runAuxiliary()->run();
892  IOVSyncValue ts(EventID(input_->runAuxiliary()->run(), 0, 0),
893  input_->runAuxiliary()->beginTime());
894  espController_->eventSetupForInstance(ts);
895  EventSetup const& es = esp_->eventSetup();
896 
897  //now get all the data available in the EventSetup
898  std::vector<eventsetup::EventSetupRecordKey> recordKeys;
899  es.fillAvailableRecordKeys(recordKeys);
900  std::vector<eventsetup::DataKey> dataKeys;
901  for(std::vector<eventsetup::EventSetupRecordKey>::const_iterator itKey = recordKeys.begin(), itEnd = recordKeys.end();
902  itKey != itEnd;
903  ++itKey) {
904  eventsetup::EventSetupRecord const* recordPtr = es.find(*itKey);
905  //see if this is on our exclusion list
906  ExcludedDataMap::const_iterator itExcludeRec = eventSetupDataToExcludeFromPrefetching_.find(itKey->type().name());
907  ExcludedData const* excludedData(nullptr);
908  if(itExcludeRec != eventSetupDataToExcludeFromPrefetching_.end()) {
909  excludedData = &(itExcludeRec->second);
910  if(excludedData->size() == 0 || excludedData->begin()->first == "*") {
911  //skip all items in this record
912  continue;
913  }
914  }
915  if(0 != recordPtr) {
916  dataKeys.clear();
917  recordPtr->fillRegisteredDataKeys(dataKeys);
918  for(std::vector<eventsetup::DataKey>::const_iterator itDataKey = dataKeys.begin(), itDataKeyEnd = dataKeys.end();
919  itDataKey != itDataKeyEnd;
920  ++itDataKey) {
921  //std::cout << " " << itDataKey->type().name() << " " << itDataKey->name().value() << std::endl;
922  if(0 != excludedData && excludedData->find(std::make_pair(itDataKey->type().name(), itDataKey->name().value())) != excludedData->end()) {
923  LogInfo("ForkingEventSetupPreFetching") << " excluding:" << itDataKey->type().name() << " " << itDataKey->name().value() << std::endl;
924  continue;
925  }
926  try {
927  recordPtr->doGet(*itDataKey);
928  } catch(cms::Exception& e) {
929  LogWarning("ForkingEventSetupPreFetching") << e.what();
930  }
931  }
932  }
933  }
934  }
935  LogSystem("ForkingEventSetupPreFetching") <<" done prefetching";
936  {
937  // make the services available
939  Service<JobReport> jobReport;
940  jobReport->parentBeforeFork(jobReportFile, numberOfForkedChildren_);
941 
942  //Now actually do the forking
943  actReg_->preForkReleaseResourcesSignal_();
944  input_->doPreForkReleaseResources();
945  schedule_->preForkReleaseResources();
946  }
947  installCustomHandler(SIGCHLD, ep_sigchld);
948 
949 
950  unsigned int childIndex = 0;
951  unsigned int const kMaxChildren = numberOfForkedChildren_;
952  unsigned int const numberOfDigitsInIndex = numberOfDigitsInChildIndex(kMaxChildren);
953  std::vector<pid_t> childrenIds;
954  childrenIds.reserve(kMaxChildren);
955  std::vector<int> childrenSockets;
956  childrenSockets.reserve(kMaxChildren);
957  std::vector<int> childrenPipes;
958  childrenPipes.reserve(kMaxChildren);
959  std::vector<int> childrenSocketsCopy;
960  childrenSocketsCopy.reserve(kMaxChildren);
961  std::vector<int> childrenPipesCopy;
962  childrenPipesCopy.reserve(kMaxChildren);
963  int pipes[] {0, 0};
964 
965  {
966  // make the services available
968  Service<JobReport> jobReport;
969  int sockets[2], fd_flags;
970  for(; childIndex < kMaxChildren; ++childIndex) {
971  // Create a UNIX_DGRAM socket pair
972  if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets)) {
973  printf("Error creating communication socket (errno=%d, %s)\n", errno, strerror(errno));
974  exit(EXIT_FAILURE);
975  }
976  if (pipe(pipes)) {
977  printf("Error creating communication pipes (errno=%d, %s)\n", errno, strerror(errno));
978  exit(EXIT_FAILURE);
979  }
980  // set CLOEXEC so the socket/pipe doesn't get leaked if the child exec's.
981  if ((fd_flags = fcntl(sockets[1], F_GETFD, NULL)) == -1) {
982  printf("Failed to get fd flags: %d %s\n", errno, strerror(errno));
983  exit(EXIT_FAILURE);
984  }
985  // Mark socket as non-block. Child must be careful to do select prior
986  // to reading from socket.
987  if (fcntl(sockets[1], F_SETFD, fd_flags | FD_CLOEXEC | O_NONBLOCK) == -1) {
988  printf("Failed to set new fd flags: %d %s\n", errno, strerror(errno));
989  exit(EXIT_FAILURE);
990  }
991  if ((fd_flags = fcntl(pipes[1], F_GETFD, NULL)) == -1) {
992  printf("Failed to get fd flags: %d %s\n", errno, strerror(errno));
993  exit(EXIT_FAILURE);
994  }
995  if (fcntl(pipes[1], F_SETFD, fd_flags | FD_CLOEXEC) == -1) {
996  printf("Failed to set new fd flags: %d %s\n", errno, strerror(errno));
997  exit(EXIT_FAILURE);
998  }
999  // Linux man page notes there are some edge cases where reading from a
1000  // fd can block, even after a select.
1001  if ((fd_flags = fcntl(pipes[0], F_GETFD, NULL)) == -1) {
1002  printf("Failed to get fd flags: %d %s\n", errno, strerror(errno));
1003  exit(EXIT_FAILURE);
1004  }
1005  if (fcntl(pipes[0], F_SETFD, fd_flags | O_NONBLOCK) == -1) {
1006  printf("Failed to set new fd flags: %d %s\n", errno, strerror(errno));
1007  exit(EXIT_FAILURE);
1008  }
1009 
1010  childrenPipesCopy = childrenPipes;
1011  childrenSocketsCopy = childrenSockets;
1012 
1013  pid_t value = fork();
1014  if(value == 0) {
1015  // Close the parent's side of the socket and pipe which will talk to us.
1016  close(pipes[0]);
1017  close(sockets[0]);
1018  // Close our copies of the parent's other communication pipes.
1019  for(std::vector<int>::const_iterator it=childrenPipesCopy.begin(); it != childrenPipesCopy.end(); it++) {
1020  close(*it);
1021  }
1022  for(std::vector<int>::const_iterator it=childrenSocketsCopy.begin(); it != childrenSocketsCopy.end(); it++) {
1023  close(*it);
1024  }
1025 
1026  // this is the child process, redirect stdout and stderr to a log file
1027  fflush(stdout);
1028  fflush(stderr);
1029  std::stringstream stout;
1030  stout << "redirectout_" << getpgrp() << "_" << std::setw(numberOfDigitsInIndex) << std::setfill('0') << childIndex << ".log";
1031  if(0 == freopen(stout.str().c_str(), "w", stdout)) {
1032  LogError("ForkingStdOutRedirect") << "Error during freopen of child process "<< childIndex;
1033  }
1034  if(dup2(fileno(stdout), fileno(stderr)) < 0) {
1035  LogError("ForkingStdOutRedirect") << "Error during dup2 of child process"<< childIndex;
1036  }
1037 
1038  LogInfo("ForkingChild") << "I am child " << childIndex << " with pgid " << getpgrp();
1039  if(setCpuAffinity_) {
1040  // CPU affinity is handled differently on macosx.
1041  // We disable it and print a message until someone reads:
1042  //
1043  // http://developer.apple.com/mac/library/releasenotes/Performance/RN-AffinityAPI/index.html
1044  //
1045  // and implements it.
1046 #ifdef __APPLE__
1047  LogInfo("ForkingChildAffinity") << "Architecture support for CPU affinity not implemented.";
1048 #else
1049  LogInfo("ForkingChildAffinity") << "Setting CPU affinity, setting this child to cpu " << childIndex;
1050  cpu_set_t mask;
1051  CPU_ZERO(&mask);
1052  CPU_SET(childIndex, &mask);
1053  if(sched_setaffinity(0, sizeof(mask), &mask) != 0) {
1054  LogError("ForkingChildAffinity") << "Failed to set the cpu affinity, errno " << errno;
1055  exit(-1);
1056  }
1057 #endif
1058  }
1059  break;
1060  } else {
1061  //this is the parent
1062  close(pipes[1]);
1063  close(sockets[1]);
1064  }
1065  if(value < 0) {
1066  LogError("ForkingChild") << "failed to create a child";
1067  exit(-1);
1068  }
1069  childrenIds.push_back(value);
1070  childrenSockets.push_back(sockets[0]);
1071  childrenPipes.push_back(pipes[0]);
1072  }
1073 
1074  if(childIndex < kMaxChildren) {
1075  jobReport->childAfterFork(jobReportFile, childIndex, kMaxChildren);
1076  actReg_->postForkReacquireResourcesSignal_(childIndex, kMaxChildren);
1077 
1078  boost::shared_ptr<multicore::MessageReceiverForSource> receiver(new multicore::MessageReceiverForSource(sockets[1], pipes[1]));
1079  input_->doPostForkReacquireResources(receiver);
1080  schedule_->postForkReacquireResources(childIndex, kMaxChildren);
1081  //NOTE: sources have to reset themselves by listening to the post fork message
1082  //rewindInput();
1083  return true;
1084  }
1085  jobReport->parentAfterFork(jobReportFile);
1086  }
1087 
1088  //this is the original, which is now the master for all the children
1089 
1090  //Need to wait for signals from the children or externally
1091  // To wait we must
1092  // 1) block the signals we want to wait on so we do not have a race condition
1093  // 2) check that we haven't already meet our ending criteria
1094  // 3) call sigsuspend, which unblocks the signals and waits until a signal is caught
1095  sigset_t blockingSigSet;
1096  sigset_t unblockingSigSet;
1097  sigset_t oldSigSet;
1098  pthread_sigmask(SIG_SETMASK, NULL, &unblockingSigSet);
1099  pthread_sigmask(SIG_SETMASK, NULL, &blockingSigSet);
1100  sigaddset(&blockingSigSet, SIGCHLD);
1101  sigaddset(&blockingSigSet, SIGUSR2);
1102  sigaddset(&blockingSigSet, SIGINT);
1103  sigdelset(&unblockingSigSet, SIGCHLD);
1104  sigdelset(&unblockingSigSet, SIGUSR2);
1105  sigdelset(&unblockingSigSet, SIGINT);
1106  pthread_sigmask(SIG_BLOCK, &blockingSigSet, &oldSigSet);
1107 
1108  // If there are too many fd's (unlikely, but possible) for select, denote this
1109  // because the sender will fail.
1110  bool too_many_fds = false;
1111  if (pipes[1]+1 > FD_SETSIZE) {
1112  LogError("ForkingFileDescriptors") << "too many file descriptors for multicore job";
1113  too_many_fds = true;
1114  }
1115 
1116  //create a thread that sends the units of work to workers
1117  // we create it after all signals were blocked so that this
1118  // thread is never interupted by a signal
1119  MessageSenderToSource sender(childrenSockets, childrenPipes, numberOfSequentialEventsPerChild_);
1120  boost::thread senderThread(sender);
1121 
1122  if(not too_many_fds) {
1123  //NOTE: a child could have failed before we got here and even after this call
1124  // which is why the 'if' is conditional on continueAfterChildFailure_
1126  while(!shutdown_flag && (!child_failed or continueAfterChildFailure_) && (childrenIds.size() != num_children_done)) {
1127  sigsuspend(&unblockingSigSet);
1129  LogInfo("ForkingAwake") << "woke from sigwait" << std::endl;
1130  }
1131  }
1132  pthread_sigmask(SIG_SETMASK, &oldSigSet, NULL);
1133 
1134  LogInfo("ForkingStopping") << "num children who have already stopped " << num_children_done;
1135  if(child_failed) {
1136  LogError("ForkingStopping") << "child failed";
1137  }
1138  if(shutdown_flag) {
1139  LogSystem("ForkingStopping") << "asked to shutdown";
1140  }
1141 
1142  if(too_many_fds || shutdown_flag || (child_failed && (num_children_done != childrenIds.size()))) {
1143  LogInfo("ForkingStopping") << "must stop children" << std::endl;
1144  for(std::vector<pid_t>::iterator it = childrenIds.begin(), itEnd = childrenIds.end();
1145  it != itEnd; ++it) {
1146  /* int result = */ kill(*it, SIGUSR2);
1147  }
1148  pthread_sigmask(SIG_BLOCK, &blockingSigSet, &oldSigSet);
1149  while(num_children_done != kMaxChildren) {
1150  sigsuspend(&unblockingSigSet);
1151  }
1152  pthread_sigmask(SIG_SETMASK, &oldSigSet, NULL);
1153  }
1154  // The senderThread will notice the pipes die off, one by one. Once all children are gone, it will exit.
1155  senderThread.join();
1156  if(child_failed && !continueAfterChildFailure_) {
1157  if (child_fail_signal) {
1158  throw cms::Exception("ForkedChildFailed") << "child process ended abnormally with signal " << child_fail_signal;
1159  } else if (child_fail_exit_status) {
1160  throw cms::Exception("ForkedChildFailed") << "child process ended abnormally with exit code " << child_fail_exit_status;
1161  } else {
1162  throw cms::Exception("ForkedChildFailed") << "child process ended abnormally for unknown reason";
1163  }
1164  }
1165  if(too_many_fds) {
1166  throw cms::Exception("ForkedParentFailed") << "hit select limit for number of fds";
1167  }
1168  return false;
1169  }
unsigned int numberOfSequentialEventsPerChild_
virtual char const * what() const
Definition: Exception.cc:141
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
void possiblyContinueAfterForkChildFailure()
def pipe
Definition: pipe.py:5
boost::shared_ptr< ActivityRegistry > actReg_
#define NULL
Definition: scimark2.h:8
volatile std::atomic< bool > shutdown_flag
void installCustomHandler(int signum, CFUNC func)
std::set< std::pair< std::string, std::string > > ExcludedData
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
virtual void readFile()
ServiceToken serviceToken_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
std::auto_ptr< Schedule > schedule_
std::unique_ptr< InputSource > input_
#define O_NONBLOCK
Definition: SysFile.h:21
std::unique_ptr< eventsetup::EventSetupsController > espController_
std::vector< ModuleDescription const * > edm::EventProcessor::getAllModuleDescriptions ( ) const

Return a vector allowing const access to all the ModuleDescriptions for this EventProccessor. *** N.B. *** Ownership of the ModuleDescriptions is not *** passed to the caller. Do not call delete on these *** pointers!

Definition at line 1172 of file EventProcessor.cc.

1172  {
1173  return schedule_->getAllModuleDescriptions();
1174  }
std::auto_ptr< Schedule > schedule_
ServiceToken edm::EventProcessor::getToken ( )

Definition at line 642 of file EventProcessor.cc.

References serviceToken_.

Referenced by ~EventProcessor().

642  {
643  return serviceToken_;
644  }
ServiceToken serviceToken_
void edm::EventProcessor::getTriggerReport ( TriggerReport rep) const

Return the trigger report information on paths, modules-in-path, modules-in-endpath, and modules.

Definition at line 1202 of file EventProcessor.cc.

1202  {
1203  schedule_->getTriggerReport(rep);
1204  }
string rep
Definition: cuy.py:1188
std::auto_ptr< Schedule > schedule_
bool edm::EventProcessor::hasSubProcess ( ) const
inlineprivate

Definition at line 227 of file EventProcessor.h.

References subProcess_.

Referenced by beginJob(), and endJob().

227  {
228  return subProcess_.get() != 0;
229  }
std::auto_ptr< SubProcess > subProcess_
void edm::EventProcessor::init ( boost::shared_ptr< ProcessDesc > &  processDesc,
ServiceToken const &  token,
serviceregistry::ServiceLegacy  iLegacy 
)
private

Definition at line 375 of file EventProcessor.cc.

References edm::ScheduleItems::act_table_, act_table_, edm::ScheduleItems::actReg_, actReg_, edm::ScheduleItems::addCPRandTNS(), edm::ScheduleItems::branchIDListHelper_, branchIDListHelper_, continueAfterChildFailure_, emptyRunLumiMode_, esp_, espController_, eventSetupDataToExcludeFromPrefetching_, FDEBUG, fileMode_, edm::fillLooper(), forceESCacheClearOnNewRun_, edm::ParameterSet::getUntrackedParameter(), edm::ParameterSet::getUntrackedParameterSet(), edm::ParameterSet::getUntrackedParameterSetVector(), historyAppender_, getHLTprescales::index, edm::ScheduleItems::initMisc(), edm::ScheduleItems::initSchedule(), edm::ScheduleItems::initServices(), input_, edm::eventsetup::heterocontainer::insert(), edm::PrincipalCache::insert(), edm::ParentageRegistry::insertMapped(), edm::ParentageRegistry::instance(), edm::serviceregistry::kConfigurationOverrides, looper_, edm::makeInput(), numberOfForkedChildren_, numberOfSequentialEventsPerChild_, edm::PreallocationConfiguration::numberOfStreams(), cmsPerfStripChart::operate(), edm::parameterSet(), edm::popSubProcessParameterSet(), preallocations_, edm::ScheduleItems::preg_, preg_, principalCache_, edm::ScheduleItems::processConfiguration_, processConfiguration_, processContext_, edm::ParameterSet::registerIt(), schedule_, serviceToken_, setCpuAffinity_, edm::PrincipalCache::setNumberOfConcurrentPrincipals(), edm::ProcessContext::setProcessConfiguration(), edm::PrincipalCache::setProcessHistoryRegistry(), edm::IllegalParameters::setThrowAnException(), AlCaHLTBitMon_QueryRunRegistry::string, and subProcess_.

Referenced by EventProcessor().

377  {
378 
379  //std::cerr << processDesc->dump() << std::endl;
380 
381  ROOT::Cintex::Cintex::Enable();
382 
383  // register the empty parentage vector , once and for all
385 
386  // register the empty parameter set, once and for all.
387  ParameterSet().registerIt();
388 
389  boost::shared_ptr<ParameterSet> parameterSet = processDesc->getProcessPSet();
390  //std::cerr << parameterSet->dump() << std::endl;
391 
392  // If there is a subprocess, pop the subprocess parameter set out of the process parameter set
393  boost::shared_ptr<ParameterSet> subProcessParameterSet(popSubProcessParameterSet(*parameterSet).release());
394 
395  // Now set some parameters specific to the main process.
396  ParameterSet const& optionsPset(parameterSet->getUntrackedParameterSet("options", ParameterSet()));
397  fileMode_ = optionsPset.getUntrackedParameter<std::string>("fileMode", "");
398  emptyRunLumiMode_ = optionsPset.getUntrackedParameter<std::string>("emptyRunLumiMode", "");
399  forceESCacheClearOnNewRun_ = optionsPset.getUntrackedParameter<bool>("forceEventSetupCacheClearOnNewRun", false);
400  //threading
401  unsigned int nThreads=1;
402  if(optionsPset.existsAs<unsigned int>("numberOfThreads",false)) {
403  nThreads = optionsPset.getUntrackedParameter<unsigned int>("numberOfThreads");
404  if(nThreads == 0) {
405  nThreads = 1;
406  }
407  }
408  /* TODO: when we support having each stream run in a different thread use this default
409  unsigned int nStreams =nThreads;
410  */
411  unsigned int nStreams =1;
412  if(optionsPset.existsAs<unsigned int>("numberOfStreams",false)) {
413  nStreams = optionsPset.getUntrackedParameter<unsigned int>("numberOfStreams");
414  if(nStreams==0) {
415  nStreams = nThreads;
416  }
417  }
418  /*
419  bool nRunsSet = false;
420  */
421  unsigned int nConcurrentRuns =1;
422  /*
423  if(nRunsSet = optionsPset.existsAs<unsigned int>("numberOfConcurrentRuns",false)) {
424  nConcurrentRuns = optionsPset.getUntrackedParameter<unsigned int>("numberOfConcurrentRuns");
425  }
426  */
427  unsigned int nConcurrentLumis =1;
428  /*
429  if(optionsPset.existsAs<unsigned int>("numberOfConcurrentLuminosityBlocks",false)) {
430  nConcurrentLumis = optionsPset.getUntrackedParameter<unsigned int>("numberOfConcurrentLuminosityBlocks");
431  } else {
432  nConcurrentLumis = nConcurrentRuns;
433  }
434  */
435  //Check that relationships between threading parameters makes sense
436  /*
437  if(nThreads<nStreams) {
438  //bad
439  }
440  if(nConcurrentRuns>nStreams) {
441  //bad
442  }
443  if(nConcurrentRuns>nConcurrentLumis) {
444  //bad
445  }
446  */
447  //forking
448  ParameterSet const& forking = optionsPset.getUntrackedParameterSet("multiProcesses", ParameterSet());
449  numberOfForkedChildren_ = forking.getUntrackedParameter<int>("maxChildProcesses", 0);
450  numberOfSequentialEventsPerChild_ = forking.getUntrackedParameter<unsigned int>("maxSequentialEventsPerChild", 1);
451  setCpuAffinity_ = forking.getUntrackedParameter<bool>("setCpuAffinity", false);
452  continueAfterChildFailure_ = forking.getUntrackedParameter<bool>("continueAfterChildFailure",false);
453  std::vector<ParameterSet> const& excluded = forking.getUntrackedParameterSetVector("eventSetupDataToExcludeFromPrefetching", std::vector<ParameterSet>());
454  for(std::vector<ParameterSet>::const_iterator itPS = excluded.begin(), itPSEnd = excluded.end();
455  itPS != itPSEnd;
456  ++itPS) {
457  eventSetupDataToExcludeFromPrefetching_[itPS->getUntrackedParameter<std::string>("record")].insert(
458  std::make_pair(itPS->getUntrackedParameter<std::string>("type", "*"),
459  itPS->getUntrackedParameter<std::string>("label", "")));
460  }
461  IllegalParameters::setThrowAnException(optionsPset.getUntrackedParameter<bool>("throwIfIllegalParameter", true));
462 
463  // Now do general initialization
464  ScheduleItems items;
465 
466  //initialize the services
467  boost::shared_ptr<std::vector<ParameterSet> > pServiceSets = processDesc->getServicesPSets();
468  ServiceToken token = items.initServices(*pServiceSets, *parameterSet, iToken, iLegacy, true);
469  serviceToken_ = items.addCPRandTNS(*parameterSet, token);
470 
471  //make the services available
473 
474  // intialize miscellaneous items
475  boost::shared_ptr<CommonParams> common(items.initMisc(*parameterSet));
476 
477  // intialize the event setup provider
478  esp_ = espController_->makeProvider(*parameterSet);
479 
480  // initialize the looper, if any
481  looper_ = fillLooper(*espController_, *esp_, *parameterSet);
482  if(looper_) {
483  looper_->setActionTable(items.act_table_.get());
484  looper_->attachTo(*items.actReg_);
485 
486  //For now loopers make us run only 1 transition at a time
487  nStreams=1;
488  nConcurrentLumis=1;
489  nConcurrentRuns=1;
490  }
491 
492  preallocations_ = PreallocationConfiguration{nThreads,nStreams,nConcurrentLumis,nConcurrentRuns};
493 
494  // initialize the input source
495  input_ = makeInput(*parameterSet, *common, *items.preg_, items.branchIDListHelper_, items.actReg_, items.processConfiguration_, preallocations_);
496 
497  // intialize the Schedule
498  schedule_ = items.initSchedule(*parameterSet,subProcessParameterSet.get(),preallocations_,&processContext_);
499 
500  // set the data members
501  act_table_ = std::move(items.act_table_);
502  actReg_ = items.actReg_;
503  preg_.reset(items.preg_.release());
504  branchIDListHelper_ = items.branchIDListHelper_;
505  processConfiguration_ = items.processConfiguration_;
507  principalCache_.setProcessHistoryRegistry(input_->processHistoryRegistry());
508 
509  FDEBUG(2) << parameterSet << std::endl;
510 
512  for(unsigned int index = 0; index<preallocations_.numberOfStreams(); ++index ) {
513  // Reusable event principal
514  boost::shared_ptr<EventPrincipal> ep(new EventPrincipal(preg_,
517  historyAppender_.get(),
518  index));
519  ep->preModuleDelayedGetSignal_.connect(std::cref(actReg_->preModuleEventDelayedGetSignal_));
520  ep->postModuleDelayedGetSignal_.connect(std::cref(actReg_->postModuleEventDelayedGetSignal_));
522  }
523  // initialize the subprocess, if there is one
524  if(subProcessParameterSet) {
525  subProcess_.reset(new SubProcess(*subProcessParameterSet,
526  *parameterSet,
527  preg_,
530  *actReg_,
531  token,
534  &processContext_));
535  }
536  }
std::string emptyRunLumiMode_
unsigned int numberOfSequentialEventsPerChild_
ProcessContext processContext_
void setNumberOfConcurrentPrincipals(PreallocationConfiguration const &)
std::unique_ptr< ExceptionToActionTable const > act_table_
std::auto_ptr< ParameterSet > popSubProcessParameterSet(ParameterSet &parameterSet)
Definition: SubProcess.cc:540
boost::shared_ptr< EDLooperBase > looper_
std::unique_ptr< InputSource > makeInput(ParameterSet &params, CommonParams const &common, ProductRegistry &preg, boost::shared_ptr< BranchIDListHelper > branchIDListHelper, boost::shared_ptr< ActivityRegistry > areg, boost::shared_ptr< ProcessConfiguration const > processConfiguration, PreallocationConfiguration const &allocations)
boost::shared_ptr< ActivityRegistry > actReg_
void insert(boost::shared_ptr< RunPrincipal > rp)
#define FDEBUG(lev)
Definition: DebugMacros.h:18
PreallocationConfiguration preallocations_
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
ServiceToken serviceToken_
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
ExcludedDataMap eventSetupDataToExcludeFromPrefetching_
static void setThrowAnException(bool v)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
std::auto_ptr< Schedule > schedule_
void setProcessConfiguration(ProcessConfiguration const *processConfiguration)
boost::shared_ptr< ProductRegistry const > preg_
void setProcessHistoryRegistry(ProcessHistoryRegistry const &phr)
std::unique_ptr< InputSource > input_
std::auto_ptr< SubProcess > subProcess_
boost::shared_ptr< EDLooperBase > fillLooper(eventsetup::EventSetupsController &esController, eventsetup::EventSetupProvider &cp, ParameterSet &params)
std::unique_ptr< eventsetup::EventSetupsController > espController_
static ParentageRegistry * instance()
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
bool insertMapped(value_type const &v)
ParameterSet const & parameterSet(Provenance const &provenance)
Definition: Provenance.cc:11
PrincipalCache principalCache_
void edm::EventProcessor::openOutputFiles ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1462 of file EventProcessor.cc.

References FDEBUG.

1462  {
1463  if (fb_.get() != nullptr) {
1464  schedule_->openOutputFiles(*fb_);
1465  if(hasSubProcess()) subProcess_->openOutputFiles(*fb_);
1466  }
1467  FDEBUG(1) << "\topenOutputFiles\n";
1468  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< FileBlock > fb_
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
EventProcessor& edm::EventProcessor::operator= ( EventProcessor const &  )
delete
void edm::EventProcessor::possiblyContinueAfterForkChildFailure ( )
private

Definition at line 855 of file EventProcessor.cc.

855  {
856  if(child_failed && continueAfterChildFailure_) {
857  if (child_fail_signal) {
858  LogSystem("ForkedChildFailed") << "child process ended abnormally with signal " << child_fail_signal;
859  child_fail_signal=0;
860  } else if (child_fail_exit_status) {
861  LogSystem("ForkedChildFailed") << "child process ended abnormally with exit code " << child_fail_exit_status;
862  child_fail_exit_status=0;
863  } else {
864  LogSystem("ForkedChildFailed") << "child process ended abnormally for unknown reason";
865  }
866  child_failed =false;
867  }
868  }
void edm::EventProcessor::prepareForNextLoop ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1523 of file EventProcessor.cc.

References FDEBUG.

1523  {
1524  looper_->prepareForNextLoop(esp_.get());
1525  FDEBUG(1) << "\tprepareForNextLoop\n";
1526  }
boost::shared_ptr< EDLooperBase > looper_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
void edm::EventProcessor::processEvent ( unsigned int  iStreamIndex)
private

Definition at line 1812 of file EventProcessor.cc.

References FDEBUG, edm::ProcessingController::lastOperationSucceeded(), edm::ProcessingController::requestedTransition(), edm::ProcessingController::setLastOperationSucceeded(), edm::ProcessingController::specifiedEventTransition(), ntuplemaker::status, and summarizeEdmComparisonLogfiles::succeeded.

1812  {
1813  auto pep = &(principalCache_.eventPrincipal(iStreamIndex));
1814  pep->setLuminosityBlockPrincipal(principalCache_.lumiPrincipalPtr());
1815  assert(pep->luminosityBlockPrincipalPtrValid());
1816  assert(principalCache_.lumiPrincipalPtr()->run() == pep->run());
1817  assert(principalCache_.lumiPrincipalPtr()->luminosityBlock() == pep->luminosityBlock());
1818 
1819  //We can only update IOVs on Lumi boundaries
1820  //IOVSyncValue ts(pep->id(), pep->time());
1821  //espController_->eventSetupForInstance(ts);
1822  EventSetup const& es = esp_->eventSetup();
1823  {
1824  typedef OccurrenceTraits<EventPrincipal, BranchActionStreamBegin> Traits;
1825  schedule_->processOneEvent<Traits>(iStreamIndex,*pep, es);
1826  if(hasSubProcess()) {
1827  subProcess_->doEvent(*pep);
1828  }
1829  }
1830 
1831  //NOTE: If we have a looper we only have one Stream
1832  if(looper_) {
1833  bool randomAccess = input_->randomAccess();
1834  ProcessingController::ForwardState forwardState = input_->forwardState();
1835  ProcessingController::ReverseState reverseState = input_->reverseState();
1836  ProcessingController pc(forwardState, reverseState, randomAccess);
1837 
1839  do {
1840 
1841  StreamContext streamContext(pep->streamID(), &processContext_);
1842  status = looper_->doDuringLoop(*pep, esp_->eventSetup(), pc, &streamContext);
1843 
1844  bool succeeded = true;
1845  if(randomAccess) {
1846  if(pc.requestedTransition() == ProcessingController::kToPreviousEvent) {
1847  input_->skipEvents(-2);
1848  }
1849  else if(pc.requestedTransition() == ProcessingController::kToSpecifiedEvent) {
1850  succeeded = input_->goToEvent(pc.specifiedEventTransition());
1851  }
1852  }
1853  pc.setLastOperationSucceeded(succeeded);
1854  } while(!pc.lastOperationSucceeded());
1855  if(status != EDLooperBase::kContinue) shouldWeStop_ = true;
1856 
1857  }
1858 
1859  FDEBUG(1) << "\tprocessEvent\n";
1860  pep->clearEventPrincipal();
1861  }
ProcessContext processContext_
boost::shared_ptr< EDLooperBase > looper_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
boost::shared_ptr< eventsetup::EventSetupProvider > esp_
boost::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
std::auto_ptr< Schedule > schedule_
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
std::unique_ptr< InputSource > input_
std::auto_ptr< SubProcess > subProcess_
tuple status
Definition: ntuplemaker.py:245
PrincipalCache principalCache_
bool hasSubProcess() const
int edm::EventProcessor::readAndMergeLumi ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1746 of file EventProcessor.cc.

1746  {
1747  principalCache_.merge(input_->luminosityBlockAuxiliary(), preg_);
1748  input_->readAndMergeLumi(*principalCache_.lumiPrincipalPtr());
1749  return input_->luminosityBlock();
1750  }
void merge(boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
boost::shared_ptr< LuminosityBlockPrincipal > const & lumiPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
PrincipalCache principalCache_
statemachine::Run edm::EventProcessor::readAndMergeRun ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1713 of file EventProcessor.cc.

References PDRates::Run.

1713  {
1714  principalCache_.merge(input_->runAuxiliary(), preg_);
1715  auto runPrincipal =principalCache_.runPrincipalPtr();
1716  input_->readAndMergeRun(*runPrincipal);
1717  assert(input_->reducedProcessHistoryID() == runPrincipal->reducedProcessHistoryID());
1718  return statemachine::Run(runPrincipal->reducedProcessHistoryID(), input_->run());
1719  }
void merge(boost::shared_ptr< RunAuxiliary > aux, boost::shared_ptr< ProductRegistry const > reg)
boost::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
PrincipalCache principalCache_
void edm::EventProcessor::readAndProcessEvent ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1776 of file EventProcessor.cc.

References processEvent().

1776  {
1777  if(numberOfForkedChildren_>0) {
1778  readEvent(0);
1779  processEvent(0);
1780  return;
1781  }
1783 
1784  //While all the following item types are isEvent, process them right here
1786 
1787  //We will round-robin which stream to use
1788  unsigned int nextStreamIndex=0;
1789  const unsigned int kNumStreams = preallocations_.numberOfStreams();
1790  do {
1791  readEvent(nextStreamIndex);
1792  processEvent(nextStreamIndex);
1793  nextStreamIndex = (nextStreamIndex+1) % kNumStreams;
1794 
1795  if(shouldWeStop()) {
1796  break;
1797  }
1798  itemType = input_->nextItemType();
1800  break;
1801  }
1802  } while (itemType == InputSource::IsEvent);
1804  }
void readEvent(unsigned int iStreamIndex)
bool checkForAsyncStopRequest(StatusCode &)
PreallocationConfiguration preallocations_
InputSource::ItemType nextItemTypeFromProcessingEvents_
void processEvent(unsigned int iStreamIndex)
StatusCode asyncStopStatusCodeFromProcessingEvents_
std::unique_ptr< InputSource > input_
bool asyncStopRequestedWhileProcessingEvents_
virtual bool shouldWeStop() const
void edm::EventProcessor::readEvent ( unsigned int  iStreamIndex)
private

Definition at line 1805 of file EventProcessor.cc.

References event(), and FDEBUG.

1805  {
1806  //TODO this will have to become per stream
1807  auto& event = principalCache_.eventPrincipal(iStreamIndex);
1808  StreamContext streamContext(event.streamID(), &processContext_);
1809  input_->readEvent(event, streamContext);
1810  FDEBUG(1) << "\treadEvent\n";
1811  }
ProcessContext processContext_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
EventPrincipal & eventPrincipal(unsigned int iStreamIndex) const
std::unique_ptr< InputSource > input_
PrincipalCache principalCache_
void edm::EventProcessor::readFile ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1442 of file EventProcessor.cc.

References FDEBUG, and findQualityFiles::size.

Referenced by Vispa.Plugins.EventBrowser.EventBrowserTabController.EventBrowserTabController::navigate(), Vispa.Main.TabController.TabController::open(), and Vispa.Main.TabController.TabController::refresh().

1442  {
1443  FDEBUG(1) << " \treadFile\n";
1444  size_t size = preg_->size();
1445  fb_ = input_->readFile();
1446  if(size < preg_->size()) {
1448  }
1450  if(numberOfForkedChildren_ > 0) {
1451  fb_->setNotFastClonable(FileBlock::ParallelProcesses);
1452  }
1453  }
void adjustIndexesAfterProductRegistryAddition()
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void adjustEventsToNewProductRegistry(boost::shared_ptr< ProductRegistry const > reg)
std::unique_ptr< FileBlock > fb_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
tuple size
Write out results.
PrincipalCache principalCache_
int edm::EventProcessor::readLuminosityBlock ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1721 of file EventProcessor.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

1721  {
1724  << "EventProcessor::readRun\n"
1725  << "Illegal attempt to insert lumi into cache\n"
1726  << "Contact a Framework Developer\n";
1727  }
1730  << "EventProcessor::readRun\n"
1731  << "Illegal attempt to insert lumi into cache\n"
1732  << "Run is invalid\n"
1733  << "Contact a Framework Developer\n";
1734  }
1735  boost::shared_ptr<LuminosityBlockPrincipal> lbp(new LuminosityBlockPrincipal(input_->luminosityBlockAuxiliary(),
1736  preg_,
1738  historyAppender_.get(),
1739  0));
1740  input_->readLuminosityBlock(*lbp, *historyAppender_);
1741  lbp->setRunPrincipal(principalCache_.runPrincipalPtr());
1742  principalCache_.insert(lbp);
1743  return input_->luminosityBlock();
1744  }
bool hasRunPrincipal() const
void insert(boost::shared_ptr< RunPrincipal > rp)
boost::shared_ptr< RunPrincipal > const & runPrincipalPtr(ProcessHistoryID const &phid, RunNumber_t run) const
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
boost::shared_ptr< ProductRegistry const > preg_
bool hasLumiPrincipal() const
std::unique_ptr< InputSource > input_
PrincipalCache principalCache_
statemachine::Run edm::EventProcessor::readRun ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1695 of file EventProcessor.cc.

References edm::hlt::Exception, edm::errors::LogicError, and PDRates::Run.

1695  {
1698  << "EventProcessor::readRun\n"
1699  << "Illegal attempt to insert run into cache\n"
1700  << "Contact a Framework Developer\n";
1701  }
1702  boost::shared_ptr<RunPrincipal> rp(new RunPrincipal(input_->runAuxiliary(),
1703  preg_,
1705  historyAppender_.get(),
1706  0));
1707  input_->readRun(*rp, *historyAppender_);
1708  assert(input_->reducedProcessHistoryID() == rp->reducedProcessHistoryID());
1709  principalCache_.insert(rp);
1710  return statemachine::Run(rp->reducedProcessHistoryID(), input_->run());
1711  }
bool hasRunPrincipal() const
void insert(boost::shared_ptr< RunPrincipal > rp)
boost::shared_ptr< ProcessConfiguration const > processConfiguration_
std::unique_ptr< HistoryAppender > historyAppender_
boost::shared_ptr< ProductRegistry const > preg_
std::unique_ptr< InputSource > input_
PrincipalCache principalCache_
void edm::EventProcessor::respondToCloseInputFile ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1486 of file EventProcessor.cc.

References FDEBUG.

1486  {
1487  if (fb_.get() != nullptr) {
1488  schedule_->respondToCloseInputFile(*fb_);
1489  if(hasSubProcess()) subProcess_->respondToCloseInputFile(*fb_);
1490  }
1491  FDEBUG(1) << "\trespondToCloseInputFile\n";
1492  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< FileBlock > fb_
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
void edm::EventProcessor::respondToOpenInputFile ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1478 of file EventProcessor.cc.

References FDEBUG.

1478  {
1479  if (fb_.get() != nullptr) {
1480  schedule_->respondToOpenInputFile(*fb_);
1481  if(hasSubProcess()) subProcess_->respondToOpenInputFile(*fb_);
1482  }
1483  FDEBUG(1) << "\trespondToOpenInputFile\n";
1484  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< FileBlock > fb_
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
void edm::EventProcessor::rewindInput ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1517 of file EventProcessor.cc.

References FDEBUG.

1517  {
1518  input_->repeat();
1519  input_->rewind();
1520  FDEBUG(1) << "\trewind\n";
1521  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::unique_ptr< InputSource > input_
EventProcessor::StatusCode edm::EventProcessor::run ( void  )
inline

Definition at line 299 of file EventProcessor.h.

References runToCompletion().

Referenced by Types.EventID::cppID(), and Types.LuminosityBlockID::cppID().

299  {
300  return runToCompletion();
301  }
virtual StatusCode runToCompletion()
EventProcessor::StatusCode edm::EventProcessor::runToCompletion ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1257 of file EventProcessor.cc.

References cms::Exception::addAdditionalInfo(), cms::Exception::alreadyPrinted(), edm::convertException::badAllocToEDM(), bk::beginJob(), trackerHits::c, edm::convertException::charPtrToEDM(), alignCSCRings::e, cppFunctionSkipper::exception, edm::hlt::Exception, FDEBUG, edm::errors::LogicError, cmsPerfStripChart::operate(), runEdmFileComparison::returnCode, alignCSCRings::s, findQualityFiles::size, edm::convertException::stdToEDM(), AlCaHLTBitMon_QueryRunRegistry::string, edm::convertException::stringToEDM(), and edm::convertException::unknownToEDM().

Referenced by run().

1257  {
1258 
1261  std::auto_ptr<statemachine::Machine> machine;
1262  {
1263  beginJob(); //make sure this was called
1264 
1265  //StatusCode returnCode = epSuccess;
1267 
1268  // make the services available
1270 
1271  machine = createStateMachine();
1274  try {
1275  try {
1276 
1277  InputSource::ItemType itemType;
1278 
1279  while(true) {
1280 
1281  bool more = true;
1282  if(numberOfForkedChildren_ > 0) {
1283  size_t size = preg_->size();
1284  more = input_->skipForForking();
1285  if(more) {
1286  if(size < preg_->size()) {
1288  }
1290  }
1291  }
1292  itemType = (more ? input_->nextItemType() : InputSource::IsStop);
1293 
1294  FDEBUG(1) << "itemType = " << itemType << "\n";
1295 
1296  if(checkForAsyncStopRequest(returnCode)) {
1297  forceLooperToEnd_ = true;
1298  machine->process_event(statemachine::Stop());
1299  forceLooperToEnd_ = false;
1300  break;
1301  }
1302 
1303  if(itemType == InputSource::IsEvent) {
1304  machine->process_event(statemachine::Event());
1306  forceLooperToEnd_ = true;
1307  machine->process_event(statemachine::Stop());
1308  forceLooperToEnd_ = false;
1310  break;
1311  }
1313  }
1314 
1315  if(itemType == InputSource::IsEvent) {
1316  }
1317  else if(itemType == InputSource::IsStop) {
1318  machine->process_event(statemachine::Stop());
1319  }
1320  else if(itemType == InputSource::IsFile) {
1321  machine->process_event(statemachine::File());
1322  }
1323  else if(itemType == InputSource::IsRun) {
1324  machine->process_event(statemachine::Run(input_->reducedProcessHistoryID(), input_->run()));
1325  }
1326  else if(itemType == InputSource::IsLumi) {
1327  machine->process_event(statemachine::Lumi(input_->luminosityBlock()));
1328  }
1329  else if(itemType == InputSource::IsSynchronize) {
1330  //For now, we don't have to do anything
1331  }
1332  // This should be impossible
1333  else {
1335  << "Unknown next item type passed to EventProcessor\n"
1336  << "Please report this error to the Framework group\n";
1337  }
1338  if(machine->terminated()) {
1339  break;
1340  }
1341  } // End of loop over state machine events
1342  } // Try block
1343  catch (cms::Exception& e) { throw; }
1344  catch(std::bad_alloc& bda) { convertException::badAllocToEDM(); }
1345  catch (std::exception& e) { convertException::stdToEDM(e); }
1347  catch(char const* c) { convertException::charPtrToEDM(c); }
1348  catch (...) { convertException::unknownToEDM(); }
1349  } // Try block
1350  // Some comments on exception handling related to the boost state machine:
1351  //
1352  // Some states used in the machine are special because they
1353  // perform actions while the machine is being terminated, actions
1354  // such as close files, call endRun, call endLumi etc ... Each of these
1355  // states has two functions that perform these actions. The functions
1356  // are almost identical. The major difference is that one version
1357  // catches all exceptions and the other lets exceptions pass through.
1358  // The destructor catches them and the other function named "exit" lets
1359  // them pass through. On a normal termination, boost will always call
1360  // "exit" and then the state destructor. In our state classes, the
1361  // the destructors do nothing if the exit function already took
1362  // care of things. Here's the interesting part. When boost is
1363  // handling an exception the "exit" function is not called (a boost
1364  // feature).
1365  //
1366  // If an exception occurs while the boost machine is in control
1367  // (which usually means inside a process_event call), then
1368  // the boost state machine destroys its states and "terminates" itself.
1369  // This already done before we hit the catch blocks below. In this case
1370  // the call to terminateMachine below only destroys an already
1371  // terminated state machine. Because exit is not called, the state destructors
1372  // handle cleaning up lumis, runs, and files. The destructors swallow
1373  // all exceptions and only pass through the exceptions messages, which
1374  // are tacked onto the original exception below.
1375  //
1376  // If an exception occurs when the boost state machine is not
1377  // in control (outside the process_event functions), then boost
1378  // cannot destroy its own states. The terminateMachine function
1379  // below takes care of that. The flag "alreadyHandlingException"
1380  // is set true so that the state exit functions do nothing (and
1381  // cannot throw more exceptions while handling the first). Then the
1382  // state destructors take care of this because exit did nothing.
1383  //
1384  // In both cases above, the EventProcessor::endOfLoop function is
1385  // not called because it can throw exceptions.
1386  //
1387  // One tricky aspect of the state machine is that things that can
1388  // throw should not be invoked by the state machine while another
1389  // exception is being handled.
1390  // Another tricky aspect is that it appears to be important to
1391  // terminate the state machine before invoking its destructor.
1392  // We've seen crashes that are not understood when that is not
1393  // done. Maintainers of this code should be careful about this.
1394 
1395  catch (cms::Exception & e) {
1397  terminateMachine(machine);
1398  alreadyHandlingException_ = false;
1399  if (!exceptionMessageLumis_.empty()) {
1401  if (e.alreadyPrinted()) {
1402  LogAbsolute("Additional Exceptions") << exceptionMessageLumis_;
1403  }
1404  }
1405  if (!exceptionMessageRuns_.empty()) {
1407  if (e.alreadyPrinted()) {
1408  LogAbsolute("Additional Exceptions") << exceptionMessageRuns_;
1409  }
1410  }
1411  if (!exceptionMessageFiles_.empty()) {
1413  if (e.alreadyPrinted()) {
1414  LogAbsolute("Additional Exceptions") << exceptionMessageFiles_;
1415  }
1416  }
1417  throw;
1418  }
1419 
1420  if(machine->terminated()) {
1421  FDEBUG(1) << "The state machine reports it has been terminated\n";
1422  machine.reset();
1423  }
1424 
1426  throw cms::Exception("BadState")
1427  << "The boost state machine in the EventProcessor exited after\n"
1428  << "entering the Error state.\n";
1429  }
1430 
1431  }
1432  if(machine.get() != 0) {
1433  terminateMachine(machine);
1435  << "State machine not destroyed on exit from EventProcessor::runToCompletion\n"
1436  << "Please report this error to the Framework group\n";
1437  }
1438 
1439  return returnCode;
1440  }
bool checkForAsyncStopRequest(StatusCode &)
std::auto_ptr< statemachine::Machine > createStateMachine()
void adjustIndexesAfterProductRegistryAddition()
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::string exceptionMessageRuns_
bool alreadyPrinted() const
Definition: Exception.cc:251
void adjustEventsToNewProductRegistry(boost::shared_ptr< ProductRegistry const > reg)
void terminateMachine(std::auto_ptr< statemachine::Machine > &)
ServiceToken serviceToken_
std::string exceptionMessageLumis_
void stdToEDM(std::exception const &e)
InputSource::ItemType nextItemTypeFromProcessingEvents_
void addAdditionalInfo(std::string const &info)
Definition: Exception.cc:235
std::string exceptionMessageFiles_
boost::shared_ptr< ProductRegistry const > preg_
void charPtrToEDM(char const *c)
StatusCode asyncStopStatusCodeFromProcessingEvents_
void stringToEDM(std::string &s)
std::unique_ptr< InputSource > input_
bool asyncStopRequestedWhileProcessingEvents_
tuple size
Write out results.
PrincipalCache principalCache_
void edm::EventProcessor::setExceptionMessageFiles ( std::string &  message)
virtual

Implements edm::IEventProcessor.

Definition at line 1869 of file EventProcessor.cc.

References python.rootplot.argparse::message.

1869  {
1871  }
std::string exceptionMessageFiles_
void edm::EventProcessor::setExceptionMessageLumis ( std::string &  message)
virtual

Implements edm::IEventProcessor.

Definition at line 1877 of file EventProcessor.cc.

References python.rootplot.argparse::message.

1877  {
1879  }
std::string exceptionMessageLumis_
void edm::EventProcessor::setExceptionMessageRuns ( std::string &  message)
virtual

Implements edm::IEventProcessor.

Definition at line 1873 of file EventProcessor.cc.

References python.rootplot.argparse::message.

1873  {
1875  }
std::string exceptionMessageRuns_
void edm::EventProcessor::setupSignal ( )
private
bool edm::EventProcessor::shouldWeCloseOutput ( ) const
virtual

Implements edm::IEventProcessor.

Definition at line 1528 of file EventProcessor.cc.

References FDEBUG.

1528  {
1529  FDEBUG(1) << "\tshouldWeCloseOutput\n";
1530  return hasSubProcess() ? subProcess_->shouldWeCloseOutput() : schedule_->shouldWeCloseOutput();
1531  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
bool edm::EventProcessor::shouldWeStop ( ) const
virtual

Implements edm::IEventProcessor.

Definition at line 1863 of file EventProcessor.cc.

References FDEBUG.

1863  {
1864  FDEBUG(1) << "\tshouldWeStop\n";
1865  if(shouldWeStop_) return true;
1866  return (schedule_->terminate() || (hasSubProcess() && subProcess_->terminate()));
1867  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
bool hasSubProcess() const
void edm::EventProcessor::startingNewLoop ( )
virtual

Implements edm::IEventProcessor.

Definition at line 1494 of file EventProcessor.cc.

References FDEBUG.

1494  {
1495  shouldWeStop_ = false;
1496  //NOTE: for first loop, need to delay calling 'doStartingNewLoop'
1497  // until after we've called beginOfJob
1498  if(looper_ && looperBeginJobRun_) {
1499  looper_->doStartingNewLoop();
1500  }
1501  FDEBUG(1) << "\tstartingNewLoop\n";
1502  }
boost::shared_ptr< EDLooperBase > looper_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void edm::EventProcessor::terminateMachine ( std::auto_ptr< statemachine::Machine > &  iMachine)
private

Definition at line 1885 of file EventProcessor.cc.

References FDEBUG.

1885  {
1886  if(iMachine.get() != 0) {
1887  if(!iMachine->terminated()) {
1888  forceLooperToEnd_ = true;
1889  iMachine->process_event(statemachine::Stop());
1890  forceLooperToEnd_ = false;
1891  }
1892  else {
1893  FDEBUG(1) << "EventProcess::terminateMachine The state machine was already terminated \n";
1894  }
1895  if(iMachine->terminated()) {
1896  FDEBUG(1) << "The state machine reports it has been terminated (3)\n";
1897  }
1898  iMachine.reset();
1899  }
1900  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
int edm::EventProcessor::totalEvents ( ) const

Return the number of events this EventProcessor has tried to process (inclues both successes and failures, including failures due to exceptions during processing).

Definition at line 1177 of file EventProcessor.cc.

1177  {
1178  return schedule_->totalEvents();
1179  }
std::auto_ptr< Schedule > schedule_
int edm::EventProcessor::totalEventsFailed ( ) const

Return the number of events that have not passed any trigger. (N.B. totalEventsFailed() + totalEventsPassed() == totalEvents()

Definition at line 1187 of file EventProcessor.cc.

1187  {
1188  return schedule_->totalEventsFailed();
1189  }
std::auto_ptr< Schedule > schedule_
int edm::EventProcessor::totalEventsPassed ( ) const

Return the number of events processed by this EventProcessor which have been passed by one or more trigger paths.

Definition at line 1182 of file EventProcessor.cc.

1182  {
1183  return schedule_->totalEventsPassed();
1184  }
std::auto_ptr< Schedule > schedule_
void edm::EventProcessor::writeLumi ( ProcessHistoryID const &  phid,
RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)
virtual

Implements edm::IEventProcessor.

Definition at line 1764 of file EventProcessor.cc.

References FDEBUG.

1764  {
1766  if(hasSubProcess()) subProcess_->writeLumi(phid, run, lumi);
1767  FDEBUG(1) << "\twriteLumi " << run << "/" << lumi << "\n";
1768  }
ProcessContext processContext_
tuple lumi
Definition: fjr2json.py:35
LuminosityBlockPrincipal & lumiPrincipal(ProcessHistoryID const &phid, RunNumber_t run, LuminosityBlockNumber_t lumi) const
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
PrincipalCache principalCache_
bool hasSubProcess() const
void edm::EventProcessor::writeRun ( statemachine::Run const &  run)
virtual

Implements edm::IEventProcessor.

Definition at line 1752 of file EventProcessor.cc.

References FDEBUG, statemachine::Run::processHistoryID(), and statemachine::Run::runNumber().

1752  {
1753  schedule_->writeRun(principalCache_.runPrincipal(run.processHistoryID(), run.runNumber()), &processContext_);
1754  if(hasSubProcess()) subProcess_->writeRun(run.processHistoryID(), run.runNumber());
1755  FDEBUG(1) << "\twriteRun " << run.runNumber() << "\n";
1756  }
ProcessContext processContext_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::auto_ptr< Schedule > schedule_
std::auto_ptr< SubProcess > subProcess_
PrincipalCache principalCache_
bool hasSubProcess() const
RunPrincipal & runPrincipal(ProcessHistoryID const &phid, RunNumber_t run) const

Member Data Documentation

std::unique_ptr<ExceptionToActionTable const> edm::EventProcessor::act_table_
private

Definition at line 255 of file EventProcessor.h.

Referenced by init().

boost::shared_ptr<ActivityRegistry> edm::EventProcessor::actReg_
private

Definition at line 248 of file EventProcessor.h.

Referenced by beginJob(), endJob(), init(), and ~EventProcessor().

bool edm::EventProcessor::alreadyHandlingException_
private

Definition at line 274 of file EventProcessor.h.

bool edm::EventProcessor::asyncStopRequestedWhileProcessingEvents_
private

Definition at line 286 of file EventProcessor.h.

StatusCode edm::EventProcessor::asyncStopStatusCodeFromProcessingEvents_
private

Definition at line 288 of file EventProcessor.h.

bool edm::EventProcessor::beginJobCalled_
private

Definition at line 266 of file EventProcessor.h.

Referenced by beginJob().

boost::shared_ptr<BranchIDListHelper> edm::EventProcessor::branchIDListHelper_
private

Definition at line 250 of file EventProcessor.h.

Referenced by init().

bool edm::EventProcessor::continueAfterChildFailure_
private

Definition at line 282 of file EventProcessor.h.

Referenced by init().

std::string edm::EventProcessor::emptyRunLumiMode_
private

Definition at line 270 of file EventProcessor.h.

Referenced by init().

boost::shared_ptr<eventsetup::EventSetupProvider> edm::EventProcessor::esp_
private

Definition at line 254 of file EventProcessor.h.

Referenced by init(), and ~EventProcessor().

std::unique_ptr<eventsetup::EventSetupsController> edm::EventProcessor::espController_
private

Definition at line 253 of file EventProcessor.h.

Referenced by init(), and ~EventProcessor().

ExcludedDataMap edm::EventProcessor::eventSetupDataToExcludeFromPrefetching_
private

Definition at line 292 of file EventProcessor.h.

Referenced by init().

std::string edm::EventProcessor::exceptionMessageFiles_
private

Definition at line 271 of file EventProcessor.h.

std::string edm::EventProcessor::exceptionMessageLumis_
private

Definition at line 273 of file EventProcessor.h.

std::string edm::EventProcessor::exceptionMessageRuns_
private

Definition at line 272 of file EventProcessor.h.

std::unique_ptr<FileBlock> edm::EventProcessor::fb_
private

Definition at line 262 of file EventProcessor.h.

std::string edm::EventProcessor::fileMode_
private

Definition at line 269 of file EventProcessor.h.

Referenced by init().

bool edm::EventProcessor::forceESCacheClearOnNewRun_
private

Definition at line 277 of file EventProcessor.h.

Referenced by init().

bool edm::EventProcessor::forceLooperToEnd_
private

Definition at line 275 of file EventProcessor.h.

std::unique_ptr<HistoryAppender> edm::EventProcessor::historyAppender_
private

Definition at line 260 of file EventProcessor.h.

Referenced by init().

std::unique_ptr<InputSource> edm::EventProcessor::input_
private

Definition at line 252 of file EventProcessor.h.

Referenced by beginJob(), endJob(), init(), and ~EventProcessor().

boost::shared_ptr<EDLooperBase> edm::EventProcessor::looper_
private
bool edm::EventProcessor::looperBeginJobRun_
private

Definition at line 276 of file EventProcessor.h.

InputSource::ItemType edm::EventProcessor::nextItemTypeFromProcessingEvents_
private

Definition at line 287 of file EventProcessor.h.

int edm::EventProcessor::numberOfForkedChildren_
private

Definition at line 279 of file EventProcessor.h.

Referenced by init().

unsigned int edm::EventProcessor::numberOfSequentialEventsPerChild_
private

Definition at line 280 of file EventProcessor.h.

Referenced by init().

PreallocationConfiguration edm::EventProcessor::preallocations_
private

Definition at line 284 of file EventProcessor.h.

Referenced by beginJob(), endJob(), and init().

boost::shared_ptr<ProductRegistry const> edm::EventProcessor::preg_
private

Definition at line 249 of file EventProcessor.h.

Referenced by beginJob(), and init().

PrincipalCache edm::EventProcessor::principalCache_
private

Definition at line 265 of file EventProcessor.h.

Referenced by init().

boost::shared_ptr<ProcessConfiguration const> edm::EventProcessor::processConfiguration_
private

Definition at line 256 of file EventProcessor.h.

Referenced by init().

ProcessContext edm::EventProcessor::processContext_
private

Definition at line 257 of file EventProcessor.h.

Referenced by init().

std::auto_ptr<Schedule> edm::EventProcessor::schedule_
private
ServiceToken edm::EventProcessor::serviceToken_
private

Definition at line 251 of file EventProcessor.h.

Referenced by beginJob(), endJob(), getToken(), and init().

bool edm::EventProcessor::setCpuAffinity_
private

Definition at line 281 of file EventProcessor.h.

Referenced by init().

bool edm::EventProcessor::shouldWeStop_
private

Definition at line 267 of file EventProcessor.h.

bool edm::EventProcessor::stateMachineWasInErrorState_
private

Definition at line 268 of file EventProcessor.h.

std::auto_ptr<SubProcess> edm::EventProcessor::subProcess_
private