Skip to content

Commit 19bd6ea

Browse files
committed
Add CCDB backend to QC
QC-53
1 parent db327c2 commit 19bd6ea

14 files changed

Lines changed: 416 additions & 25 deletions

Framework/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ set(SRCS
7373
src/TaskDevice.cxx
7474
src/SpyDevice.cxx
7575
src/SpyMainFrame.cxx
76+
src/CcdbDatabase.cxx
7677
)
7778

7879
set(HEADERS # needed for the dictionary generation
7980
include/QualityControl/MonitorObject.h
8081
include/QualityControl/Quality.h
8182
include/QualityControl/CheckInterface.h
8283
include/QualityControl/SpyMainFrame.h
84+
include/QualityControl/DatabaseInterface.h
85+
include/QualityControl/CcdbDatabase.h
8386
)
8487

8588
if(MYSQL_FOUND)

Framework/example-default.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
implementation=MockSampler
88

99
[database]
10+
;implementation=MySql
1011
username=qc_user
1112
password=qc_user
12-
host=localhost
13+
;host=localhost
1314
name=quality_control
15+
implementation=CCDB
16+
host=localhost:8080
1417

1518
[Activity] # Similar to a "run"
1619
number=42
@@ -42,6 +45,7 @@ taskDefinition=daqTaskDefinition
4245
className=o2::quality_control_modules::daq::DaqTask
4346
moduleName=QcDaq
4447
moduleOfChecks=QcExample
48+
maxNumberCycles=-1
4549

4650
[benchmarkTask_0]
4751
taskDefinition=benchmark
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// Created by bvonhall on 17/10/17.
3+
//
4+
5+
#ifndef PROJECT_CCDBDATABASE_H
6+
#define PROJECT_CCDBDATABASE_H
7+
8+
#include <curl/curl.h>
9+
#include "QualityControl/DatabaseInterface.h"
10+
11+
namespace o2 {
12+
namespace quality_control {
13+
namespace repository {
14+
15+
/*
16+
* Notes
17+
* - having 1 file per object per version server-side might lead to a tremendous number of files.
18+
* - how to add a new filter ? such as expert/shifter flag
19+
* - we really need a C++ interface hiding the curl complexity.
20+
* - what are those time intervals ? what does it mean for us ?
21+
* - how to know the real time at which the object was stored ?
22+
* - we rather have a task_name/X/Y/Z/object_name/.../time where X/Y/Z are actually part of object_name but happen to have slashes, to build a hierarchy of objects
23+
* - we need to have a way to query for all objects in a certain path, e.g. in "task_name/X/Y" or in "task_name"
24+
* - when retrieving an object, despite what the usage menu says, the time can't be omitted.
25+
* - initial tests show that it seems pretty slow.
26+
* - We need getListOfTasksWithPublications() and getPublishedObjectNames()
27+
*/
28+
29+
class CcdbDatabase : public DatabaseInterface
30+
{
31+
public:
32+
CcdbDatabase();
33+
void connect(std::string host, std::string database, std::string username, std::string password) override;
34+
void store(o2::quality_control::core::MonitorObject *mo) override;
35+
core::MonitorObject *retrieve(std::string taskName, std::string objectName) override;
36+
void disconnect() override;
37+
void prepareTaskDataContainer(std::string taskName) override;
38+
std::vector<std::string> getListOfTasksWithPublications() override;
39+
std::vector<std::string> getPublishedObjectNames(std::string taskName) override;
40+
41+
private:
42+
core::MonitorObject *downloadObject( std::string location);
43+
std::string getObjectPath(std::string taskName, std::string objectName);
44+
45+
std::string url;
46+
};
47+
48+
}
49+
}
50+
}
51+
52+
#endif //PROJECT_CCDBDATABASE_H

Framework/include/QualityControl/DatabaseInterface.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class DatabaseInterface
2828
{
2929
}
3030

31-
virtual void connect(std::string username, std::string password) = 0;
3231
virtual void connect(std::string host, std::string database, std::string username, std::string password) = 0;
3332
virtual void store(o2::quality_control::core::MonitorObject* mo) = 0;
3433

Framework/include/QualityControl/MySqlDatabase.h

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

30-
void connect(std::string username, std::string password) override;
30+
// void connect(std::string username, std::string password) override;
3131
void connect(std::string host, std::string database, std::string username, std::string password) 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;

0 commit comments

Comments
 (0)