CMS 3D CMS Logo

SonicClientBase.cc
Go to the documentation of this file.
4 
6  : allowedTries_(params.getUntrackedParameter<unsigned>("allowedTries", 0)) {
7  std::string modeName(params.getParameter<std::string>("mode"));
8  if (modeName == "Sync")
10  else if (modeName == "Async")
12  else if (modeName == "PseudoAsync")
14  else
15  throw cms::Exception("Configuration") << "Unknown mode for SonicClient: " << modeName;
16 
17  //get correct dispatcher for mode
19  dispatcher_ = std::make_unique<SonicDispatcher>(this);
20  else if (mode_ == SonicMode::PseudoAsync)
21  dispatcher_ = std::make_unique<SonicDispatcherPseudoAsync>(this);
22 }
23 
27  if (!clientName_.empty())
28  fullDebugName_ += ":" + clientName_;
29 }
30 
32  start();
33  holder_ = std::move(holder);
34 }
35 
37  tries_ = 0;
38  if (!debugName_.empty())
40 }
41 
42 void SonicClientBase::finish(bool success, std::exception_ptr eptr) {
43  //retries are only allowed if no exception was raised
44  if (!success and !eptr) {
45  ++tries_;
46  //if max retries has not been exceeded, call evaluate again
47  if (tries_ < allowedTries_) {
48  evaluate();
49  //avoid calling doneWaiting() twice
50  return;
51  }
52  //prepare an exception if exceeded
53  else {
54  cms::Exception ex("SonicCallFailed");
55  ex << "call failed after max " << tries_ << " tries";
56  eptr = make_exception_ptr(ex);
57  }
58  }
59  if (!debugName_.empty()) {
61  edm::LogInfo(fullDebugName_) << "Client time: "
62  << std::chrono::duration_cast<std::chrono::microseconds>(t1 - t0_).count();
63  }
64  if (holder_) {
65  holder_->doneWaiting(eptr);
66  holder_.reset();
67  } else if (eptr)
68  std::rethrow_exception(eptr);
69 }
70 
72  //restrict allowed values
73  desc.ifValue(edm::ParameterDescription<std::string>("mode", "PseudoAsync", true),
74  edm::allowedValues<std::string>("Sync", "Async", "PseudoAsync"));
75  if (allowRetry)
76  desc.addUntracked<unsigned>("allowedTries", 0);
77 }
allowedValues.h
SonicClientBase::fillBasePSetDescription
static void fillBasePSetDescription(edm::ParameterSetDescription &desc, bool allowRetry=true)
Definition: SonicClientBase.cc:71
submitPVValidationJobs.now
now
Definition: submitPVValidationJobs.py:639
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SonicClientBase::finish
void finish(bool success, std::exception_ptr eptr=std::exception_ptr{})
Definition: SonicClientBase.cc:42
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SonicClientBase::debugName
const std::string & debugName() const
Definition: SonicClientBase.h:28
SonicClientBase::tries_
unsigned tries_
Definition: SonicClientBase.h:56
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:31
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
SonicClientBase::evaluate
virtual void evaluate()=0
SonicMode::PseudoAsync
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SonicMode::Sync
SonicClientBase::setDebugName
void setDebugName(const std::string &debugName)
Definition: SonicClientBase.cc:24
SonicClientBase::mode_
SonicMode mode_
Definition: SonicClientBase.h:54
SonicClientBase::SonicClientBase
SonicClientBase(const edm::ParameterSet &params)
Definition: SonicClientBase.cc:5
edm::ParameterSet
Definition: ParameterSet.h:47
SonicMode::Async
SonicClientBase::fullDebugName_
std::string fullDebugName_
Definition: SonicClientBase.h:60
SonicClientBase::debugName_
std::string debugName_
Definition: SonicClientBase.h:60
SonicClientBase.h
SonicClientBase::allowedTries_
unsigned allowedTries_
Definition: SonicClientBase.h:56
SonicClientBase::dispatcher_
std::unique_ptr< SonicDispatcher > dispatcher_
Definition: SonicClientBase.h:55
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
SonicClientBase::t0_
std::chrono::time_point< std::chrono::high_resolution_clock > t0_
Definition: SonicClientBase.h:61
Exception
Definition: hltDiff.cc:246
or
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
SonicClientBase::start
void start()
Definition: SonicClientBase.cc:36
Exception.h
cms::Exception
Definition: Exception.h:70
SonicClientBase::clientName_
std::string clientName_
Definition: SonicClientBase.h:60
edm::ParameterDescription
Definition: ParameterDescription.h:110
SonicClientBase::holder_
std::optional< edm::WaitingTaskWithArenaHolder > holder_
Definition: SonicClientBase.h:57