CMS 3D CMS Logo

LuminosityBlockProcessingStatus.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_LuminosityBlockProcessingStatus_h
2 #define FWCore_Framework_LuminosityBlockProcessingStatus_h
3 // -*- C++ -*-
4 //
5 // Package: FWCore/Framework
6 // Class : LuminosityBlockProcessingStatus
7 //
16 //
17 // Original Author: root
18 // Created: Tue, 19 Dec 2017 14:24:57 GMT
19 //
20 
21 // system include files
22 #include <memory>
23 #include <atomic>
24 #include <vector>
25 
26 // user include files
32 
33 // forward declarations
34 namespace edm {
35 #if !defined(TEST_NO_FWD_DECL)
36  class EventProcessor;
37  class LuminosityBlockPrincipal;
39 #endif
40 
42  public:
43  LuminosityBlockProcessingStatus(EventProcessor* iEP, unsigned int iNStreams, std::shared_ptr<void> iRunResource)
44  : run_(std::move(iRunResource)), eventProcessor_(iEP), nStreamsStillProcessingLumi_(iNStreams) {}
45 
48 
50 
51  std::shared_ptr<LuminosityBlockPrincipal>& lumiPrincipal() { return lumiPrincipal_; }
52 
55  //free lumi for next usage
56  lumiPrincipal_.reset();
58  }
59 
60  void resetResources();
61 
62  EventSetupImpl const& eventSetupImpl(unsigned subProcessIndex) const {
63  return *eventSetupImpls_.at(subProcessIndex);
64  }
65 
66  std::vector<std::shared_ptr<const EventSetupImpl>>& eventSetupImpls() { return eventSetupImpls_; }
67  std::vector<std::shared_ptr<const EventSetupImpl>> const& eventSetupImpls() const { return eventSetupImpls_; }
68 
70 
72 
76 
77  bool isLumiEnding() const { return lumiEnding_; }
78  void endLumi() { lumiEnding_ = true; }
79 
80  bool continuingLumi() const { return continuingLumi_; }
81  void haveContinuedLumi() { continuingLumi_ = false; }
83 
84  bool haveStartedNextLumi() const { return startedNextLumi_; }
85  void startNextLumi() { startedNextLumi_ = true; }
86 
89 
92 
93  //These should only be called while in the InputSource's task queue
94  void updateLastTimestamp(edm::Timestamp const& iTime) {
95  if (iTime > endTime_) {
96  endTime_ = iTime;
97  }
98  }
99  edm::Timestamp const& lastTimestamp() const { return endTime_; }
100 
101  void setNextSyncValue(IOVSyncValue const& iValue) { nextSyncValue_ = iValue; }
102 
103  const IOVSyncValue nextSyncValue() const { return nextSyncValue_; }
104 
105  std::shared_ptr<void> const& runResource() const { return run_; }
106 
107  //Called once all events in Lumi have been processed
108  void setEndTime();
109 
110  private:
111  // ---------- member data --------------------------------
112  std::shared_ptr<void> run_;
114  std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
115  std::vector<std::shared_ptr<const EventSetupImpl>> eventSetupImpls_;
119  std::atomic<unsigned int> nStreamsStillProcessingLumi_{0}; //read/write as streams finish lumi so must be atomic
121  std::atomic<char> endTimeSetStatus_{0};
122  bool stopProcessingEvents_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
124  false}; //read/write in m_sourceQueue NOTE: This is a useful cache instead of recalculating each call
125  bool continuingLumi_{false}; //read/write in m_sourceQueue OR from main thread when no tasks running
126  bool startedNextLumi_{false}; //read/write in m_sourceQueue
129  };
130 } // namespace edm
131 
132 #endif
edm::LuminosityBlockProcessingStatus::startedNextLumi_
bool startedNextLumi_
Definition: LuminosityBlockProcessingStatus.h:126
edm::LuminosityBlockProcessingStatus::startProcessingEvents
void startProcessingEvents()
Definition: LuminosityBlockProcessingStatus.h:75
edm::LuminosityBlockProcessingStatus::setResumer
void setResumer(LimitedTaskQueue::Resumer iResumer)
Definition: LuminosityBlockProcessingStatus.h:53
edm::LuminosityBlockProcessingStatus::runResource
std::shared_ptr< void > const & runResource() const
Definition: LuminosityBlockProcessingStatus.h:105
edm::LuminosityBlockProcessingStatus::~LuminosityBlockProcessingStatus
~LuminosityBlockProcessingStatus()
Definition: LuminosityBlockProcessingStatus.h:49
edm::EventSetupImpl
Definition: EventSetupImpl.h:49
edm::LuminosityBlockProcessingStatus::nStreamsStillProcessingLumi_
std::atomic< unsigned int > nStreamsStillProcessingLumi_
Definition: LuminosityBlockProcessingStatus.h:119
edm::LuminosityBlockProcessingStatus::endTimeSetStatus_
std::atomic< char > endTimeSetStatus_
Definition: LuminosityBlockProcessingStatus.h:121
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::LuminosityBlockProcessingStatus::continuingLumi_
bool continuingLumi_
Definition: LuminosityBlockProcessingStatus.h:125
edm::LuminosityBlockProcessingStatus::lastTimestamp
edm::Timestamp const & lastTimestamp() const
Definition: LuminosityBlockProcessingStatus.h:99
edm::LuminosityBlockProcessingStatus::operator=
LuminosityBlockProcessingStatus const & operator=(LuminosityBlockProcessingStatus const &)=delete
edm::LuminosityBlockProcessingStatus::eventSetupImpls
std::vector< std::shared_ptr< const EventSetupImpl > > & eventSetupImpls()
Definition: LuminosityBlockProcessingStatus.h:66
edm::LuminosityBlockProcessingStatus::run_
std::shared_ptr< void > run_
Definition: LuminosityBlockProcessingStatus.h:112
edm::LuminosityBlockProcessingStatus::nextSyncValue
const IOVSyncValue nextSyncValue() const
Definition: LuminosityBlockProcessingStatus.h:103
edm::LuminosityBlockProcessingStatus::eventSetupImpls_
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_
Definition: LuminosityBlockProcessingStatus.h:115
edm::LuminosityBlockProcessingStatus::lumiEnding_
bool lumiEnding_
Definition: LuminosityBlockProcessingStatus.h:123
edm::LuminosityBlockProcessingStatus::startNextLumi
void startNextLumi()
Definition: LuminosityBlockProcessingStatus.h:85
edm::LuminosityBlockProcessingStatus::globalBeginDidSucceed
void globalBeginDidSucceed()
Definition: LuminosityBlockProcessingStatus.h:88
edm::LuminosityBlockProcessingStatus::setEndTime
void setEndTime()
Definition: LuminosityBlockProcessingStatus.cc:29
edm::LuminosityBlockProcessingStatus::cleaningUpAfterException_
bool cleaningUpAfterException_
Definition: LuminosityBlockProcessingStatus.h:128
edm::WaitingTaskList
Definition: WaitingTaskList.h:84
edm::LuminosityBlockProcessingStatus::endLumi
void endLumi()
Definition: LuminosityBlockProcessingStatus.h:78
edm::LuminosityBlockProcessingStatus::updateLastTimestamp
void updateLastTimestamp(edm::Timestamp const &iTime)
Definition: LuminosityBlockProcessingStatus.h:94
edm::LuminosityBlockProcessingStatus::resetResources
void resetResources()
Definition: LuminosityBlockProcessingStatus.cc:20
edm::LuminosityBlockProcessingStatus::eventSetupImpl
EventSetupImpl const & eventSetupImpl(unsigned subProcessIndex) const
Definition: LuminosityBlockProcessingStatus.h:62
edm::LuminosityBlockProcessingStatus::streamFinishedLumi
bool streamFinishedLumi()
Definition: LuminosityBlockProcessingStatus.h:71
edm::LuminosityBlockProcessingStatus::globalBeginSucceeded_
bool globalBeginSucceeded_
Definition: LuminosityBlockProcessingStatus.h:127
edm::LuminosityBlockProcessingStatus
Definition: LuminosityBlockProcessingStatus.h:41
edm::WaitingTaskList::doneWaiting
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
Definition: WaitingTaskList.cc:212
edm::LuminosityBlockProcessingStatus::LuminosityBlockProcessingStatus
LuminosityBlockProcessingStatus(EventProcessor *iEP, unsigned int iNStreams, std::shared_ptr< void > iRunResource)
Definition: LuminosityBlockProcessingStatus.h:43
edm::LuminosityBlockProcessingStatus::globalLumiQueueResumer_
LimitedTaskQueue::Resumer globalLumiQueueResumer_
Definition: LuminosityBlockProcessingStatus.h:113
csc_dqm_offlineclient_cfi.EventProcessor
EventProcessor
Definition: csc_dqm_offlineclient_cfi.py:10
edm::LuminosityBlockProcessingStatus::lumiPrincipal
std::shared_ptr< LuminosityBlockPrincipal > & lumiPrincipal()
Definition: LuminosityBlockProcessingStatus.h:51
LimitedTaskQueue.h
edm::LuminosityBlockProcessingStatus::needToContinueLumi
void needToContinueLumi()
Definition: LuminosityBlockProcessingStatus.h:82
edm::IOVSyncValue
Definition: IOVSyncValue.h:31
edm::LuminosityBlockProcessingStatus::noExceptionHappened
void noExceptionHappened()
Definition: LuminosityBlockProcessingStatus.h:90
LuminosityBlockProcessingStatus
edm::LuminosityBlockProcessingStatus::stopProcessingEvents
void stopProcessingEvents()
Definition: LuminosityBlockProcessingStatus.h:74
Timestamp.h
edm::LuminosityBlockProcessingStatus::endIOVWaitingTasks
WaitingTaskList & endIOVWaitingTasks()
Definition: LuminosityBlockProcessingStatus.h:69
edm::LuminosityBlockProcessingStatus::haveStartedNextLumi
bool haveStartedNextLumi() const
Definition: LuminosityBlockProcessingStatus.h:84
edm::LuminosityBlockProcessingStatus::haveContinuedLumi
void haveContinuedLumi()
Definition: LuminosityBlockProcessingStatus.h:81
edm::LuminosityBlockProcessingStatus::lumiPrincipal_
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
Definition: LuminosityBlockProcessingStatus.h:114
edm::LuminosityBlockProcessingStatus::endIOVWaitingTasks_
WaitingTaskList endIOVWaitingTasks_
Definition: LuminosityBlockProcessingStatus.h:116
edm::LuminosityBlockProcessingStatus::stopProcessingEvents_
bool stopProcessingEvents_
Definition: LuminosityBlockProcessingStatus.h:122
edm::LuminosityBlockProcessingStatus::endTime_
edm::Timestamp endTime_
Definition: LuminosityBlockProcessingStatus.h:120
edm::LuminosityBlockProcessingStatus::nextSyncValue_
IOVSyncValue nextSyncValue_
Definition: LuminosityBlockProcessingStatus.h:118
edm::LimitedTaskQueue::Resumer
Definition: LimitedTaskQueue.h:57
edm::LuminosityBlockProcessingStatus::didGlobalBeginSucceed
bool didGlobalBeginSucceed() const
Definition: LuminosityBlockProcessingStatus.h:87
edm::LuminosityBlockProcessingStatus::wasEventProcessingStopped
bool wasEventProcessingStopped() const
Definition: LuminosityBlockProcessingStatus.h:73
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
edm::LuminosityBlockProcessingStatus::resumeGlobalLumiQueue
void resumeGlobalLumiQueue()
Definition: LuminosityBlockProcessingStatus.h:54
EventSetup.h
edm::LuminosityBlockProcessingStatus::cleaningUpAfterException
bool cleaningUpAfterException() const
Definition: LuminosityBlockProcessingStatus.h:91
WaitingTaskList.h
edm::EventProcessor
Definition: EventProcessor.h:66
edm::LimitedTaskQueue::Resumer::resume
bool resume()
Definition: LimitedTaskQueue.h:85
edm::LuminosityBlockProcessingStatus::eventProcessor_
EventProcessor * eventProcessor_
Definition: LuminosityBlockProcessingStatus.h:117
edm::LuminosityBlockProcessingStatus::continuingLumi
bool continuingLumi() const
Definition: LuminosityBlockProcessingStatus.h:80
IOVSyncValue.h
edm::LuminosityBlockProcessingStatus::isLumiEnding
bool isLumiEnding() const
Definition: LuminosityBlockProcessingStatus.h:77
edm::LuminosityBlockProcessingStatus::setNextSyncValue
void setNextSyncValue(IOVSyncValue const &iValue)
Definition: LuminosityBlockProcessingStatus.h:101
edm::LuminosityBlockProcessingStatus::eventSetupImpls
std::vector< std::shared_ptr< const EventSetupImpl > > const & eventSetupImpls() const
Definition: LuminosityBlockProcessingStatus.h:67
edm::Timestamp
Definition: Timestamp.h:30