Skip to content

Commit 962ca12

Browse files
authored
[QC-869] Moving windows of selected plots in sync processing (#1895)
Also brings "--full-chain" flag to o2-qc, which allows to run a QC chain with Mergers between a single instance of a QC task and a CheckRunner. Useful for testing that an object is mergeable and for testing moving windows generated by Mergers.
1 parent b4d49b6 commit 962ca12

36 files changed

Lines changed: 532 additions & 72 deletions

Framework/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ add_library(O2QualityControl
9494
src/Timekeeper.cxx
9595
src/TimekeeperSynchronous.cxx
9696
src/TimekeeperAsynchronous.cxx
97+
src/WorkflowType.cxx
9798
src/TimekeeperFactory.cxx)
9899

99-
100100
target_include_directories(
101101
O2QualityControl
102102
PUBLIC $<INSTALL_INTERFACE:include>
@@ -241,6 +241,7 @@ add_executable(o2-qc-test-core
241241
test/testTimekeeper.cxx
242242
test/testTriggerHelpers.cxx
243243
test/testVersion.cxx
244+
test/testMonitorObjectCollection.cxx
244245
)
245246
set_property(TARGET o2-qc-test-core
246247
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/tests)

Framework/include/QualityControl/DataSourceSpec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ enum class DataSourceType {
2828
DataSamplingPolicy,
2929
Direct,
3030
Task,
31+
TaskMovingWindow,
3132
Check,
3233
Aggregator,
3334
PostProcessingTask,

Framework/include/QualityControl/InfrastructureGenerator.h

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,26 @@ class InfrastructureGenerator
6868
/// \param configurationTree - full QC config ptree
6969
static void generateStandaloneInfrastructure(framework::WorkflowSpec& workflow, const boost::property_tree::ptree& configurationTree);
7070

71+
/// \brief Generates a full QC chain infrastructure.
72+
///
73+
/// Generates a full QC infrastructure from a configuration file. This function is aimed to use for standalone setups
74+
/// and local development. It will create both local and remote QC tasks, and CheckRunners running associated Checks,
75+
/// as well as Mergers between local QC tasks and Checks.
76+
///
77+
/// \param configurationTree - full path to configuration file, preceded with the backend (e.g. "json://")
78+
/// \return generated standalone QC workflow
79+
static framework::WorkflowSpec generateFullChainInfrastructure(const boost::property_tree::ptree& configurationTree);
80+
81+
/// \brief Generates a full QC chain infrastructure.
82+
///
83+
/// Generates a full QC infrastructure from a configuration file. This function is aimed to use for standalone setups
84+
/// and local development. It will create both local and remote QC tasks, and CheckRunners running associated Checks,
85+
/// as well as Mergers between local QC tasks and Checks.
86+
///
87+
/// \param workflow - existing workflow where QC infrastructure should be placed
88+
/// \param configurationTree - full QC config ptree
89+
static void generateFullChainInfrastructure(framework::WorkflowSpec& workflow, const boost::property_tree::ptree& configurationTree);
90+
7191
/// \brief Generates the local part of the QC infrastructure for a specified host.
7292
///
7393
/// Generates the local part of the QC infrastructure for a specified host - taskRunners which are declared in the
@@ -190,15 +210,12 @@ class InfrastructureGenerator
190210
static void generateLocalTaskRemoteProxy(framework::WorkflowSpec& workflow,
191211
const TaskSpec& taskSpec,
192212
size_t numberOfLocalMachines);
193-
static void generateMergers(framework::WorkflowSpec& workflow,
194-
const std::string& taskName,
213+
static void generateMergers(framework::WorkflowSpec& workflow, const std::string& taskName,
195214
size_t numberOfLocalMachines,
196215
std::vector<std::pair<size_t, size_t>> cycleDurationSeconds,
197-
const std::string& mergingMode,
198-
size_t resetAfterCycles,
199-
std::string monitoringUrl,
200-
const std::string& detectorName,
201-
std::vector<size_t> mergersPerLayer);
216+
const std::string& mergingMode, size_t resetAfterCycles,
217+
std::string monitoringUrl, const std::string& detectorName,
218+
std::vector<size_t> mergersPerLayer, bool enableMovingWindows);
202219
static void generateCheckRunners(framework::WorkflowSpec& workflow, const InfrastructureSpec& infrastructureSpec);
203220
static void generateAggregator(framework::WorkflowSpec& workflow, const InfrastructureSpec& infrastructureSpec);
204221
static void generatePostProcessing(framework::WorkflowSpec& workflow, const InfrastructureSpec& infrastructureSpec);
@@ -218,6 +235,16 @@ inline void generateStandaloneInfrastructure(framework::WorkflowSpec& workflow,
218235
core::InfrastructureGenerator::generateStandaloneInfrastructure(workflow, configurationTree);
219236
}
220237

238+
inline framework::WorkflowSpec generateFullChainInfrastructure(const boost::property_tree::ptree& configurationTree)
239+
{
240+
return core::InfrastructureGenerator::generateFullChainInfrastructure(configurationTree);
241+
}
242+
243+
inline void generateFullChainInfrastructure(framework::WorkflowSpec& workflow, const boost::property_tree::ptree& configurationTree)
244+
{
245+
core::InfrastructureGenerator::generateFullChainInfrastructure(workflow, configurationTree);
246+
}
247+
221248
inline framework::WorkflowSpec generateLocalInfrastructure(const boost::property_tree::ptree& configurationTree, std::string host)
222249
{
223250
return core::InfrastructureGenerator::generateLocalInfrastructure(configurationTree, host);

Framework/include/QualityControl/InfrastructureSpec.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/// \author Piotr Konopka
1717
///
1818

19+
#include "QualityControl/WorkflowType.h"
1920
#include "QualityControl/CommonSpec.h"
2021
#include "QualityControl/TaskSpec.h"
2122
#include "QualityControl/CheckSpec.h"
@@ -29,6 +30,7 @@ namespace o2::quality_control::core
2930
{
3031

3132
struct InfrastructureSpec {
33+
WorkflowType workflowType = WorkflowType::Standalone;
3234
CommonSpec common;
3335
std::vector<TaskSpec> tasks;
3436
std::vector<checker::CheckSpec> checks;

Framework/include/QualityControl/InfrastructureSpecReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace o2::quality_control::core
3535
namespace InfrastructureSpecReader
3636
{
3737
/// \brief Reads the full QC configuration structure.
38-
InfrastructureSpec readInfrastructureSpec(const boost::property_tree::ptree& wholeTree);
38+
InfrastructureSpec readInfrastructureSpec(const boost::property_tree::ptree& wholeTree, WorkflowType workflowType);
3939

4040
template <typename T>
4141
T readSpecEntry(const std::string& entryID, const boost::property_tree::ptree& entryTree, const boost::property_tree::ptree& wholeTree);

Framework/include/QualityControl/MonitorObject.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class MonitorObject : public TObject
9595
void updateValidity(validity_time_t value);
9696
ValidityInterval getValidity() const;
9797

98+
void setCreateMovingWindow(bool);
99+
bool getCreateMovingWindow() const;
100+
98101
/// \brief Add key value pair that will end up in the database as metadata of the object
99102
/// Add a metadata (key value pair) to the MonitorObject. It will be stored in the database as metadata.
100103
/// If the key already exists the value will NOT be updated.
@@ -135,8 +138,10 @@ class MonitorObject : public TObject
135138
// object.
136139
// TODO : maybe we should always be the owner ?
137140
bool mIsOwner;
141+
// tells Merger to create an object with data from the last cycle only on the side of the complete object
142+
bool mCreateMovingWindow = false;
138143

139-
ClassDefOverride(MonitorObject, 11);
144+
ClassDefOverride(MonitorObject, 12);
140145
};
141146

142147
} // namespace o2::quality_control::core

Framework/include/QualityControl/MonitorObjectCollection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class MonitorObjectCollection : public TObjArray, public mergers::MergeInterface
3737
void setDetector(const std::string&);
3838
const std::string& getDetector() const;
3939

40+
MergeInterface* cloneMovingWindow() const override;
41+
4042
private:
4143
std::string mDetector = "TST";
4244

Framework/include/QualityControl/ObjectsManager.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ class ObjectsManager
188188
const Activity& getActivity() const;
189189
void setActivity(const Activity& activity);
190190

191+
void setMovingWindowsList(const std::vector<std::string>&);
192+
const std::vector<std::string>& getMovingWindowsList() const;
193+
191194
private:
192195
std::unique_ptr<MonitorObjectCollection> mMonitorObjects;
193196
std::string mTaskName;
@@ -196,6 +199,7 @@ class ObjectsManager
196199
std::unique_ptr<ServiceDiscovery> mServiceDiscovery;
197200
bool mUpdateServiceDiscovery;
198201
Activity mActivity;
202+
std::vector<std::string> mMovingWindowsList;
199203
};
200204

201205
} // namespace o2::quality_control::core

Framework/include/QualityControl/PostProcessingRunner.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "QualityControl/Triggers.h"
2828
#include "QualityControl/Activity.h"
2929
#include "QualityControl/DatabaseInterface.h"
30+
#include "WorkflowType.h"
3031

3132
namespace o2::framework
3233
{
@@ -65,7 +66,7 @@ class PostProcessingRunner
6566
~PostProcessingRunner() = default;
6667

6768
/// \brief Initialization. Creates configuration structures out of the ptree. Throws on errors.
68-
void init(const boost::property_tree::ptree& config);
69+
void init(const boost::property_tree::ptree& config, o2::quality_control::core::WorkflowType workflowType);
6970
/// \brief Initialization. Throws on errors.
7071
void init(const PostProcessingRunnerConfig& runnerConfig, const PostProcessingConfig& taskConfig);
7172
/// \brief One iteration over the event loop. Throws on errors. Returns false when it can gracefully exit.

Framework/include/QualityControl/TaskRunner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class TaskRunner : public framework::Task
105105
/// \brief ID string for all TaskRunner devices
106106
static std::string createTaskRunnerIdString();
107107
/// \brief Unified DataOrigin for Quality Control tasks
108-
static header::DataOrigin createTaskDataOrigin(const std::string& detectorCode);
108+
static header::DataOrigin createTaskDataOrigin(const std::string& detectorCode, bool movingWindows = false);
109109
/// \brief Unified DataDescription naming scheme for all tasks
110110
static header::DataDescription createTaskDataDescription(const std::string& taskName);
111111
/// \brief Unified DataDescription naming scheme for all timers

0 commit comments

Comments
 (0)