CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
SonicClientBase Class Referenceabstract

#include <SonicClientBase.h>

Inheritance diagram for SonicClientBase:
SonicClientAsync< InputT, OutputT > SonicClientPseudoAsync< InputT, OutputT > SonicClientSync< InputT, OutputT >

Public Member Functions

const std::string & debugName () const
 
virtual void dispatch (edm::WaitingTaskWithArenaHolder holder)=0
 
void setDebugName (const std::string &debugName)
 
 SonicClientBase ()
 
virtual ~SonicClientBase ()=default
 

Protected Member Functions

virtual unsigned allowedTries () const
 
virtual void evaluate ()=0
 
void finish (bool success, std::exception_ptr eptr=std::exception_ptr{})
 
void setStartTime ()
 

Protected Attributes

std::string debugName_
 
edm::WaitingTaskWithArenaHolder holder_
 
std::chrono::time_point< std::chrono::high_resolution_clock > t0_
 
unsigned tries_
 

Detailed Description

Definition at line 11 of file SonicClientBase.h.

Constructor & Destructor Documentation

◆ SonicClientBase()

SonicClientBase::SonicClientBase ( )
inline

Definition at line 14 of file SonicClientBase.h.

14 : tries_(0) {}

◆ ~SonicClientBase()

virtual SonicClientBase::~SonicClientBase ( )
virtualdefault

Member Function Documentation

◆ allowedTries()

virtual unsigned SonicClientBase::allowedTries ( ) const
inlineprotectedvirtual

Definition at line 29 of file SonicClientBase.h.

29 { return 0; }

◆ debugName()

const std::string& SonicClientBase::debugName ( ) const
inline

Definition at line 20 of file SonicClientBase.h.

20 { return debugName_; }

References debugName_.

Referenced by setDebugName().

◆ dispatch()

virtual void SonicClientBase::dispatch ( edm::WaitingTaskWithArenaHolder  holder)
pure virtual

◆ evaluate()

virtual void SonicClientBase::evaluate ( )
protectedpure virtual

◆ finish()

void SonicClientBase::finish ( bool  success,
std::exception_ptr  eptr = std::exception_ptr{} 
)
inlineprotected

Definition at line 38 of file SonicClientBase.h.

38  {}) {
39  //retries are only allowed if no exception was raised
40  if (!success and !eptr) {
41  ++tries_;
42  //if max retries has not been exceeded, call evaluate again
43  if (tries_ < allowedTries()) {
44  evaluate();
45  //avoid calling doneWaiting() twice
46  return;
47  }
48  //prepare an exception if exceeded
49  else {
50  cms::Exception ex("SonicCallFailed");
51  ex << "call failed after max " << tries_ << " tries";
52  eptr = make_exception_ptr(ex);
53  }
54  }
55  if (!debugName_.empty()) {
57  edm::LogInfo(debugName_) << "Client time: "
58  << std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0_).count();
59  }
60  holder_.doneWaiting(eptr);
61  }

Referenced by progressbar.ProgressBar::__next__().

◆ setDebugName()

void SonicClientBase::setDebugName ( const std::string &  debugName)
inline

Definition at line 19 of file SonicClientBase.h.

19 { debugName_ = debugName; }

References debugName(), and debugName_.

◆ setStartTime()

void SonicClientBase::setStartTime ( )
inlineprotected

Member Data Documentation

◆ debugName_

std::string SonicClientBase::debugName_
protected

Definition at line 68 of file SonicClientBase.h.

Referenced by debugName(), setDebugName(), and setStartTime().

◆ holder_

edm::WaitingTaskWithArenaHolder SonicClientBase::holder_
protected

◆ t0_

std::chrono::time_point<std::chrono::high_resolution_clock> SonicClientBase::t0_
protected

Definition at line 69 of file SonicClientBase.h.

Referenced by setStartTime().

◆ tries_

unsigned SonicClientBase::tries_
protected

Definition at line 64 of file SonicClientBase.h.

Referenced by setStartTime().

edm::LogInfo
Definition: MessageLogger.h:254
SonicClientBase::debugName
const std::string & debugName() const
Definition: SonicClientBase.h:20
SonicClientBase::tries_
unsigned tries_
Definition: SonicClientBase.h:64
fileCollector.now
now
Definition: fileCollector.py:207
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
SonicClientBase::allowedTries
virtual unsigned allowedTries() const
Definition: SonicClientBase.h:29
SonicClientBase::holder_
edm::WaitingTaskWithArenaHolder holder_
Definition: SonicClientBase.h:65
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
SonicClientBase::evaluate
virtual void evaluate()=0
SonicClientBase::debugName_
std::string debugName_
Definition: SonicClientBase.h:68
SonicClientBase::t0_
std::chrono::time_point< std::chrono::high_resolution_clock > t0_
Definition: SonicClientBase.h:69
cms::Exception
Definition: Exception.h:70
edm::WaitingTaskWithArenaHolder::doneWaiting
void doneWaiting(std::exception_ptr iExcept)
Definition: WaitingTaskWithArenaHolder.cc:62