Skip to content

Commit 307d657

Browse files
authored
New config format (#17)
* new configuration key structure * new configuration format (json) * QC-64 * QC-63
1 parent ced4db6 commit 307d657

18 files changed

Lines changed: 339 additions & 124 deletions

Framework/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ O2_GENERATE_EXECUTABLE(
169169
MODULE_LIBRARY_NAME ${LIBRARY_NAME}
170170
BUCKET_NAME ${BUCKET_NAME}
171171
)
172-
Install(FILES qcTaskDplConfig.ini DESTINATION etc/)
173172

174173
if (FAIRROOT_FOUND)
175174
O2_GENERATE_EXECUTABLE(
@@ -213,4 +212,5 @@ endif()
213212

214213
# Install extra scripts
215214
install(PROGRAMS script/qcDatabaseSetup.sh DESTINATION bin)
216-
install(FILES example-default.ini alfa.json DESTINATION etc)
215+
install(FILES example-default.ini example-default.json alfa.json DESTINATION etc)
216+
Install(FILES qcTaskDplConfig.ini qcTaskDplConfig.json DESTINATION etc/)

Framework/example-default.ini

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1+
2+
; DEPRECATED
3+
14
;===============================
25
; General
36
;-------------------------------
47

5-
[DataSampling]
8+
[qc/config/DataSampling]
69
;implementation=FairSampler
710
implementation=MockSampler
811

9-
[database]
12+
[qc/config/database]
1013
implementation=MySql
1114
username=qc_user
1215
password=qc_user
@@ -15,21 +18,21 @@ name=quality_control
1518
#implementation=CCDB
1619
#host=localhost:8080
1720

18-
[Activity] # Similar to a "run"
21+
[qc/config/Activity] # Similar to a "run"
1922
number=42
2023
type=2
2124

2225
;===============================
2326
; Tasks
2427
;-------------------------------
2528

26-
[myTask_1] # Dummy task 1
27-
taskDefinition=taskDefinition_1
29+
[qc/task_config/myTask_1] # Dummy task 1
30+
taskDefinition=qc/task_config/taskDefinition_1
2831

29-
[myTask_2] # Dummy task 2
30-
taskDefinition=taskDefinition_1
32+
[qc/task_config/myTask_2] # Dummy task 2
33+
taskDefinition=qc/task_config/taskDefinition_1
3134

32-
[taskDefinition_1] # Actual definition of the dummy tasks
35+
[qc/task_config/taskDefinition_1] # Actual definition of the dummy tasks
3336
;className=o2::quality_control_modules::skeleton::SkeletonTask
3437
className=o2::quality_control_modules::example::ExampleTask
3538
moduleName=QcExample
@@ -38,22 +41,22 @@ cycleDurationSeconds=10
3841
maxNumberCycles=-1
3942
;exampleTaskOutput=0
4043

41-
[daqTask]
42-
taskDefinition=daqTaskDefinition
44+
[qc/task_config/daqTask]
45+
taskDefinition=qc/task_config/daqTaskDefinition
4346

44-
[daqTaskDefinition]
47+
[qc/task_config/daqTaskDefinition]
4548
className=o2::quality_control_modules::daq::DaqTask
4649
moduleName=QcDaq
4750
moduleOfChecks=QcExample
4851
maxNumberCycles=-1
4952

50-
[benchmarkTask_0]
51-
taskDefinition=benchmark
52-
;[benchmarkTask_1]
53+
[qc/task_config/benchmarkTask_0]
54+
taskDefinition=qc/task_config/benchmark
55+
;[qc/benchmarkTask_1]
5356
;taskDefinition=benchmark
5457
;address=tcp://*:5556
5558

56-
[benchmark] # Benchmark tasks definition
59+
[qc/task_config/benchmark] # Benchmark tasks definition
5760
className=o2::quality_control_modules::example::BenchmarkTask
5861
moduleName=QcExample
5962
numberHistos=1
@@ -66,15 +69,15 @@ cycleDurationSeconds=1
6669
; Checkers
6770
;-------------------------------
6871

69-
[checkers] ; needed for the time being because we don't have an information service
72+
[qc/checkers_config] ; needed for the time being because we don't have an information service
7073
numberCheckers=1
7174
numberTasks=1
7275
tasksAddresses=tcp://localhost:5556,tcp://localhost:5557,tcp://localhost:5558,tcp://localhost:5559
7376

74-
[checker_0]
77+
[qc_checkers_config_checker_0]
7578
broadcast=0
7679
broadcastAddress=tcp://*:5600
7780
id=0
7881

79-
[Checks]
82+
[qc/checkers_config/Checks]
8083
checkMeanIsAbove/threshold=1

Framework/example-default.json

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"DataSampling": {
5+
"implementation": "MockSampler"
6+
},
7+
"database": {
8+
"username": "qc_user",
9+
"password": "qc_user",
10+
"name": "quality_control",
11+
"implementation": "CCDB",
12+
"host": "localhost:8080"
13+
},
14+
"Activity": {
15+
"number": "42",
16+
"type": "2"
17+
}
18+
},
19+
"tasks_config": {
20+
"myTask_1": {
21+
"taskDefinition": "taskDefinition_1"
22+
},
23+
"myTask_2": {
24+
"taskDefinition": "taskDefinition_1"
25+
},
26+
"taskDefinition_1": {
27+
"className": "o2::quality_control_modules::example::ExampleTask",
28+
"moduleName": "QcExample",
29+
"cycleDurationSeconds": "10",
30+
"maxNumberCycles": "-1"
31+
},
32+
"daqTask": {
33+
"taskDefinition": "daqTaskDefinition"
34+
},
35+
"daqTaskDefinition": {
36+
"className": "o2::quality_control_modules::daq::DaqTask",
37+
"moduleName": "QcDaq",
38+
"moduleOfChecks": "QcExample",
39+
"maxNumberCycles": "-1",
40+
"cycleDurationSeconds": "10"
41+
},
42+
"benchmarkTask_0": {
43+
"taskDefinition": "benchmark"
44+
},
45+
"benchmark": {
46+
"className": "o2::quality_control_modules::example::BenchmarkTask",
47+
"moduleName": "QcExample",
48+
"numberHistos": "1",
49+
"numberChecks": "1",
50+
"typeOfChecks": "o2::quality_control_modules::example::FakeCheck",
51+
"moduleOfChecks": "QcExample",
52+
"cycleDurationSeconds": "1"
53+
}
54+
},
55+
"checkers_config": {
56+
"numberCheckers": "1",
57+
"numberTasks": "1",
58+
"tasksAddresses": "tcp://localhost:5556,tcp://localhost:5557,tcp://localhost:5558,tcp://localhost:5559",
59+
"checker_0": {
60+
"broadcast": "0",
61+
"broadcastAddress": "tcp://*:5600",
62+
"id": "0"
63+
},
64+
"Checks": {
65+
"checkMeanIsAbove/threshold": "1"
66+
}
67+
}
68+
}
69+
}

Framework/include/QualityControl/CcdbDatabase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class CcdbDatabase : public DatabaseInterface
5353
public:
5454
CcdbDatabase() = default;
5555
void connect(std::string host, std::string database, std::string username, std::string password) override;
56+
void connect(std::unique_ptr<ConfigurationInterface> &config) override;
5657
void store(o2::quality_control::core::MonitorObject *mo) override;
5758
core::MonitorObject *retrieve(std::string taskName, std::string objectName) override;
5859
void disconnect() override;

Framework/include/QualityControl/DatabaseInterface.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88

99
#include "QualityControl/MonitorObject.h"
1010
#include <memory>
11+
#include <Configuration/ConfigurationInterface.h>
12+
//#include <bits/unique_ptr.h>
1113

1214
namespace o2 {
1315
namespace quality_control {
1416
namespace repository {
1517

18+
using namespace o2::configuration;
19+
1620
/// \brief The interface to the MonitorObject's repository.
1721
///
1822
/// \author Barthélémy von Haller
@@ -28,7 +32,27 @@ class DatabaseInterface
2832
{
2933
}
3034

35+
/**
36+
* Connects to the database.
37+
* For some implementations, this is a noop.
38+
* @param host
39+
* @param database
40+
* @param username
41+
* @param password
42+
* @deprecated
43+
*/
3144
virtual void connect(std::string host, std::string database, std::string username, std::string password) = 0;
45+
/**
46+
* Connects to the database.
47+
* For some implementations, this is a noop.
48+
* @param config Configuration where the connection parameters are stored.
49+
*/
50+
virtual void connect(std::unique_ptr<ConfigurationInterface> &config) = 0;
51+
52+
/**
53+
* Stores the serialized MonitorObject in the database.
54+
* @param mo The MonitorObject to serialize and store.
55+
*/
3256
virtual void store(o2::quality_control::core::MonitorObject* mo) = 0;
3357

3458
/**

Framework/include/QualityControl/MySqlDatabase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class MySqlDatabase: public DatabaseInterface
2727
/// Destructor
2828
~MySqlDatabase() override;
2929

30-
// void connect(std::string username, std::string password) override;
3130
void connect(std::string host, std::string database, std::string username, std::string password) override;
31+
void connect(std::unique_ptr<ConfigurationInterface> &config) override;
3232
void store(o2::quality_control::core::MonitorObject* mo) override;
3333
o2::quality_control::core::MonitorObject* retrieve(std::string taskName, std::string objectName) override;
3434
void disconnect() override;

Framework/qcTaskDplConfig.ini

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
2+
; DEPRECATED
3+
14
;===============================
25
; General
36
;-------------------------------
47

5-
[DataSampling]
8+
[qc/config/DataSampling]
69
# list of tasks that need Data Sampling
710
tasksList=skeletonTask
811
# Generate time-pipelined dispatchers if data sources are time-pipelined. When disabled, one dispatcher will be generated for the same time-pipelined Data Processors.
@@ -12,7 +15,7 @@ enableParallelDispatchers=0
1215
# Now it does nothing.
1316
enableProxy=0
1417

15-
[database]
18+
[qc/config/database]
1619
;implementation=MySql
1720
username=qc_user
1821
password=qc_user
@@ -21,18 +24,18 @@ name=quality_control
2124
implementation=CCDB
2225
host=localhost:8080
2326

24-
[Activity] # Similar to a "run"
27+
[qc/config/Activity] # Similar to a "run"
2528
number=42
2629
type=2
2730

2831
;===============================
2932
; Tasks
3033
;-------------------------------
31-
[skeletonTask]
34+
[qc/task_config/skeletonTask]
3235
# Indirection to the actual task definition.
3336
taskDefinition=skeletonTaskDefinition
3437

35-
[skeletonTaskDefinition]
38+
[qc/task_config/skeletonTaskDefinition]
3639
# The name of your class, with full namespace.
3740
className=o2::quality_control_modules::skeleton_dpl::SkeletonTaskDPL
3841
# Which library contains the class.
@@ -52,7 +55,7 @@ fraction=0.1
5255
# Choose specific subSpec of data. Set to -1 to choose all (or if you don't know what that means)
5356
subSpec=-1
5457

55-
[readoutInput] # Sampled data specification, referenced in the 'inputs' field above.
58+
[qc/task_config/readoutInput] # Sampled data specification, referenced in the 'inputs' field above.
5659
# Binding, that you will use to access data in the QC code.
5760
inputName=readout
5861
# 'Origin' header field of desired data.
@@ -64,15 +67,15 @@ dataDescription=RAWDATA
6467
; Checkers
6568
;-------------------------------
6669

67-
[checkers] ; needed for the time being because we don't have an information service
70+
[qc/checkers_config] ; needed for the time being because we don't have an information service
6871
numberCheckers=1
6972
numberTasks=1
7073
tasksAddresses=tcp://localhost:5556,tcp://localhost:5557,tcp://localhost:5558,tcp://localhost:5559
7174

72-
[checker_0]
75+
[qc/checkers_config/checker_0]
7376
broadcast=1
7477
broadcastAddress=tcp://*:5600
7578
id=0
7679

77-
[Checks]
80+
[qc/checkers_config/Checks]
7881
checkMeanIsAbove/threshold=1

Framework/qcTaskDplConfig.json

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"qc": {
3+
"config": {
4+
"DataSampling": {
5+
"implementation": "MockSampler",
6+
"tasksList": "skeletonTask",
7+
"enableTimePipeliningDispatchers": "0",
8+
"enableParallelDispatchers": "0",
9+
"enableProxy": "0"
10+
},
11+
"database": {
12+
"username": "qc_user",
13+
"password": "qc_user",
14+
"name": "quality_control",
15+
"implementation": "CCDB",
16+
"host": "localhost:8080"
17+
},
18+
"Activity": {
19+
"number": "42",
20+
"type": "2"
21+
}
22+
},
23+
"tasks_config": {
24+
"skeletonTask": {
25+
"taskDefinition": "skeletonTaskDefinition"
26+
},
27+
"skeletonTaskDefinition": {
28+
"className": "o2::quality_control_modules::skeleton_dpl::SkeletonTaskDPL",
29+
"moduleName": "QcSkeletonDpl",
30+
"moduleOfChecks": "QcExample",
31+
"outputDataOrigin": "ITS",
32+
"cycleDurationSeconds": "10",
33+
"maxNumberCycles": "-1",
34+
"outputDataDescription": "HIST_SKLT_TASK",
35+
"inputs": "readoutInput",
36+
"fraction": "0.1",
37+
"subSpec": "-1",
38+
"dispatcherType": "DPL",
39+
"channelConfig": ""
40+
},
41+
"readoutInput": {
42+
"inputName": "readout",
43+
"dataOrigin": "ITS",
44+
"dataDescription": "RAWDATA",
45+
"spawnConverter": "0",
46+
"channelConfig" : "",
47+
"converterType" : "incrementalConverter"
48+
}
49+
},
50+
"checkers_config": {
51+
"numberCheckers": "1",
52+
"numberTasks": "1",
53+
"tasksAddresses": "tcp://localhost:5556,tcp://localhost:5557,tcp://localhost:5558,tcp://localhost:5559",
54+
"checker_0": {
55+
"broadcast": "0",
56+
"broadcastAddress": "tcp://*:5600",
57+
"id": "0"
58+
},
59+
"Checks": {
60+
"checkMeanIsAbove/threshold": "1"
61+
}
62+
}
63+
}
64+
}

Framework/src/CcdbDatabase.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ void CcdbDatabase::connect(std::string host, std::string database, std::string u
3535
url = host;
3636
}
3737

38+
void CcdbDatabase::connect(std::unique_ptr<ConfigurationInterface> &config)
39+
{
40+
url = config->get<string>("qc/config/database/host").value();
41+
}
42+
3843
void CcdbDatabase::store(o2::quality_control::core::MonitorObject *mo)
3944
{
4045
// Serialize the object mo

0 commit comments

Comments
 (0)