Skip to content

Commit

Permalink
Merge pull request #282 from sy-c/master
Browse files Browse the repository at this point in the history
v2.26..0
  • Loading branch information
sy-c authored Jul 26, 2024
2 parents a60a11d + abd22fd commit ca0b6d0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 41 deletions.
4 changes: 4 additions & 0 deletions doc/releaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,7 @@ This file describes the main feature changes for each readout.exe released versi

## v2.25.1 - 26/06/224
- o2-readout-status: updated list of P2 FLPs.

## v2.26.0 - 26/07/2024
- Error reporting: fatal error messages logged to operator when there is a state transition error. The first error (if any) that happened is added to the message.
This covers the cases of (among many others): wrong CRU fw version, inconsistent first orbits, no links enabled.
2 changes: 1 addition & 1 deletion src/ReadoutVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#define READOUT_VERSION "2.25.1"
#define READOUT_VERSION "2.26.0"

71 changes: 33 additions & 38 deletions src/mainReadout.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "DataBlock.h"
#include "DataBlockContainer.h"
#include "DataSet.h"
#include "readoutErrorCodes.h"

#ifdef WITH_ZMQ
#include "ZmqServer.hxx"
Expand Down Expand Up @@ -314,59 +315,50 @@ class Readout
}
return -1;
}
int configure(const boost::property_tree::ptree& properties) {

// Wrapper function to catch exception and report fatal errors
int executeFunction(std::string actionName, std::function<int()> f) {
// theLog.log(LogDebugDevel, "Calling function for %s",actionName.c_str());
int err = -1;
try {
return _configure(properties);
err = f();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
if (err) {
std::vector<std::string> m;
theLog.historyGetSummary(m);
std::string reason = "Readout failed in " + actionName + ". Please check previous messages.";
if (m.size()) {
reason += " First error logged was " + m[0];
}
theLog.log(LogFatalOps, "%s", reason.c_str());
}
return err;
}

int configure(const boost::property_tree::ptree& properties) {
theLog.historyReset(1);
return executeFunction("CONFIGURE", std::bind(&Readout::_configure, this, properties));
}
int reset() { // as opposed to configure()
try {
return _reset();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
theLog.historyReset(1);
return executeFunction("RESET", std::bind(&Readout::_reset, this));
}
int start() {
try {
return _start();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
theLog.historyReset(1);
return executeFunction("START", std::bind(&Readout::_start, this));
}
int stop() { // as opposed to start()
try {
return _stop();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
theLog.historyReset(1);
return executeFunction("STOP", std::bind(&Readout::_stop, this));
}
int iterateRunning() {
try {
return _iterateRunning();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
return executeFunction("RUNNING", std::bind(&Readout::_iterateRunning, this));
}
int iterateCheck() {
try {
return _iterateCheck();
}
catch (const std::exception& e) {
theLog.log(LogErrorSupport_(3245), "Exception : %s", e.what());
}
return -1;
return executeFunction("CHECK", std::bind(&Readout::_iterateCheck, this));
}

void loopRunning(); // called in state "running"
Expand Down Expand Up @@ -2261,6 +2253,9 @@ int main(int argc, char* argv[])
// initialize logging
theLogContext.setField(InfoLoggerContext::FieldName::Facility, "readout");
theLog.setContext(theLogContext);
for(const auto &c : readoutErrorCodes) {
theLog.registerErrorCodes({ {std::get<0>(c), std::get<1>(c) } });
}

// create readout instance
std::unique_ptr<Readout> theReadout = std::make_unique<Readout>();
Expand Down
10 changes: 8 additions & 2 deletions src/readoutErrorCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
// cf infoLogger/infoLoggerErrorCodes.h
// Definitions below should be copied there

/*

#include <tuple>
#include <vector>
#include <string>

const std::vector<std::tuple<int, const char *, const char *>> readoutErrorCodes = {

{ 3001, "Trace for readout process status", nullptr},
{ 3002, "Trace for readout configuration", nullptr},
{ 3003, "Trace for readout counters", nullptr},
Expand Down Expand Up @@ -53,5 +59,5 @@
{ 3243, "Control problem", nullptr},
{ 3244, "Should not happen problem", nullptr},
{ 3245, "Unhandled exception", nullptr},
*/

};

0 comments on commit ca0b6d0

Please sign in to comment.