Skip to content

Commit fd37aec

Browse files
Merge branch 'AliceO2Group:master' into 1pcut
2 parents 9abbd30 + 2603c31 commit fd37aec

File tree

70 files changed

+3183
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3183
-448
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ include(GNUInstallDirs)
1313
# ---- Project ----
1414

1515
project(QualityControl
16-
VERSION 1.162.0
16+
VERSION 1.164.0
1717
DESCRIPTION "O2 Data Quality Control Framework"
1818
LANGUAGES C CXX)
1919

Framework/CMakeLists.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,22 @@ configure_file("include/QualityControl/Version.h.in"
55
"${CMAKE_CURRENT_BINARY_DIR}/include/QualityControl/Version.h"
66
@ONLY)
77

8-
# ---- Library for the types ----
8+
# ---- Library for IL ----
9+
add_library(O2QualityControlInfoLogger STATIC
10+
src/QcInfoLogger.cxx
11+
)
12+
13+
target_include_directories(O2QualityControlInfoLogger
14+
PUBLIC
15+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
16+
)
17+
18+
target_link_libraries(O2QualityControlInfoLogger
19+
PUBLIC
20+
AliceO2::InfoLogger
21+
)
922

23+
# ---- Library for the types ----
1024
add_library(O2QualityControlTypes
1125
src/MonitorObject.cxx
1226
src/QualityObject.cxx
@@ -21,11 +35,13 @@ target_include_directories(
2135
)
2236

2337
target_link_libraries(O2QualityControlTypes
38+
PRIVATE
39+
O2QualityControlInfoLogger
2440
PUBLIC
25-
ROOT::Hist
41+
AliceO2::BookkeepingApi
2642
AliceO2::Common
2743
O2::DataFormatsQualityControl
28-
AliceO2::BookkeepingApi
44+
ROOT::Hist
2945
)
3046

3147
add_root_dictionary(O2QualityControlTypes
@@ -70,7 +86,6 @@ add_library(O2QualityControl
7086
src/AggregatorInterface.cxx
7187
src/DatabaseFactory.cxx
7288
src/CcdbDatabase.cxx
73-
src/QcInfoLogger.cxx
7489
src/TaskFactory.cxx
7590
src/TaskRunner.cxx
7691
src/TaskRunnerFactory.cxx
@@ -141,7 +156,6 @@ target_link_libraries(O2QualityControl
141156
ROOT::Hist
142157
ROOT::TreePlayer
143158
AliceO2::Common
144-
AliceO2::InfoLogger
145159
AliceO2::Monitoring
146160
AliceO2::Configuration
147161
AliceO2::Occ
@@ -159,6 +173,7 @@ target_link_libraries(O2QualityControl
159173
${RDKAFKA_LIB}
160174
PRIVATE Boost::system
161175
CURL::libcurl
176+
O2QualityControlInfoLogger
162177
)
163178

164179
add_root_dictionary(O2QualityControl

Framework/include/QualityControl/MonitorObject.h

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ class MonitorObject : public TObject
5050
/// Destructor
5151
~MonitorObject() override;
5252

53-
/// Copy constructor
54-
MonitorObject(const MonitorObject& other) = default;
53+
// /// Copy constructor
54+
MonitorObject(const MonitorObject& other);
5555
/// Move constructor
5656
MonitorObject(MonitorObject&& other) /*noexcept*/ = default;
5757
/// Copy assignment operator
58-
MonitorObject& operator=(const MonitorObject& other) = default;
58+
MonitorObject& operator=(const MonitorObject& other);
5959
/// Move assignment operator
6060
MonitorObject& operator=(MonitorObject&& other) /*noexcept*/ = default;
6161

@@ -69,19 +69,19 @@ class MonitorObject : public TObject
6969

7070
/// \brief Return joined task name and name of the encapsulated object (if any).
7171
/// @return The name as "{getTaskName()}/{getName())}.
72-
const std::string getFullName() const { return getTaskName() + "/" + getName(); }
72+
std::string getFullName() const;
7373

74-
TObject* getObject() const { return mObject; }
75-
void setObject(TObject* object) { mObject = object; }
74+
TObject* getObject() const;
75+
void setObject(TObject* object);
7676

77-
bool isIsOwner() const { return mIsOwner; }
78-
void setIsOwner(bool isOwner) { mIsOwner = isOwner; }
77+
bool isIsOwner() const;
78+
void setIsOwner(bool isOwner);
7979

80-
const std::string& getTaskName() const { return mTaskName; }
81-
void setTaskName(const std::string& taskName) { mTaskName = taskName; }
80+
const std::string& getTaskName() const;
81+
void setTaskName(const std::string& taskName);
8282

83-
const std::string& getDetectorName() const { return mDetectorName; }
84-
void setDetectorName(const std::string& detectorName) { mDetectorName = detectorName; }
83+
const std::string& getDetectorName() const;
84+
void setDetectorName(const std::string& detectorName);
8585

8686
const std::string& getTaskClass() const;
8787
void setTaskClass(const std::string& taskClass);
@@ -117,6 +117,8 @@ class MonitorObject : public TObject
117117
void Draw(Option_t* option) override;
118118
TObject* DrawClone(Option_t* option) const override;
119119

120+
void Copy(TObject& object) const override;
121+
120122
/// \brief Build the path to this object.
121123
/// Build the path to this object as it will appear in the GUI.
122124
/// \return A string containing the path.
@@ -126,7 +128,7 @@ class MonitorObject : public TObject
126128
void setDescription(const std::string& description);
127129

128130
private:
129-
TObject* mObject;
131+
std::unique_ptr<TObject> mObject;
130132
std::string mTaskName;
131133
std::string mTaskClass;
132134
std::string mDetectorName;
@@ -141,7 +143,10 @@ class MonitorObject : public TObject
141143
// tells Merger to create an object with data from the last cycle only on the side of the complete object
142144
bool mCreateMovingWindow = false;
143145

144-
ClassDefOverride(MonitorObject, 12);
146+
void releaseObject();
147+
void cloneAndSetObject(const MonitorObject&);
148+
149+
ClassDefOverride(MonitorObject, 13);
145150
};
146151

147152
} // namespace o2::quality_control::core

Framework/include/QualityControl/ObjectsManager.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
#include "QualityControl/Activity.h"
2222
#include "QualityControl/MonitorObject.h"
2323
#include "QualityControl/MonitorObjectCollection.h"
24+
#include <Mergers/Mergeable.h>
2425
// stl
26+
#include <concepts>
2527
#include <string>
2628
#include <memory>
29+
#include <type_traits>
2730

2831
class TObject;
29-
class TObjArray;
3032

3133
namespace o2::quality_control::core
3234
{
@@ -76,10 +78,26 @@ class ObjectsManager
7678
/**
7779
* Start publishing the object obj, i.e. it will be pushed forward in the workflow at regular intervals.
7880
* The ownership remains to the caller.
81+
* @param IgnoreMergeable if you want to ignore static_assert check for Mergeable
82+
* @param T type of object that we want to publish.
7983
* @param obj The object to publish.
8084
* @throws DuplicateObjectError
8185
*/
82-
void startPublishing(TObject* obj, PublicationPolicy = PublicationPolicy::Forever);
86+
template <bool IgnoreMergeable = false, typename T>
87+
void startPublishing(T obj, PublicationPolicy policy = PublicationPolicy::Forever)
88+
{
89+
// We don't want to do this compile time check in PostProcessing, and we want to turn off runtime check as well
90+
bool ignoreMergeableRuntime = IgnoreMergeable;
91+
#ifndef QUALITYCONTROL_POSTPROCESSINTERFACE_H
92+
static_assert(std::same_as<std::remove_pointer_t<T>, TObject> ||
93+
IgnoreMergeable || mergers::Mergeable<T>,
94+
"you are trying to startPublishing object that is not mergeable."
95+
" If you know what you are doing use startPublishing<true>(...)");
96+
#else
97+
ignoreMergeableRuntime = true;
98+
#endif
99+
startPublishingImpl(obj, policy, ignoreMergeableRuntime);
100+
}
83101

84102
/**
85103
* Stop publishing this object
@@ -223,6 +241,8 @@ class ObjectsManager
223241
bool mUpdateServiceDiscovery;
224242
Activity mActivity;
225243
std::vector<std::string> mMovingWindowsList;
244+
245+
void startPublishingImpl(TObject* obj, PublicationPolicy, bool ignoreMergeableWarning);
226246
};
227247

228248
} // namespace o2::quality_control::core

Framework/include/QualityControl/QualitiesToFlagCollectionConverter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class QualitiesToFlagCollectionConverter
4646

4747
size_t getQOsIncluded() const;
4848
size_t getWorseThanGoodQOs() const;
49+
int getRunNumber() const;
4950

5051
/// Sets the provided validity interval, trims affected flags and fills extensions with UnknownQuality
5152
void updateValidityInterval(const ValidityInterval validityInterval);

Framework/include/QualityControl/Quality.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Quality
3535
{
3636
public:
3737
/// Default constructor
38-
Quality(unsigned int level = Quality::NullLevel, std::string name = "");
38+
explicit Quality(unsigned int level = Quality::NullLevel, std::string name = "");
3939

4040
/// Destructor
4141
virtual ~Quality() = default;

Framework/script/RepoCleaner/README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,26 @@ There can be any number of these rules. The order is important as we use the fir
3333

3434
The configuration for ccdb-test is described [here](../../../doc/DevelopersTips.md).
3535

36+
## Setup virtual environment for development and test (venv)
37+
38+
1. cd Framework/script/RepoCleaner
39+
2. python3 -m venv env
40+
3. source env/bin/activate
41+
4. python -m pip install -r requirements.txt
42+
5. python3 -m pip install .
43+
6. You can execute and work. Next time just do "activate" and then you are good to go
44+
3645
## Unit Tests
37-
`cd QualityControl/Framework/script/RepoCleaner ; python3 -m unittest discover`
3846

39-
and to test only one of them: `python3 -m unittest tests/test_NewProduction.py -k test_2_runs`
47+
```
48+
cd Framework/script/RepoCleaner
49+
source env/bin/activate
50+
51+
# Run a test:
52+
python -m unittest tests.test_Ccdb.TestCcdb.test_getObjectsList
53+
```
54+
55+
`cd QualityControl/Framework/script/RepoCleaner ; python3 -m unittest discover`
4056

4157
In particular there is a test for the `production` rule that is pretty extensive. It hits the ccdb though and it needs the following path to be truncated:
4258
`
@@ -75,11 +91,3 @@ Create new version
7591
2. `python3 setup.py sdist bdist_wheel`
7692
3. `python3 -m twine upload --repository pypi dist/*`
7793

78-
## Use venv
79-
80-
1. cd Framework/script/RepoCleaner
81-
2. python3 -m venv env
82-
3. source env/bin/activate
83-
4. python -m pip install -r requirements.txt
84-
5. python3 -m pip install .
85-
6. You can execute and work. Next time just do "activate" and then you are good to go

Framework/script/RepoCleaner/qcrepocleaner/Ccdb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self, path: str, validFrom, validTo, createdAt, uuid=None, metadata
2626
:param uuid: unique id of the object
2727
:param validFrom: validity range smaller limit (in ms)
2828
:param validTo: validity range bigger limit (in ms)
29+
:param createdAt: creation timestamp of the object
2930
'''
3031
self.path = path
3132
self.uuid = uuid
@@ -72,7 +73,8 @@ def getObjectsList(self, added_since: int = 0, path: str = "", no_wildcard: bool
7273
:return A list of strings, each containing a path to an object in the CCDB.
7374
'''
7475
url_for_all_obj = self.url + '/latest/' + path
75-
url_for_all_obj += '/' if no_wildcard else '/.*'
76+
url_for_all_obj += '/' if path else ''
77+
url_for_all_obj += '' if no_wildcard else '.*'
7678
logger.debug(f"Ccdb::getObjectsList -> {url_for_all_obj}")
7779
headers = {'Accept': 'application/json', 'If-Not-Before':str(added_since)}
7880
r = requests.get(url_for_all_obj, headers=headers)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
certifi==2024.7.4
2+
chardet==5.2.0
3+
charset-normalizer==3.3.2
4+
dryable==1.2.0
5+
idna==3.7
6+
psutil==6.1.0
7+
python-consul==1.1.0
8+
PyYAML==6.0.1
9+
requests==2.32.2
10+
responses==0.25.0
11+
six==1.16.0
12+
urllib3==2.2.2

Framework/script/RepoCleaner/qcrepocleaner/config-test.yaml renamed to Framework/script/RepoCleaner/tests/config-test.yaml

File renamed without changes.

0 commit comments

Comments
 (0)