-
Notifications
You must be signed in to change notification settings - Fork 2
SonicRetry combined PR[CMSSW_15_1_0_pre6] #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
71fc1e1
c111b04
7d33515
36e0e68
5d498b1
70e7b26
cd7ee5e
b41f499
e7b9004
6336d0b
29414ad
acfb4c9
a3a3811
71b2349
7dc9e71
49c9550
318634f
34642d7
db3f079
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef HeterogeneousCore_SonicCore_RetryActionBase | ||
#define HeterogeneousCore_SonicCore_RetryActionBase | ||
|
||
#include "FWCore/PluginManager/interface/PluginFactory.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
#include "HeterogeneousCore/SonicCore/interface/SonicClientBase.h" | ||
#include <memory> | ||
#include <string> | ||
|
||
// Base class for retry actions | ||
class RetryActionBase { | ||
public: | ||
RetryActionBase(const edm::ParameterSet& conf, SonicClientBase* client); | ||
virtual ~RetryActionBase() = default; | ||
|
||
bool shouldRetry() const { return shouldRetry_; } // Getter for shouldRetry_ | ||
|
||
virtual void retry() = 0; // Pure virtual function for execution logic | ||
virtual void start() = 0; // Pure virtual function for execution logic for initialization | ||
|
||
protected: | ||
void eval(); // interface for calling evaluate in client | ||
|
||
protected: | ||
SonicClientBase* client_; | ||
bool shouldRetry_; // Flag to track if further retries should happen | ||
}; | ||
|
||
// Define the factory for creating retry actions | ||
using RetryActionFactory = | ||
edmplugin::PluginFactory<RetryActionBase*(const edm::ParameterSet&, SonicClientBase* client)>; | ||
|
||
#endif | ||
|
||
#define DEFINE_RETRY_ACTION(type) DEFINE_EDM_PLUGIN(RetryActionFactory, type, #type); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/PluginManager"/> | ||
<use name="FWCore/ParameterSet"/> | ||
<use name="HeterogeneousCore/SonicCore"/> | ||
<plugin file="*.cc" name="pluginHeterogeneousCoreSonicCore"/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "HeterogeneousCore/SonicCore/interface/RetryActionBase.h" | ||
#include "HeterogeneousCore/SonicCore/interface/SonicClientBase.h" | ||
|
||
class RetrySameServerAction : public RetryActionBase { | ||
public: | ||
RetrySameServerAction(const edm::ParameterSet& pset, SonicClientBase* client) | ||
: RetryActionBase(pset, client), allowedTries_(pset.getUntrackedParameter<unsigned>("allowedTries", 0)) {} | ||
|
||
void start() override { tries_ = 0; }; | ||
|
||
protected: | ||
void retry() override; | ||
|
||
private: | ||
unsigned allowedTries_, tries_; | ||
}; | ||
|
||
void RetrySameServerAction::retry() { | ||
++tries_; | ||
//if max retries has not been exceeded, call evaluate again | ||
if (tries_ < allowedTries_) { | ||
eval(); | ||
return; | ||
} else { | ||
shouldRetry_ = false; // Flip flag when max retries are reached | ||
edm::LogInfo("RetrySameServerAction") << "Max retry attempts reached. No further retries."; | ||
} | ||
} | ||
|
||
DEFINE_RETRY_ACTION(RetrySameServerAction) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "HeterogeneousCore/SonicCore/interface/RetryActionBase.h" | ||
|
||
// Constructor implementation | ||
RetryActionBase::RetryActionBase(const edm::ParameterSet& conf, SonicClientBase* client) | ||
: client_(client), shouldRetry_(true) {} | ||
|
||
void RetryActionBase::eval() { | ||
if (client_) { | ||
client_->evaluate(); | ||
} else { | ||
edm::LogError("RetryActionBase") << "Client pointer is null, cannot evaluate."; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be an exception rather than a LogError. (It may actually need to be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment has not been addressed yet There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But we need to let |
||
} | ||
} | ||
|
||
EDM_REGISTER_PLUGINFACTORY(RetryActionFactory, "RetryActionFactory"); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
<iftool name="cuda"> | ||
<use name="cuda"/> | ||
</iftool> | ||
|
||
<export> | ||
<lib name="1"/> | ||
<lib name="1"/> | ||
</export> |
Uh oh!
There was an error while loading. Please reload this page.