Closed andreh12 closed 7 years ago
Andre,
Thanks for your contribution to this LM. I have few comments after reviewing the changes which may be useful in the future;
Please note that the register
method of Context
class works in the way that it appends the element to given key not replaces it. So the code:
context.register("ORIGERRMSG", "-");
in the beginning of the analysis will add "-" to the context key "ORIGERRMSG"
and when you call it later with the actual error message:
context.register("ORIGERRMSG", syncLossRU.getErrorMsg());
will result with displaying both "-" and actual message:
Run blocked by out-of-sync data from FED 548, RU ru-c2e14-27-01.cms is in syncloss. Problem FED belongs to TTCP ES+ in ES subsystem. Original error message: ["Caught exception: exception::MismatchDetected 'Mismatch detected: expected evb id runNumber=286488 lumiSection=301 resyncCount=4 eventNumber=1247256 bxId=1459, but found evb id runNumber=286488 *resyncCount=5 eventNumber=1 bxId=2206 in data block from FED 548 (ES)' raised at append(/usr/local/src/xdaq/baseline13/trunk/daq/evb/src/common/readoutunit/SuperFragment.cc:32)","-"]
The reason why I implemented it in this way is that you can easily register lists of elements in analysis code. For instance whey you report the problematic FED ids (many).
We can add another method which will replace old values not append if that would be useful but for the time being I've changed the code so it follows this idea.
Another thing is that you don't have to register action keys if they are unknown:
context.setActionKey("(unknown subsystem)");
The idea behind action keys is that sometimes you want different suggestions (action steps) depending on some variable. For this there is ConditionalAction
class when you can define different list of actions based on single key. Like here:
/* Default action */
ConditionalAction action = new ConditionalAction("Try to recover (try up to 2 times)",
"Stop the run. Red & green recycle the subsystem. Start a new Run",
"Problem not fixed: Call the DOC of {{SUBSYSTEM}} (subsystem that caused the SyncLoss)",
"Problem fixed: Make an e-log entry."
+ "Call the DOC {{SUBSYSTEM}} (subsystem that caused the SyncLoss) to inform about the problem");
/* SUBSYSTEM=Tracker action */
action.addContextSteps("TRACKER", "Try to recover (try up to 2 times)", "Stop the run, Start a new run.",
"Problem not fixed: Call the DOC of {{SUBSYSTEM}} (subsystem that caused the SyncLoss)",
"Problem fixed: Make an e-log entry."
+ "Call the DOC {{SUBSYSTEM}} (subsystem that caused the SyncLoss) to inform about the problem");
this.action = action;
If you don't set the action key at all the default suggestion will be delivered. Only if you set the action key to 'TRACKER' the second recovery suggestion will be delivered. If any other string is set the default action will be selected. Note that there is also SimpleAction
class which should be used when you want to always show the same suggestion.
I will put this details to documentation at some point.
Cheers Maciej
Thanks a lot @gladky for the review and the instructions how to better use the Action
class.
includes two test cases
fixes #57