CMS 3D CMS Logo

SonicClientBase.h
Go to the documentation of this file.
1 #ifndef HeterogeneousCore_SonicCore_SonicClientBase
2 #define HeterogeneousCore_SonicCore_SonicClientBase
3 
10 
11 #include <string>
12 #include <exception>
13 #include <memory>
14 #include <optional>
15 
16 enum class SonicMode { Sync = 1, Async = 2, PseudoAsync = 3 };
17 
19 public:
20  //constructor
22 
23  //destructor
24  virtual ~SonicClientBase() = default;
25 
26  const std::string& debugName() const { return debugName_; }
27  const std::string& clientName() const { return clientName_; }
28  SonicMode mode() const { return mode_; }
29 
30  //main operation
31  virtual void dispatch(edm::WaitingTaskWithArenaHolder holder) { dispatcher_->dispatch(std::move(holder)); }
32 
33  //alternate operation when ExternalWork is not used
34  virtual void dispatch() { dispatcher_->dispatch(); }
35 
36  //helper: does nothing by default
37  virtual void reset() {}
38 
39  //provide base params
40  static void fillBasePSetDescription(edm::ParameterSetDescription& desc, bool allowRetry = true);
41 
42 protected:
43  void setMode(SonicMode mode);
44 
45  virtual void evaluate() = 0;
46 
48 
49  void start();
50 
51  void finish(bool success, std::exception_ptr eptr = std::exception_ptr{});
52 
53  //members
55  std::unique_ptr<SonicDispatcher> dispatcher_;
56  unsigned allowedTries_, tries_;
57  std::optional<edm::WaitingTaskWithArenaHolder> holder_;
58 
59  //for logging/debugging
61 
62  friend class SonicDispatcher;
64 };
65 
66 #endif
SonicClientBase::fillBasePSetDescription
static void fillBasePSetDescription(edm::ParameterSetDescription &desc, bool allowRetry=true)
Definition: SonicClientBase.cc:73
MessageLogger.h
SonicClientBase::dispatch
virtual void dispatch()
Definition: SonicClientBase.h:34
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
SonicClientBase::~SonicClientBase
virtual ~SonicClientBase()=default
SonicMode
SonicMode
Definition: SonicClientBase.h:16
SonicDispatcherPseudoAsync.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
SonicClientBase::finish
void finish(bool success, std::exception_ptr eptr=std::exception_ptr{})
Definition: SonicClientBase.cc:45
SonicClientBase::debugName
const std::string & debugName() const
Definition: SonicClientBase.h:26
SonicClientBase::tries_
unsigned tries_
Definition: SonicClientBase.h:56
SonicClientBase
Definition: SonicClientBase.h:18
edm::WaitingTaskWithArenaHolder
Definition: WaitingTaskWithArenaHolder.h:34
SonicDispatcherPseudoAsync
Definition: SonicDispatcherPseudoAsync.h:16
SonicClientBase::clientName
const std::string & clientName() const
Definition: SonicClientBase.h:27
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:114
SonicClientBase::SonicClientBase
SonicClientBase(const edm::ParameterSet &params, const std::string &debugName, const std::string &clientName)
Definition: SonicClientBase.cc:5
SonicClientBase::evaluate
virtual void evaluate()=0
ParameterSetDescription.h
SonicClientBase::reset
virtual void reset()
Definition: SonicClientBase.h:37
SonicMode::PseudoAsync
SonicDispatcher
Definition: SonicDispatcher.h:8
SonicMode::Sync
SonicClientBase::mode_
SonicMode mode_
Definition: SonicClientBase.h:54
edm::ParameterSet
Definition: ParameterSet.h:47
SonicMode::Async
SonicClientBase::fullDebugName_
std::string fullDebugName_
Definition: SonicClientBase.h:60
WaitingTaskWithArenaHolder.h
SonicClientBase::debugName_
std::string debugName_
Definition: SonicClientBase.h:60
SonicDispatcher.h
SonicClientBase::allowedTries_
unsigned allowedTries_
Definition: SonicClientBase.h:56
SonicClientBase::dispatcher_
std::unique_ptr< SonicDispatcher > dispatcher_
Definition: SonicClientBase.h:55
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
SonicClientBase::start
void start()
Definition: SonicClientBase.cc:43
SonicClientBase::dispatch
virtual void dispatch(edm::WaitingTaskWithArenaHolder holder)
Definition: SonicClientBase.h:31
ParameterSet.h
SonicClientBase::mode
SonicMode mode() const
Definition: SonicClientBase.h:28
SonicClientBase::clientName_
std::string clientName_
Definition: SonicClientBase.h:60
SonicClientBase::holder_
std::optional< edm::WaitingTaskWithArenaHolder > holder_
Definition: SonicClientBase.h:57
SonicClientBase::setMode
void setMode(SonicMode mode)
Definition: SonicClientBase.cc:26