CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
edm::WaitingTaskHolder Class Reference

#include <WaitingTaskHolder.h>

Public Member Functions

void doneWaiting (std::exception_ptr iExcept)
 
oneapi::tbb::task_group * group () const noexcept
 
bool hasTask () const noexcept
 
WaitingTaskHolderoperator= (const WaitingTaskHolder &iRHS)
 
WaitingTaskHolderoperator= (WaitingTaskHolder &&iRHS)
 
void presetTaskAsFailed (std::exception_ptr iExcept)
 
bool taskHasFailed () const noexcept
 
 WaitingTaskHolder ()
 
 WaitingTaskHolder (oneapi::tbb::task_group &iGroup, edm::WaitingTask *iTask)
 
 WaitingTaskHolder (const WaitingTaskHolder &iHolder)
 
 WaitingTaskHolder (WaitingTaskHolder &&iOther)
 
 ~WaitingTaskHolder ()
 

Private Member Functions

WaitingTaskrelease_no_decrement () noexcept
 

Private Attributes

oneapi::tbb::task_group * m_group
 
WaitingTaskm_task
 

Friends

class WaitingTaskList
 
class WaitingTaskWithArenaHolder
 

Detailed Description

Definition at line 32 of file WaitingTaskHolder.h.

Constructor & Destructor Documentation

◆ WaitingTaskHolder() [1/4]

edm::WaitingTaskHolder::WaitingTaskHolder ( )
inline

Definition at line 37 of file WaitingTaskHolder.h.

37 : m_task(nullptr), m_group(nullptr) {}
oneapi::tbb::task_group * m_group

◆ WaitingTaskHolder() [2/4]

edm::WaitingTaskHolder::WaitingTaskHolder ( oneapi::tbb::task_group &  iGroup,
edm::WaitingTask iTask 
)
inlineexplicit

Definition at line 39 of file WaitingTaskHolder.h.

References edm::TaskBase::increment_ref_count(), and m_task.

40  : m_task(iTask), m_group(&iGroup) {
42  }
oneapi::tbb::task_group * m_group
void increment_ref_count()
Definition: TaskBase.h:41

◆ ~WaitingTaskHolder()

edm::WaitingTaskHolder::~WaitingTaskHolder ( )
inline

Definition at line 43 of file WaitingTaskHolder.h.

References doneWaiting(), and m_task.

43  {
44  if (m_task) {
45  doneWaiting(std::exception_ptr{});
46  }
47  }
void doneWaiting(std::exception_ptr iExcept)

◆ WaitingTaskHolder() [3/4]

edm::WaitingTaskHolder::WaitingTaskHolder ( const WaitingTaskHolder iHolder)
inline

Definition at line 49 of file WaitingTaskHolder.h.

References edm::TaskBase::increment_ref_count(), and m_task.

49  : m_task(iHolder.m_task), m_group(iHolder.m_group) {
51  }
oneapi::tbb::task_group * m_group
void increment_ref_count()
Definition: TaskBase.h:41

◆ WaitingTaskHolder() [4/4]

edm::WaitingTaskHolder::WaitingTaskHolder ( WaitingTaskHolder &&  iOther)
inline

Definition at line 53 of file WaitingTaskHolder.h.

53  : m_task(iOther.m_task), m_group(iOther.m_group) {
54  iOther.m_task = nullptr;
55  }
oneapi::tbb::task_group * m_group

Member Function Documentation

◆ doneWaiting()

void edm::WaitingTaskHolder::doneWaiting ( std::exception_ptr  iExcept)
inline

Definition at line 94 of file WaitingTaskHolder.h.

References edm::WaitingTask::dependentTaskFailed(), m_group, m_task, alignCSCRings::s, and TrackValidation_cff::task.

Referenced by edm::WaitingTaskList::add(), edm::Worker::HandleExternalWorkExceptionTask::execute(), edm::StreamSchedule::finishedPaths(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::StreamSchedule::processOneEventAsync(), edm::GlobalSchedule::processOneGlobalAsync(), edm::StreamSchedule::processOneStreamAsync(), edm::eventsetup::synchronousEventSetupForInstance(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeProcessBlockAsync(), edm::OutputModuleCommunicatorT< T >::writeRunAsync(), and ~WaitingTaskHolder().

94  {
95  if (iExcept) {
96  m_task->dependentTaskFailed(iExcept);
97  }
98  //task_group::run can run the task before we finish
99  // doneWaiting and some other thread might
100  // try to reuse this object. Resetting
101  // before spawn avoids problems
102  auto task = m_task;
103  m_task = nullptr;
104  if (0 == task->decrement_ref_count()) {
105  m_group->run([task]() {
106  TaskSentry s{task};
107  task->execute();
108  });
109  }
110  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59
oneapi::tbb::task_group * m_group

◆ group()

oneapi::tbb::task_group* edm::WaitingTaskHolder::group ( ) const
inlinenoexcept

since oneapi::tbb::task_group is thread safe, we can return it non-const from here since the object is not really part of the state of the holder

Definition at line 78 of file WaitingTaskHolder.h.

References m_group.

Referenced by edm::WaitingTaskList::add(), edm::EventProcessor::continueLumiAsync(), evf::GlobalEvFOutputEventWriter::doOutputEventAsync(), edm::EventProcessor::handleNextEventForStreamAsync(), edm::waiting_task::detail::WaitingTaskChain< U >::lastTask(), edm::waiting_task::detail::WaitingTaskChain< U, T... >::lastTask(), edm::waiting_task::detail::WaitingTaskChain< Conditional< U >, T... >::lastTask(), edm::eventsetup::Callback< T, TReturn, TRecord, TDecorator >::prefetchAsync(), edm::DelayedReaderInputProductResolver::prefetchAsync_(), edm::UnscheduledProductResolver::prefetchAsync_(), edm::SwitchProducerProductResolver::prefetchAsync_(), edm::SwitchAliasProductResolver::prefetchAsync_(), edm::NoProcessProductResolver::prefetchAsync_(), edm::eventsetup::DataProxyTemplate< RecordT, DataT >::prefetchAsyncImpl(), edm::eventsetup::ESSourceDataProxyBase::prefetchAsyncImplTemplate(), edm::EventProcessor::processEventAsync(), edm::StreamSchedule::processOneEventAsync(), edm::GlobalSchedule::processOneGlobalAsync(), edm::Path::processOneOccurrenceAsync(), edm::StreamSchedule::processOneStreamAsync(), edm::waiting_task::detail::WaitingTaskChain< U, T... >::runLast(), edm::waiting_task::detail::WaitingTaskChain< Conditional< U >, T... >::runLast(), edm::eventsetup::EventSetupRecordIOVQueue::startNewIOVAsync(), edm::EventProcessor::streamEndLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeLumiAsync(), edm::OutputModuleCommunicatorT< T >::writeProcessBlockAsync(), and edm::OutputModuleCommunicatorT< T >::writeRunAsync().

78 { return m_group; }
oneapi::tbb::task_group * m_group

◆ hasTask()

bool edm::WaitingTaskHolder::hasTask ( ) const
inlinenoexcept

Definition at line 74 of file WaitingTaskHolder.h.

References m_task.

Referenced by edm::eventsetup::EventSetupRecordIOVQueue::endIOVAsync().

74 { return m_task != nullptr; }

◆ operator=() [1/2]

WaitingTaskHolder& edm::WaitingTaskHolder::operator= ( const WaitingTaskHolder iRHS)
inline

Definition at line 57 of file WaitingTaskHolder.h.

References m_group, m_task, std::swap(), and createJobs::tmp.

57  {
58  WaitingTaskHolder tmp(iRHS);
59  std::swap(m_task, tmp.m_task);
60  std::swap(m_group, tmp.m_group);
61  return *this;
62  }
oneapi::tbb::task_group * m_group
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tmp
align.sh
Definition: createJobs.py:716

◆ operator=() [2/2]

WaitingTaskHolder& edm::WaitingTaskHolder::operator= ( WaitingTaskHolder &&  iRHS)
inline

Definition at line 64 of file WaitingTaskHolder.h.

References m_group, m_task, eostools::move(), std::swap(), and createJobs::tmp.

64  {
66  std::swap(m_task, tmp.m_task);
67  std::swap(m_group, tmp.m_group);
68  return *this;
69  }
oneapi::tbb::task_group * m_group
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511

◆ presetTaskAsFailed()

void edm::WaitingTaskHolder::presetTaskAsFailed ( std::exception_ptr  iExcept)
inline

Use in the case where you need to inform the parent task of a failure before some other child task which may be run later reports a different, but related failure. You must later call doneWaiting in the same thread passing the same exceptoin.

Definition at line 88 of file WaitingTaskHolder.h.

References edm::WaitingTask::dependentTaskFailed(), and m_task.

88  {
89  if (iExcept) {
90  m_task->dependentTaskFailed(iExcept);
91  }
92  }
void dependentTaskFailed(std::exception_ptr iPtr)
Called if waited for task failed.
Definition: WaitingTask.h:59

◆ release_no_decrement()

WaitingTask* edm::WaitingTaskHolder::release_no_decrement ( )
inlineprivatenoexcept

Definition at line 113 of file WaitingTaskHolder.h.

References m_task, and submitPVValidationJobs::t.

Referenced by edm::WaitingTaskList::add().

113  {
114  auto t = m_task;
115  m_task = nullptr;
116  return t;
117  }

◆ taskHasFailed()

bool edm::WaitingTaskHolder::taskHasFailed ( ) const
inlinenoexcept

Definition at line 72 of file WaitingTaskHolder.h.

References edm::WaitingTask::exceptionPtr(), and m_task.

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

72 { return m_task->exceptionPtr() != nullptr; }
std::exception_ptr const * exceptionPtr() const
Returns exception thrown by dependent task.
Definition: WaitingTask.h:51

Friends And Related Function Documentation

◆ WaitingTaskList

friend class WaitingTaskList
friend

Definition at line 34 of file WaitingTaskHolder.h.

◆ WaitingTaskWithArenaHolder

friend class WaitingTaskWithArenaHolder
friend

Definition at line 35 of file WaitingTaskHolder.h.

Member Data Documentation

◆ m_group

oneapi::tbb::task_group* edm::WaitingTaskHolder::m_group
private

Definition at line 120 of file WaitingTaskHolder.h.

Referenced by doneWaiting(), group(), and operator=().

◆ m_task

WaitingTask* edm::WaitingTaskHolder::m_task
private