CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Attributes
edm::LuminosityBlockProcessingStatus Class Reference

#include <LuminosityBlockProcessingStatus.h>

Public Types

enum  EventProcessingState { EventProcessingState::kProcessing, EventProcessingState::kPauseForFileTransition, EventProcessingState::kStopLumi }
 

Public Member Functions

bool cleaningUpAfterException () const
 
bool didGlobalBeginSucceed () const
 
WaitingTaskListendIOVWaitingTasks ()
 
EventProcessingState eventProcessingState () const
 
EventSetupImpl const & eventSetupImpl (unsigned subProcessIndex) const
 
std::vector< std::shared_ptr< const EventSetupImpl > > & eventSetupImpls ()
 
std::vector< std::shared_ptr< const EventSetupImpl > > const & eventSetupImpls () const
 
void globalBeginDidSucceed ()
 
void globalEndRunHolderDoneWaiting ()
 
bool haveStartedNextLumiOrEndedRun () const
 
edm::Timestamp const & lastTimestamp () const
 
 LuminosityBlockProcessingStatus ()=default
 
 LuminosityBlockProcessingStatus (LuminosityBlockProcessingStatus const &)=delete
 
std::shared_ptr< LuminosityBlockPrincipal > & lumiPrincipal ()
 
void noMoreEventsInLumi ()
 
LuminosityBlockProcessingStatus const & operator= (LuminosityBlockProcessingStatus const &)=delete
 
void resetResources ()
 
void resumeGlobalLumiQueue ()
 
void setCleaningUpAfterException (bool value)
 
void setEndTime ()
 
void setEventProcessingState (EventProcessingState val)
 
void setGlobalEndRunHolder (WaitingTaskHolder)
 
void setLumiPrincipal (std::shared_ptr< LuminosityBlockPrincipal > val)
 
void setResumer (LimitedTaskQueue::Resumer iResumer)
 
bool shouldStreamStartLumi ()
 
void startNextLumiOrEndRun ()
 
bool streamFinishedLumi ()
 
void updateLastTimestamp (edm::Timestamp const &iTime)
 
 ~LuminosityBlockProcessingStatus ()
 

Private Types

enum  State { State::kRunning, State::kUpdating, State::kNoMoreEvents }
 

Private Attributes

bool cleaningUpAfterException_ {false}
 
WaitingTaskList endIOVWaitingTasks_
 
edm::Timestamp endTime_ {}
 
std::atomic< char > endTimeSetStatus_ {0}
 
EventProcessingState eventProcessingState_ {EventProcessingState::kProcessing}
 
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_
 
bool globalBeginSucceeded_ {false}
 
edm::WaitingTaskHolder globalEndRunHolder_
 
LimitedTaskQueue::Resumer globalLumiQueueResumer_
 
std::shared_ptr< LuminosityBlockPrincipallumiPrincipal_
 
unsigned int nStreamsProcessingLumi_ {0}
 
std::atomic< unsigned int > nStreamsStillProcessingLumi_ {0}
 
std::atomic< bool > startedNextLumiOrEndedRun_ {false}
 
std::atomic< Statestate_ {State::kRunning}
 

Detailed Description

Description: Keep status information about one LuminosityBlock transition

Usage: <usage>

Definition at line 40 of file LuminosityBlockProcessingStatus.h.

Member Enumeration Documentation

◆ EventProcessingState

Enumerator
kProcessing 
kPauseForFileTransition 
kStopLumi 

Definition at line 88 of file LuminosityBlockProcessingStatus.h.

88 { kProcessing, kPauseForFileTransition, kStopLumi };

◆ State

Enumerator
kRunning 
kUpdating 
kNoMoreEvents 

Definition at line 111 of file LuminosityBlockProcessingStatus.h.

111 { kRunning, kUpdating, kNoMoreEvents };

Constructor & Destructor Documentation

◆ LuminosityBlockProcessingStatus() [1/2]

edm::LuminosityBlockProcessingStatus::LuminosityBlockProcessingStatus ( )
default

◆ LuminosityBlockProcessingStatus() [2/2]

edm::LuminosityBlockProcessingStatus::LuminosityBlockProcessingStatus ( LuminosityBlockProcessingStatus const &  )
delete

◆ ~LuminosityBlockProcessingStatus()

edm::LuminosityBlockProcessingStatus::~LuminosityBlockProcessingStatus ( )
inline

Definition at line 47 of file LuminosityBlockProcessingStatus.h.

References edm::WaitingTaskList::doneWaiting(), and endIOVWaitingTasks_.

47 { endIOVWaitingTasks_.doneWaiting(std::exception_ptr{}); }
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.

Member Function Documentation

◆ cleaningUpAfterException()

bool edm::LuminosityBlockProcessingStatus::cleaningUpAfterException ( ) const
inline

◆ didGlobalBeginSucceed()

bool edm::LuminosityBlockProcessingStatus::didGlobalBeginSucceed ( ) const
inline

◆ endIOVWaitingTasks()

WaitingTaskList& edm::LuminosityBlockProcessingStatus::endIOVWaitingTasks ( )
inline

◆ eventProcessingState()

EventProcessingState edm::LuminosityBlockProcessingStatus::eventProcessingState ( ) const
inline

◆ eventSetupImpl()

EventSetupImpl const& edm::LuminosityBlockProcessingStatus::eventSetupImpl ( unsigned  subProcessIndex) const
inline

Definition at line 61 of file LuminosityBlockProcessingStatus.h.

References eventSetupImpls_.

61  {
62  return *eventSetupImpls_.at(subProcessIndex);
63  }
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_

◆ eventSetupImpls() [1/2]

std::vector<std::shared_ptr<const EventSetupImpl> >& edm::LuminosityBlockProcessingStatus::eventSetupImpls ( )
inline

Definition at line 65 of file LuminosityBlockProcessingStatus.h.

References eventSetupImpls_.

65 { return eventSetupImpls_; }
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_

◆ eventSetupImpls() [2/2]

std::vector<std::shared_ptr<const EventSetupImpl> > const& edm::LuminosityBlockProcessingStatus::eventSetupImpls ( ) const
inline

Definition at line 66 of file LuminosityBlockProcessingStatus.h.

References eventSetupImpls_.

66 { return eventSetupImpls_; }
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_

◆ globalBeginDidSucceed()

void edm::LuminosityBlockProcessingStatus::globalBeginDidSucceed ( )
inline

◆ globalEndRunHolderDoneWaiting()

void edm::LuminosityBlockProcessingStatus::globalEndRunHolderDoneWaiting ( )
inline

Definition at line 71 of file LuminosityBlockProcessingStatus.h.

References edm::WaitingTaskHolder::doneWaiting(), and globalEndRunHolder_.

71 { globalEndRunHolder_.doneWaiting(std::exception_ptr{}); }
void doneWaiting(std::exception_ptr iExcept)

◆ haveStartedNextLumiOrEndedRun()

bool edm::LuminosityBlockProcessingStatus::haveStartedNextLumiOrEndedRun ( ) const
inline

Definition at line 92 of file LuminosityBlockProcessingStatus.h.

References startedNextLumiOrEndedRun_.

◆ lastTimestamp()

edm::Timestamp const& edm::LuminosityBlockProcessingStatus::lastTimestamp ( ) const
inline

Definition at line 83 of file LuminosityBlockProcessingStatus.h.

References endTime_.

◆ lumiPrincipal()

std::shared_ptr<LuminosityBlockPrincipal>& edm::LuminosityBlockProcessingStatus::lumiPrincipal ( )
inline

◆ noMoreEventsInLumi()

void edm::LuminosityBlockProcessingStatus::noMoreEventsInLumi ( )

◆ operator=()

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

◆ resetResources()

void edm::LuminosityBlockProcessingStatus::resetResources ( )

Definition at line 17 of file LuminosityBlockProcessingStatus.cc.

References edm::WaitingTaskList::doneWaiting(), endIOVWaitingTasks_, eventSetupImpls_, and resumeGlobalLumiQueue().

17  {
18  endIOVWaitingTasks_.doneWaiting(std::exception_ptr{});
19  for (auto& iter : eventSetupImpls_) {
20  iter.reset();
21  }
23  }
void doneWaiting(std::exception_ptr iPtr)
Signals that the resource is now available and tasks should be spawned.
std::vector< std::shared_ptr< const EventSetupImpl > > eventSetupImpls_

◆ resumeGlobalLumiQueue()

void edm::LuminosityBlockProcessingStatus::resumeGlobalLumiQueue ( )
inline

Definition at line 50 of file LuminosityBlockProcessingStatus.h.

References globalLumiQueueResumer_, lumiPrincipal_, and edm::LimitedTaskQueue::Resumer::resume().

Referenced by resetResources().

50  {
51  //free lumi for next usage
52  lumiPrincipal_.reset();
54  }
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_

◆ setCleaningUpAfterException()

void edm::LuminosityBlockProcessingStatus::setCleaningUpAfterException ( bool  value)
inline

◆ setEndTime()

void edm::LuminosityBlockProcessingStatus::setEndTime ( )

Definition at line 57 of file LuminosityBlockProcessingStatus.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), endTime_, endTimeSetStatus_, kSet, and lumiPrincipal_.

57  {
58  constexpr char kUnset = 0;
59  constexpr char kSetting = 1;
60  constexpr char kSet = 2;
61 
62  if (endTimeSetStatus_ != kSet) {
63  //not already set
64  char expected = kUnset;
65  if (endTimeSetStatus_.compare_exchange_strong(expected, kSetting)) {
66  lumiPrincipal_->setEndTime(endTime_);
67  endTimeSetStatus_.store(kSet);
68  } else {
69  //wait until time is set
70  while (endTimeSetStatus_.load() != kSet) {
71  }
72  }
73  }
74  }
const char * kSet
std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_

◆ setEventProcessingState()

void edm::LuminosityBlockProcessingStatus::setEventProcessingState ( EventProcessingState  val)
inline

◆ setGlobalEndRunHolder()

void edm::LuminosityBlockProcessingStatus::setGlobalEndRunHolder ( WaitingTaskHolder  holder)

Definition at line 25 of file LuminosityBlockProcessingStatus.cc.

References globalEndRunHolder_, and eostools::move().

25  {
27  }
def move(src, dest)
Definition: eostools.py:511

◆ setLumiPrincipal()

void edm::LuminosityBlockProcessingStatus::setLumiPrincipal ( std::shared_ptr< LuminosityBlockPrincipal val)
inline

Definition at line 59 of file LuminosityBlockProcessingStatus.h.

References lumiPrincipal_, eostools::move(), and heppy_batch::val.

std::shared_ptr< LuminosityBlockPrincipal > lumiPrincipal_
def move(src, dest)
Definition: eostools.py:511

◆ setResumer()

void edm::LuminosityBlockProcessingStatus::setResumer ( LimitedTaskQueue::Resumer  iResumer)
inline

Definition at line 49 of file LuminosityBlockProcessingStatus.h.

References globalLumiQueueResumer_, and eostools::move().

49 { globalLumiQueueResumer_ = std::move(iResumer); }
def move(src, dest)
Definition: eostools.py:511

◆ shouldStreamStartLumi()

bool edm::LuminosityBlockProcessingStatus::shouldStreamStartLumi ( )

Definition at line 29 of file LuminosityBlockProcessingStatus.cc.

References kNoMoreEvents, kRunning, kUpdating, nStreamsProcessingLumi_, and state_.

29  {
31  return false;
32 
33  bool changed = false;
34  do {
35  auto expected = State::kRunning;
36  changed = state_.compare_exchange_strong(expected, State::kUpdating);
37  if (expected == State::kNoMoreEvents)
38  return false;
39  } while (changed == false);
40 
43  return true;
44  }

◆ startNextLumiOrEndRun()

void edm::LuminosityBlockProcessingStatus::startNextLumiOrEndRun ( )
inline

◆ streamFinishedLumi()

bool edm::LuminosityBlockProcessingStatus::streamFinishedLumi ( )
inline

Definition at line 75 of file LuminosityBlockProcessingStatus.h.

References nStreamsStillProcessingLumi_.

75 { return 0 == (--nStreamsStillProcessingLumi_); }

◆ updateLastTimestamp()

void edm::LuminosityBlockProcessingStatus::updateLastTimestamp ( edm::Timestamp const &  iTime)
inline

Definition at line 78 of file LuminosityBlockProcessingStatus.h.

References endTime_.

78  {
79  if (iTime > endTime_) {
80  endTime_ = iTime;
81  }
82  }

Member Data Documentation

◆ cleaningUpAfterException_

bool edm::LuminosityBlockProcessingStatus::cleaningUpAfterException_ {false}
private

◆ endIOVWaitingTasks_

WaitingTaskList edm::LuminosityBlockProcessingStatus::endIOVWaitingTasks_
private

◆ endTime_

edm::Timestamp edm::LuminosityBlockProcessingStatus::endTime_ {}
private

◆ endTimeSetStatus_

std::atomic<char> edm::LuminosityBlockProcessingStatus::endTimeSetStatus_ {0}
private

Definition at line 114 of file LuminosityBlockProcessingStatus.h.

Referenced by setEndTime().

◆ eventProcessingState_

EventProcessingState edm::LuminosityBlockProcessingStatus::eventProcessingState_ {EventProcessingState::kProcessing}
private

◆ eventSetupImpls_

std::vector<std::shared_ptr<const EventSetupImpl> > edm::LuminosityBlockProcessingStatus::eventSetupImpls_
private

◆ globalBeginSucceeded_

bool edm::LuminosityBlockProcessingStatus::globalBeginSucceeded_ {false}
private

◆ globalEndRunHolder_

edm::WaitingTaskHolder edm::LuminosityBlockProcessingStatus::globalEndRunHolder_
private

◆ globalLumiQueueResumer_

LimitedTaskQueue::Resumer edm::LuminosityBlockProcessingStatus::globalLumiQueueResumer_
private

Definition at line 103 of file LuminosityBlockProcessingStatus.h.

Referenced by resumeGlobalLumiQueue(), and setResumer().

◆ lumiPrincipal_

std::shared_ptr<LuminosityBlockPrincipal> edm::LuminosityBlockProcessingStatus::lumiPrincipal_
private

◆ nStreamsProcessingLumi_

unsigned int edm::LuminosityBlockProcessingStatus::nStreamsProcessingLumi_ {0}
private

Definition at line 109 of file LuminosityBlockProcessingStatus.h.

Referenced by noMoreEventsInLumi(), and shouldStreamStartLumi().

◆ nStreamsStillProcessingLumi_

std::atomic<unsigned int> edm::LuminosityBlockProcessingStatus::nStreamsStillProcessingLumi_ {0}
private

Definition at line 110 of file LuminosityBlockProcessingStatus.h.

Referenced by noMoreEventsInLumi(), and streamFinishedLumi().

◆ startedNextLumiOrEndedRun_

std::atomic<bool> edm::LuminosityBlockProcessingStatus::startedNextLumiOrEndedRun_ {false}
private

◆ state_

std::atomic<State> edm::LuminosityBlockProcessingStatus::state_ {State::kRunning}
private

Definition at line 112 of file LuminosityBlockProcessingStatus.h.

Referenced by noMoreEventsInLumi(), and shouldStreamStartLumi().