Skip to content

Commit c4d6848

Browse files
authored
Add userCodeName and dataSources to UserCodeConfig (#2636)
Since all of the UserCodeConfig children share a name and data sources, we can brings them to the parent.
1 parent 8655e47 commit c4d6848

14 files changed

Lines changed: 36 additions & 31 deletions

File tree

Framework/include/QualityControl/AggregatorConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ namespace o2::quality_control::checker
3131

3232
/// \brief Container for the configuration of an Aggregator.
3333
struct AggregatorConfig : public o2::quality_control::core::UserCodeConfig {
34-
std::string name;
3534
UpdatePolicyType policyType = UpdatePolicyType::OnAny;
3635
std::vector<std::string> objectNames{}; // fixme: if object names are empty, allObjects are true, consider reducing to one var // fixme: duplicates "sources"
3736
bool allObjects = false;

Framework/include/QualityControl/CheckConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ namespace o2::quality_control::checker
2929

3030
/// \brief Container for the configuration of a Check.
3131
struct CheckConfig : public o2::quality_control::core::UserCodeConfig {
32-
std::string name;
3332
UpdatePolicyType policyType = UpdatePolicyType::OnAny;
3433
std::vector<std::string> objectNames{}; // fixme: if object names are empty, allObjects are true, consider reducing to one var
3534
bool allObjects = false;

Framework/include/QualityControl/TaskRunnerConfig.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ namespace o2::quality_control::core
4242
/// \brief Container for the configuration of a Task
4343
struct TaskRunnerConfig : public UserCodeConfig {
4444
std::string deviceName;
45-
std::string taskName;
4645
std::vector<std::pair<size_t, size_t>> cycleDurations = {};
4746
int maxNumberCycles;
4847
bool critical;

Framework/include/QualityControl/UserCodeConfig.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,22 @@
1919

2020
#include "QualityControl/CustomParameters.h"
2121
#include "QualityControl/stringUtils.h"
22+
#include "QualityControl/DataSourceSpec.h"
2223

2324
namespace o2::quality_control::core
2425
{
2526

2627
/// \brief Container for the configuration of a Task
2728
struct UserCodeConfig {
29+
std::string name; // task name, check name, etc...
2830
std::string moduleName;
2931
std::string className;
3032
std::string detectorName = "MISC"; // intended to be the 3 letters code;
3133
std::string consulUrl;
3234
CustomParameters customParameters;
3335
std::string ccdbUrl;
3436
std::unordered_map<std::string, std::string> repository; // we need the full config of the database to build the database in the subclasses
37+
std::vector<DataSourceSpec> dataSources;
3538
};
3639

3740
} // namespace o2::quality_control::core

Framework/src/Aggregator.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,15 @@ AggregatorConfig Aggregator::extractConfig(const core::CommonSpec& commonSpec, c
240240
}
241241

242242
return {
243+
aggregatorSpec.aggregatorName,
243244
aggregatorSpec.moduleName,
244245
aggregatorSpec.className,
245246
aggregatorSpec.detectorName,
246247
commonSpec.consulUrl,
247248
aggregatorSpec.customParameters,
248249
commonSpec.conditionDBUrl,
249250
commonSpec.database,
250-
aggregatorSpec.aggregatorName,
251+
aggregatorSpec.dataSources,
251252
updatePolicy,
252253
std::move(objectNames),
253254
checkAllObjects,

Framework/src/Check.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,15 @@ CheckConfig Check::extractConfig(const CommonSpec& commonSpec, const CheckSpec&
267267
}
268268

269269
return {
270+
checkSpec.checkName,
270271
checkSpec.moduleName,
271272
checkSpec.className,
272273
checkSpec.detectorName,
273274
commonSpec.consulUrl,
274275
checkSpec.customParameters,
275276
commonSpec.conditionDBUrl,
276277
commonSpec.database,
277-
checkSpec.checkName,
278+
checkSpec.dataSources,
278279
updatePolicy,
279280
std::move(objectNames),
280281
checkAllObjects,

Framework/src/TaskFactory.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace o2::quality_control::core
2424
TaskInterface* TaskFactory::create(const TaskRunnerConfig& taskConfig, std::shared_ptr<ObjectsManager> objectsManager)
2525
{
2626
auto* result = root_class_factory::create<TaskInterface>(taskConfig.moduleName, taskConfig.className);
27-
result->setName(taskConfig.taskName);
27+
result->setName(taskConfig.name);
2828
result->setObjectsManager(objectsManager);
2929
result->setCustomParameters(taskConfig.customParameters);
3030
result->setCcdbUrl(taskConfig.ccdbUrl);

Framework/src/TaskRunner.cxx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ TaskRunner::~TaskRunner()
8585

8686
void TaskRunner::init(InitContext& iCtx)
8787
{
88-
core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.taskName, mTaskConfig.detectorName);
88+
core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.name, mTaskConfig.detectorName);
8989
ILOG(Info, Devel) << "Initializing TaskRunner" << ENDM;
9090

9191
printTaskConfig();
@@ -103,11 +103,11 @@ void TaskRunner::init(InitContext& iCtx)
103103
// setup monitoring
104104
mCollector = MonitoringFactory::Get(mTaskConfig.monitoringUrl);
105105
mCollector->addGlobalTag(tags::Key::Subsystem, tags::Value::QC);
106-
mCollector->addGlobalTag("TaskName", mTaskConfig.taskName);
106+
mCollector->addGlobalTag("TaskName", mTaskConfig.name);
107107
mCollector->addGlobalTag("DetectorName", mTaskConfig.detectorName);
108108

109109
// setup publisher
110-
mObjectsManager = std::make_shared<ObjectsManager>(mTaskConfig.taskName, mTaskConfig.className, mTaskConfig.detectorName, mTaskConfig.parallelTaskID);
110+
mObjectsManager = std::make_shared<ObjectsManager>(mTaskConfig.name, mTaskConfig.className, mTaskConfig.detectorName, mTaskConfig.parallelTaskID);
111111
mObjectsManager->setMovingWindowsList(mTaskConfig.movingWindows);
112112

113113
// setup timekeeping
@@ -374,11 +374,11 @@ bool TaskRunner::isDataReady(const framework::InputRecord& inputs)
374374

375375
void TaskRunner::printTaskConfig() const
376376
{
377-
ILOG(Info, Devel) << "Configuration loaded > Task name : " << mTaskConfig.taskName //
378-
<< " / Module name : " << mTaskConfig.moduleName //
379-
<< " / Detector name : " << mTaskConfig.detectorName //
380-
<< " / Max number cycles : " << mTaskConfig.maxNumberCycles //
381-
<< " / critical : " << mTaskConfig.critical //
377+
ILOG(Info, Devel) << "Configuration loaded > Task name : " << mTaskConfig.name //
378+
<< " / Module name : " << mTaskConfig.moduleName //
379+
<< " / Detector name : " << mTaskConfig.detectorName //
380+
<< " / Max number cycles : " << mTaskConfig.maxNumberCycles //
381+
<< " / critical : " << mTaskConfig.critical //
382382
<< " / Save to file : " << mTaskConfig.saveToFile
383383
<< " / Cycle duration seconds : ";
384384
for (auto& [cycleDuration, period] : mTaskConfig.cycleDurations) {
@@ -437,7 +437,7 @@ void TaskRunner::registerToBookkeeping()
437437
if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration
438438
// register ourselves to the BK at the first cycle
439439
ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM;
440-
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, "");
440+
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.name, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, "");
441441
}
442442
}
443443

Framework/src/TaskRunnerFactory.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,16 @@ TaskRunnerConfig TaskRunnerFactory::extractConfig(const CommonSpec& globalConfig
169169
o2::globaltracking::RecoContainer rd;
170170

171171
return {
172+
taskSpec.taskName,
172173
taskSpec.moduleName,
173174
taskSpec.className,
174175
InfrastructureSpecReader::validateDetectorName(taskSpec.detectorName),
175176
globalConfig.consulUrl,
176177
taskSpec.customParameters,
177178
globalConfig.conditionDBUrl,
178179
globalConfig.database,
180+
taskSpec.dataSources,
179181
deviceName,
180-
taskSpec.taskName,
181182
multipleCycleDurations,
182183
taskSpec.maxNumberCycles,
183184
taskSpec.critical,

Framework/test/testCheck.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,15 @@ TEST_CASE("test_check_postprocessing")
144144

145145
TEST_CASE("test_check_activity")
146146
{
147-
Check check({ "QcSkeleton",
147+
Check check({ "test",
148+
"QcSkeleton",
148149
"o2::quality_control_modules::skeleton::SkeletonCheck",
149150
"TST",
150151
"",
151152
{},
152153
"something",
153154
{ { "implementation", "CCDB" }, { "host", "something" } },
154-
"test",
155+
{},
155156
UpdatePolicyType::OnAny,
156157
{},
157158
true });

0 commit comments

Comments
 (0)