Skip to content

Commit b2b2a74

Browse files
authored
QC-1161 remove unused code for quality flag support (#2524)
* QC-1161 remove unused code for quality flag support * missing header in EMCAL * remove remaining json file installation
1 parent 5db8c28 commit b2b2a74

19 files changed

+3
-546
lines changed

Framework/include/QualityControl/CcdbDatabase.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class CcdbDatabase : public DatabaseInterface
6767
// storage
6868
void storeMO(std::shared_ptr<const o2::quality_control::core::MonitorObject> q) override;
6969
void storeQO(std::shared_ptr<const o2::quality_control::core::QualityObject> q) override;
70-
void storeQCFC(std::shared_ptr<const o2::quality_control::QualityControlFlagCollection> qcfc) override;
7170
void storeAny(const void* obj, std::type_info const& typeInfo, std::string const& path, std::map<std::string, std::string> const& metadata,
7271
std::string const& detectorName, std::string const& taskName, long from = -1, long to = -1) override;
7372

@@ -80,9 +79,6 @@ class CcdbDatabase : public DatabaseInterface
8079
std::shared_ptr<o2::quality_control::core::MonitorObject> retrieveMO(std::string objectPath, std::string objectName, long timestamp = Timestamp::Current, const core::Activity& activity = {}) override;
8180
// retrieval - QO - deprecated
8281
std::shared_ptr<o2::quality_control::core::QualityObject> retrieveQO(std::string qoPath, long timestamp = Timestamp::Current, const core::Activity& activity = {}) override;
83-
std::shared_ptr<o2::quality_control::QualityControlFlagCollection> retrieveQCFC(const std::string& name, const std::string& detector, int runNumber = 0,
84-
const std::string& passName = "", const std::string& periodName = "",
85-
const std::string& provenance = "", long timestamp = -1) override;
8682

8783
// retrieval - general
8884
std::string retrieveJson(std::string path, long timestamp, const std::map<std::string, std::string>& metadata) override;

Framework/include/QualityControl/DatabaseInterface.h

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "QualityControl/QualityObject.h"
2828
#include "QualityControl/MonitorObject.h"
2929
#include "QualityControl/Activity.h"
30-
#include <DataFormatsQualityControl/QualityControlFlagCollection.h>
3130

3231
namespace o2::quality_control::repository
3332
{
@@ -127,11 +126,6 @@ class DatabaseInterface
127126
*/
128127
virtual void storeQO(std::shared_ptr<const o2::quality_control::core::QualityObject> qo) = 0;
129128

130-
/**
131-
* Stores the serialized QualityControlFlagCollection in the database.
132-
* @param qcfc The QualityControlFlagCollection to serialize and store. It should contain correct time validity inside the object.
133-
*/
134-
virtual void storeQCFC(std::shared_ptr<const o2::quality_control::QualityControlFlagCollection> qcfc) = 0;
135129
/**
136130
* \brief Look up a monitor object and return it.
137131
* Look up a monitor object and return it if found or nullptr if not.
@@ -151,13 +145,7 @@ class DatabaseInterface
151145
* @deprecated
152146
*/
153147
virtual std::shared_ptr<o2::quality_control::core::QualityObject> retrieveQO(std::string qoPath, long timestamp = Timestamp::Current, const core::Activity& activity = {}) = 0;
154-
/**
155-
* \brief Look up a QualityControlFlagCollection object and return it.
156-
* Look up a QualityControlFlagCollection and return it if found or nullptr if not.
157-
*/
158-
virtual std::shared_ptr<o2::quality_control::QualityControlFlagCollection> retrieveQCFC(const std::string& name, const std::string& detector, int runNumber = 0,
159-
const std::string& passName = "", const std::string& periodName = "",
160-
const std::string& provenance = "", long timestamp = Timestamp::Current) = 0;
148+
161149
/**
162150
* \brief Look up an object and return it.
163151
* Look up an object and return it if found or nullptr if not. It is a raw pointer because we might need it to build a MO.

Framework/include/QualityControl/DummyDatabase.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ class DummyDatabase : public DatabaseInterface
3939
// QualityObject
4040
void storeQO(std::shared_ptr<const o2::quality_control::core::QualityObject> q) override;
4141
std::shared_ptr<o2::quality_control::core::QualityObject> retrieveQO(std::string checkerName, long timestamp = -1, const core::Activity& activity = {}) override;
42-
// QCFC
43-
void storeQCFC(std::shared_ptr<const o2::quality_control::QualityControlFlagCollection> qcfc) override;
44-
std::shared_ptr<o2::quality_control::QualityControlFlagCollection> retrieveQCFC(const std::string& name, const std::string& detector, int runNumber = 0,
45-
const std::string& passName = "", const std::string& periodName = "",
46-
const std::string& provenance = "", long timestamp = -1) override;
42+
4743
// General
4844
void* retrieveAny(std::type_info const& tinfo, std::string const& path,
4945
std::map<std::string, std::string> const& metadata, long timestamp = -1,

Framework/include/QualityControl/ObjectMetadataKeys.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ constexpr auto qcTaskName = "qc_task_name";
3535
constexpr auto qcTaskClass = "qc_task_class";
3636
constexpr auto qcQuality = "qc_quality";
3737
constexpr auto qcCheckName = "qc_check_name";
38-
constexpr auto qcQCFCName = "qc_qcfc_name";
3938
constexpr auto qcAdjustableEOV = "adjustableEOV"; // this is a keyword for the CCDB
4039
// QC Activity
4140
constexpr auto runType = "RunType";

Framework/include/QualityControl/RepoPathUtils.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "QualityControl/MonitorObject.h"
2323
#include "QualityControl/QualityObject.h"
2424
#include <Common/Exceptions.h>
25-
#include <DataFormatsQualityControl/QualityControlFlagCollection.h>
2625

2726
namespace o2::quality_control::core
2827
{
@@ -107,25 +106,6 @@ class RepoPathUtils
107106
includeProvenance);
108107
}
109108

110-
/**
111-
* Compute and return the path to the FlagCollection.
112-
* Current algorithm does <provenance(qc)>/<detectorCode>/QCFC/<qcfcName>
113-
* @param detectorCode
114-
* @param qcfcName
115-
* @param provenance
116-
* @return the path to the QCFCollection
117-
*/
118-
static std::string getQcfcPath(const std::string& detectorCode,
119-
const std::string& qcfcName,
120-
const std::string& provenance = "qc");
121-
/**
122-
* Compute and return the path to the QCFCollection.
123-
* Current algorithm does <provenance(qc)>/<detectorCode>/QCFC/<qcfcName>
124-
* @param qcfc
125-
* @return the path to the QCFCollection
126-
*/
127-
static std::string getQcfcPath(const QualityControlFlagCollection* qcfc);
128-
129109
static constexpr auto allowedProvenancesMessage = R"(Allowed provenances are "qc" (real data processed synchronously), "qc_async" (real data processed asynchronously) and "qc_mc" (simulated data).)";
130110
static bool isProvenanceAllowed(const std::string& provenance);
131111

Framework/src/CcdbDatabase.cxx

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -270,33 +270,6 @@ void CcdbDatabase::storeQO(std::shared_ptr<const o2::quality_control::core::Qual
270270
handleStorageError(path, result);
271271
}
272272

273-
void CcdbDatabase::storeQCFC(std::shared_ptr<const o2::quality_control::QualityControlFlagCollection> qcfc)
274-
{
275-
// metadata
276-
map<string, string> metadata;
277-
metadata[metadata_keys::runNumber] = std::to_string(qcfc->getRunNumber());
278-
metadata[metadata_keys::periodName] = qcfc->getPeriodName();
279-
metadata[metadata_keys::passName] = qcfc->getPassName();
280-
// QC metadata (prefix qc_)
281-
addFrameworkMetadata(metadata, qcfc->getDetector(), qcfc->IsA()->GetName());
282-
metadata[metadata_keys::qcQCFCName] = qcfc->getName();
283-
284-
// other attributes
285-
string path = RepoPathUtils::getQcfcPath(qcfc.get());
286-
auto from = qcfc->getStart();
287-
auto to = qcfc->getEnd();
288-
if (from > to) {
289-
ILOG(Error, Support) << "QCFC '" + qcfc->getName() + "' cannot be stored in CCDB, because it has invalid validity range (" + std::to_string(from) + ", " + std::to_string(to) + ")." << ENDM;
290-
}
291-
std::stringstream buffer;
292-
qcfc->streamTo(buffer);
293-
ILOG(Debug, Support) << "Storing QualityControlFlagCollection at " << path << " (" << qcfc->getName() << ")" << ENDM;
294-
auto result = ccdbApi->storeAsBinaryFile(buffer.str().c_str(), buffer.str().size(), qcfc->getName(), qcfc->IsA()->GetName(), path, metadata, from, to);
295-
if (result != 0) {
296-
ILOG(Error, Support) << "QCFC '" + qcfc->getName() + "' could not be stored in CCDB, error: " + std::to_string(result) << ENDM;
297-
}
298-
}
299-
300273
TObject* CcdbDatabase::retrieveTObject(std::string path, std::map<std::string, std::string> const& metadata, long timestamp, std::map<std::string, std::string>* headers)
301274
{
302275
if (timestamp == Timestamp::Latest) {
@@ -396,62 +369,6 @@ std::shared_ptr<o2::quality_control::core::QualityObject> CcdbDatabase::retrieve
396369
return qo;
397370
}
398371

399-
std::shared_ptr<o2::quality_control::QualityControlFlagCollection> CcdbDatabase::retrieveQCFC(const std::string& qcfcName, const std::string& detector, int runNumber, const string& passName, const string& periodName, const std::string& provenance, long timestamp)
400-
{
401-
map<string, string> headers;
402-
map<string, string> metadata;
403-
if (runNumber != 0) {
404-
metadata[metadata_keys::runNumber] = std::to_string(runNumber);
405-
}
406-
if (!passName.empty()) {
407-
metadata[metadata_keys::passName] = passName;
408-
}
409-
if (!periodName.empty()) {
410-
metadata[metadata_keys::periodName] = periodName;
411-
}
412-
const auto qcfcPath = RepoPathUtils::getQcfcPath(detector, qcfcName, provenance);
413-
const std::string localFileDir = "/tmp";
414-
const std::string localFileName = "qcfc_" + qcfcName + std::to_string(time_point_cast<nanoseconds>(system_clock::now()).time_since_epoch().count());
415-
const std::string localFilePath = localFileDir + std::filesystem::path::preferred_separator + localFileName;
416-
if (localFilePath.find("..") != std::string::npos || localFilePath.find('~') != std::string::npos) {
417-
ILOG(Error, Support) << "The path '" << localFilePath << "' looks hacky, will not download any files there." << ENDM;
418-
return nullptr;
419-
}
420-
421-
auto resultMetadata = ccdbApi->retrieveHeaders(qcfcPath, metadata, timestamp);
422-
if (resultMetadata.empty()) {
423-
ILOG(Error, Support) << "Could not extract headers of QCFC at '" << qcfcPath << "' with the metadata: " << ENDM; // TODO
424-
ILOG(Error, Support) << " - RunNumber : " << metadata[metadata_keys::runNumber] << ENDM;
425-
ILOG(Error, Support) << " - PassName : " << metadata[metadata_keys::passName] << ENDM;
426-
ILOG(Error, Support) << " - PeriodName : " << metadata[metadata_keys::periodName] << ENDM;
427-
return nullptr;
428-
}
429-
430-
auto success = ccdbApi->retrieveBlob(qcfcPath, localFileDir, metadata, timestamp, false, localFileName);
431-
if (!success) {
432-
ILOG(Error, Support) << "Could not retrieve the QCFC at '" << qcfcPath << "' with the metadata: " << ENDM; // TODO
433-
ILOG(Error, Support) << " - RunNumber : " << metadata[metadata_keys::runNumber] << ENDM;
434-
ILOG(Error, Support) << " - PassName : " << metadata[metadata_keys::passName] << ENDM;
435-
ILOG(Error, Support) << " - PeriodName : " << metadata[metadata_keys::periodName] << ENDM;
436-
return nullptr;
437-
}
438-
439-
std::ifstream localFile(localFilePath);
440-
if (!localFile.is_open()) {
441-
ILOG(Error, Support) << "Could not open a file at '" << localFilePath << "'" << ENDM;
442-
std::filesystem::remove(localFilePath);
443-
return nullptr;
444-
}
445-
446-
QualityControlFlagCollection::RangeInterval validity{ std::stoull(resultMetadata[metadata_keys::validFrom]), std::stoull(resultMetadata[metadata_keys::validUntil]) };
447-
auto qcfc = std::make_shared<QualityControlFlagCollection>(qcfcName, detector, validity, runNumber, periodName, passName, provenance);
448-
qcfc->streamFrom(localFile);
449-
localFile.close();
450-
std::filesystem::remove(localFilePath);
451-
452-
return qcfc;
453-
}
454-
455372
std::string CcdbDatabase::retrieveJson(std::string path, long timestamp, const std::map<std::string, std::string>& metadata)
456373
{
457374
map<string, string> headers;

Framework/src/DummyDatabase.cxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ void DummyDatabase::storeQO(std::shared_ptr<const o2::quality_control::core::Qua
4747
{
4848
}
4949

50-
void DummyDatabase::storeQCFC(std::shared_ptr<const o2::quality_control::QualityControlFlagCollection> qcfc)
51-
{
52-
}
53-
5450
std::shared_ptr<o2::quality_control::core::QualityObject> DummyDatabase::retrieveQO(std::string, long, const core::Activity& activity)
5551
{
5652
return {};
@@ -87,10 +83,6 @@ void* DummyDatabase::retrieveAny(const std::type_info&, const std::string&, cons
8783
{
8884
return nullptr;
8985
}
90-
std::shared_ptr<o2::quality_control::QualityControlFlagCollection> DummyDatabase::retrieveQCFC(const std::string& name, const std::string& detector, int runNumber, const std::string& passName, const std::string& periodName, const std::string& provenance, long timestamp)
91-
{
92-
return nullptr;
93-
}
9486

9587
void DummyDatabase::setMaxObjectSize(size_t maxObjectSize)
9688
{

Framework/src/RepoPathUtils.cxx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,6 @@
1515
namespace o2::quality_control::core
1616
{
1717

18-
std::string RepoPathUtils::getQcfcPath(const std::string& detectorCode,
19-
const std::string& qcfcName,
20-
const std::string& provenance)
21-
{
22-
return provenance + "/" + detectorCode + "/QCFC/" + qcfcName;
23-
}
24-
25-
std::string RepoPathUtils::getQcfcPath(const QualityControlFlagCollection* qcfc)
26-
{
27-
return getQcfcPath(qcfc->getDetector(), qcfc->getName(), qcfc->getProvenance());
28-
}
29-
3018
bool RepoPathUtils::isProvenanceAllowed(const std::string& provenance)
3119
{
3220
return provenance == "qc" || provenance == "qc_async" || provenance == "qc_mc";

Framework/test/testCcdbDatabase.cxx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -417,30 +417,5 @@ BOOST_AUTO_TEST_CASE(ccdb_store_retrieve_latest)
417417
BOOST_CHECK_EQUAL(h1Back->GetEntries(), 20000);
418418
}
419419

420-
BOOST_AUTO_TEST_CASE(ccdb_qcfc)
421-
{
422-
test_fixture f;
423-
const std::string pid = std::to_string(getpid());
424-
const std::string qcfcName = "Test_pid" + pid; // TODO we can use a 'Test' directory once https://github.com/AliceO2Group/AliceO2/pull/8195 is merged
425-
426-
std::shared_ptr<QualityControlFlagCollection> qcfc1{ new QualityControlFlagCollection{ qcfcName, "TST", { 45, 500000 }, 42, "LHC42x", "spass", "qc" } };
427-
qcfc1->insert({ 50, 77, FlagTypeFactory::Invalid(), "a comment", "a source" });
428-
qcfc1->insert({ 51, 77, FlagTypeFactory::Invalid() });
429-
qcfc1->insert({ 1234, 3434, FlagTypeFactory::BadPID() });
430-
qcfc1->insert({ 50, 77, FlagTypeFactory::BadPID() });
431-
qcfc1->insert({ 43434, 63421, FlagTypeFactory::Good() });
432-
433-
f.backend->storeQCFC(qcfc1);
434-
435-
auto qcfc2 = f.backend->retrieveQCFC(qcfc1->getName(), qcfc1->getDetector(), qcfc1->getRunNumber(),
436-
qcfc1->getPassName(), qcfc1->getPeriodName(), qcfc1->getProvenance(), 400000);
437-
BOOST_REQUIRE(qcfc2 != nullptr);
438-
439-
BOOST_REQUIRE_EQUAL(qcfc1->size(), qcfc2->size());
440-
for (auto it1 = qcfc1->begin(), it2 = qcfc2->begin(); it1 != qcfc1->end() && it2 != qcfc2->end(); ++it1, ++it2) {
441-
BOOST_CHECK_EQUAL(*it1, *it2);
442-
}
443-
}
444-
445420
} // namespace
446421
} // namespace o2::quality_control::core

Modules/Common/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ add_library(O2QcCommon)
1212
target_sources(O2QcCommon
1313
PRIVATE src/IncreasingEntries.cxx
1414
src/WorstOfAllAggregator.cxx
15-
src/FlagCollectionTask.cxx
16-
src/FlagCollectionTaskConfig.cxx
1715
src/QualityTask.cxx
1816
src/QualityTaskConfig.cxx
1917
src/BigScreenCanvas.cxx
@@ -60,7 +58,6 @@ install(TARGETS O2QcCommon
6058
add_root_dictionary(O2QcCommon
6159
HEADERS include/Common/NonEmpty.h
6260
include/Common/WorstOfAllAggregator.h
63-
include/Common/FlagCollectionTask.h
6461
include/Common/QualityTask.h
6562
include/Common/BigScreen.h
6663
include/Common/CcdbInspectorTask.h
@@ -87,9 +84,6 @@ add_root_dictionary(O2QcCommon
8784
include/Common/LHCClockPhaseReductor.h
8885
LINKDEF include/Common/LinkDef.h)
8986

90-
install(FILES etc/flagcollection-example.json
91-
DESTINATION Modules/Common)
92-
9387
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/Common
9488
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/QualityControl")
9589

0 commit comments

Comments
 (0)