Skip to content

Commit 22c151d

Browse files
authored
[QC-1041] Reset checkrunner (#2062)
* add a reset method to Check and CheckInterface. * explanations * format
1 parent 46cc246 commit 22c151d

7 files changed

Lines changed: 28 additions & 4 deletions

File tree

Framework/include/QualityControl/Check.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Check
6060
* Expected to run in the init phase of the FairDevice
6161
*/
6262
void init();
63+
void reset();
6364

6465
core::QualityObjectsType check(std::map<std::string, std::shared_ptr<o2::quality_control::core::MonitorObject>>& moMap);
6566

Framework/include/QualityControl/CheckInterface.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,20 @@ class CheckInterface : public UserCodeInterface
6060
/// parameter is to be used to pass the result of the check of the same class.
6161
virtual void beautify(std::shared_ptr<core::MonitorObject> mo, core::Quality checkResult) = 0;
6262

63+
/// \brief Reset the state of this Check.
64+
///
65+
/// This method should reset the state, if any, of the Check implemented here.
66+
/// It will typically be called in between runs.
67+
/// For example, if you have counters or you keep the state of an object from one call to the other,
68+
/// then this should be reset here.
69+
virtual void reset(); // not fully abstract because we don't want to change all the existing subclasses
70+
6371
/// \brief Returns the name of the class that can be treated by this check.
6472
///
6573
/// The name of the class returned by this method will be checked against the MonitorObject's encapsulated
6674
/// object's class. If it is the same or a parent then the check will be applied. Therefore, this method
6775
/// must return the highest class in the hierarchy that this check can use.
6876
/// If the class does not override it, we return "TObject".
69-
///
70-
/// \author Barthelemy von Haller
7177
virtual std::string getAcceptedType();
7278

7379
void setActivity(std::shared_ptr<core::Activity> activity) { mActivity = activity; }

Framework/src/Check.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ void Check::init()
8585
ILOG(Info, Devel) << ENDM;
8686
}
8787

88+
void Check::reset()
89+
{
90+
mCheckInterface->reset();
91+
}
92+
8893
QualityObjectsType Check::check(std::map<std::string, std::shared_ptr<MonitorObject>>& moMap)
8994
{
9095
if (mCheckInterface == nullptr) {

Framework/src/CheckInterface.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,9 @@ void CheckInterface::configure()
4545
// noop, override it if you want.
4646
}
4747

48+
void CheckInterface::reset()
49+
{
50+
// noop, override it if you want.
51+
}
52+
4853
} // namespace o2::quality_control::checker

Framework/src/CheckRunner.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,12 @@ void CheckRunner::stop()
533533

534534
void CheckRunner::reset()
535535
{
536-
ILOG(Info, Devel) << "Reset" << ENDM;
537-
538536
try {
539537
mCollector.reset();
540538
mActivity = make_shared<Activity>();
539+
for (auto& [checkName, check] : mChecks) {
540+
check.reset();
541+
}
541542
} catch (...) {
542543
// we catch here because we don't know where it will go in DPL's CallbackService
543544
ILOG(Error, Support) << "Error caught in reset() : "

Modules/Skeleton/include/Skeleton/SkeletonCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class SkeletonCheck : public o2::quality_control::checker::CheckInterface
3737
Quality check(std::map<std::string, std::shared_ptr<MonitorObject>>* moMap) override;
3838
void beautify(std::shared_ptr<MonitorObject> mo, Quality checkResult = Quality::Null) override;
3939
std::string getAcceptedType() override;
40+
void reset() override;
4041

4142
ClassDefOverride(SkeletonCheck, 2);
4243
};

Modules/Skeleton/src/SkeletonCheck.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,9 @@ void SkeletonCheck::beautify(std::shared_ptr<MonitorObject> mo, Quality checkRes
8888
}
8989
}
9090

91+
void SkeletonCheck::reset()
92+
{
93+
ILOG(Debug, Devel) << "SkeletonCheck::reset" << ENDM;
94+
}
95+
9196
} // namespace o2::quality_control_modules::skeleton

0 commit comments

Comments
 (0)