forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 2
Test PR for new Retry Framework #19
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
Open
kakwok
wants to merge
6
commits into
fastmachinelearning:master
Choose a base branch
from
kakwok:SonicRetry_CMSSW_15_0_0_pre3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c1dce2b
RetryAction compiles
4dde1c6
Include RetryAction in SonicClientBase
5b093e4
Update PR comments
c062112
PR comments, fix fillDescriptions
ca570d7
Move RetrySameServerAction to plugins. SonicTriton test works.
fe03eb4
Add update server function for client
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"/> | ||
<library file="*.cc" name="pluginHeterogeneousCoreSonicCore"/> | ||
|
30 changes: 30 additions & 0 deletions
30
HeterogeneousCore/SonicCore/plugins/RetrySameServerAction.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."; | ||
} | ||
} | ||
|
||
EDM_REGISTER_PLUGINFACTORY(RetryActionFactory, "RetryActionFactory"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ class TritonClient : public SonicClient<TritonInputMap, TritonOutputMap> { | |
bool handle_exception(F&& call); | ||
|
||
void reportServerSideStats(const ServerSideStats& stats) const; | ||
void updateServer(std::string serverName); | ||
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.
|
||
ServerSideStats summarizeServerStats(const inference::ModelStatistics& start_status, | ||
const inference::ModelStatistics& end_status) const; | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.