Skip to content

Commit

Permalink
Added output operator for application state to report state in loggin…
Browse files Browse the repository at this point in the history
…g messages
  • Loading branch information
GeirHorn committed Jul 2, 2024
1 parent d5ce2b3 commit 1780e26
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
{
"name": "Linux",
"includePath": [
"/home/GHo/Documents/Code/NebulOuS/Solvers/",
"${workspaceFolder}/**",
"/usr/include/c++/14/",
"/usr/include/linux/",
"/home/GHo/Documents/Code/NebulOuS/Solver/",
"/home/GHo/Documents/Code/Theron++/",
"/home/GHo/Documents/Code/CxxOpts/include/",
"/opt/AMPL/amplapi/include",
"${workspaceFolder}/**",
"/usr/include/c++/13/",
"/usr/include/linux/"
"/opt/AMPL/amplapi/include"
],
"defines": [],
"cStandard": "gnu23",
"cStandard": "c23",
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "/usr/lib64/ccache/g++",
"compilerArgs": [
Expand All @@ -27,11 +27,11 @@
"configurationProvider": "ms-vscode.makefile-tools",
"browse": {
"path": [
"/home/GHo/Documents/Code/NebulOuS/Solvers",
"/home/GHo/Documents/Code/NebulOuS/Solver",
"/home/GHo/Documents/Code/Theron++/",
"/home/GHo/Documents/Code/CxxOpts/include/",
"/opt/AMPL/amplapi/include/",
"/usr/include/c++/13/",
"/usr/include/c++/14/",
"/usr/include/linux/"
],
"limitSymbolsToIncludedHeaders": false
Expand Down
1 change: 1 addition & 0 deletions MetricUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ void MetricUpdater::SLOViolationHandler(
{
Output << "... failed to forward the application execution context (size: "
<< MetricValues.size() << "," << " Unset: " << UnsetMetrics
<< " Application state: " << ApplicationState
<< ")" << std::endl;

if( MetricValues.empty() )
Expand Down
32 changes: 31 additions & 1 deletion MetricUpdater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class MetricUpdater
Ready, // The application is ready for deployment
Deploying, // The application is being deployed or redeployed
Running, // The application is running
Failed // The application is in an invalid state
Failed // The application is in an invalid state
};

// An arriving lifecycle message indicates a change in state and it is
Expand All @@ -264,6 +264,36 @@ class MetricUpdater

operator State() const;

// There is a need to be able to report the current state of the
// application in textual form, and it is therefore an inverse mapping
// that takes the application state and prints it out as a string to
// the given output stream.

friend std::ostream & operator << ( std::ostream & Output,
const State ApplicationState )
{
switch ( ApplicationState )
{
case State::Deploying :
Output << "Deploying";
break;
case State::Failed :
Output << "Failed";
break;
case State::New :
Output << "New";
break;
case State::Ready :
Output << "Ready";
break;
case State::Running :
Output << "Running";
break;
}

return Output;
}

// Constructors and destructor

ApplicationLifecycle( void )
Expand Down

0 comments on commit 1780e26

Please sign in to comment.