Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge the initInfologger methods from the runners #2029

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Framework/include/QualityControl/AggregatorRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class AggregatorRunner : public framework::Task
*/
void prepareInputs();

void initInfoLogger(framework::InitContext& iCtx);
void initDatabase();
void initMonitoring();
void initServiceDiscovery();
Expand Down
1 change: 0 additions & 1 deletion Framework/include/QualityControl/CheckRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ class CheckRunner : public framework::Task
void initDatabase();
void initMonitoring();
void initServiceDiscovery();
void initInfologger(framework::InitContext& iCtx);
void initLibraries();

/**
Expand Down
1 change: 0 additions & 1 deletion Framework/include/QualityControl/TaskRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class TaskRunner : public framework::Task
/// \brief Checks if all the expected data inputs are present in the provided InputRecord
static bool isDataReady(const framework::InputRecord& inputs);
void refreshConfig(framework::InitContext& iCtx);
void initInfologger(framework::InitContext& iCtx);
void printTaskConfig() const;
void startOfActivity();
void endOfActivity();
Expand Down
2 changes: 2 additions & 0 deletions Framework/include/QualityControl/runnerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ std::string templateILDiscardFile(std::string& originalFile, framework::InitCont

uint64_t getCurrentTimestamp();

void initInfologger(framework::InitContext& iCtx, core::DiscardFileParameters infologgerDiscardParameters, std::string facility, std::string detectorName = "");

} // namespace o2::quality_control::core

#endif // QUALITYCONTROL_RUNNERUTILS_H
22 changes: 1 addition & 21 deletions Framework/src/AggregatorRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ std::string AggregatorRunner::createAggregatorRunnerName()

void AggregatorRunner::init(framework::InitContext& iCtx)
{
initInfoLogger(iCtx);
core::initInfologger(iCtx, mRunnerConfig.infologgerDiscardParameters, "aggregator");
refreshConfig(iCtx);
QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators));
Bookkeeping::getInstance().init(mRunnerConfig.bookkeepingUrl);
Expand Down Expand Up @@ -313,26 +313,6 @@ void AggregatorRunner::initAggregators()
reorderAggregators();
}

void AggregatorRunner::initInfoLogger(InitContext& iCtx)
{
// TODO : the method should be merged with the other, similar, methods in *Runners

InfoLoggerContext* ilContext = nullptr;
AliceO2::InfoLogger::InfoLogger* il = nullptr;
try {
ilContext = &iCtx.services().get<AliceO2::InfoLogger::InfoLoggerContext>();
il = &iCtx.services().get<AliceO2::InfoLogger::InfoLogger>();
} catch (const RuntimeErrorRef& err) {
ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM;
}

mRunnerConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mRunnerConfig.infologgerDiscardParameters.discardFile, iCtx);
QcInfoLogger::init("aggregator",
mRunnerConfig.infologgerDiscardParameters,
il,
ilContext);
}

void AggregatorRunner::initLibraries()
{
std::set<std::string> moduleNames;
Expand Down
22 changes: 1 addition & 21 deletions Framework/src/CheckRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void CheckRunner::refreshConfig(InitContext& iCtx)
void CheckRunner::init(framework::InitContext& iCtx)
{
try {
initInfologger(iCtx);
core::initInfologger(iCtx, mConfig.infologgerDiscardParameters, createCheckRunnerFacility(mDeviceName));
refreshConfig(iCtx);
Bookkeeping::getInstance().init(mConfig.bookkeepingUrl);
initDatabase();
Expand Down Expand Up @@ -497,26 +497,6 @@ void CheckRunner::initServiceDiscovery()
ILOG(Info, Support) << "ServiceDiscovery initialized" << ENDM;
}

void CheckRunner::initInfologger(framework::InitContext& iCtx)
{
// TODO : the method should be merged with the other, similar, methods in *Runners

InfoLoggerContext* ilContext = nullptr;
AliceO2::InfoLogger::InfoLogger* il = nullptr;
try {
ilContext = &iCtx.services().get<AliceO2::InfoLogger::InfoLoggerContext>();
il = &iCtx.services().get<AliceO2::InfoLogger::InfoLogger>();
} catch (const RuntimeErrorRef& err) {
ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM;
}

mConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mConfig.infologgerDiscardParameters.discardFile, iCtx);
QcInfoLogger::init(createCheckRunnerFacility(mDeviceName),
mConfig.infologgerDiscardParameters,
il,
ilContext);
}

void CheckRunner::initLibraries()
{
std::set<std::string> moduleNames;
Expand Down
23 changes: 1 addition & 22 deletions Framework/src/TaskRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,9 @@ void TaskRunner::refreshConfig(InitContext& iCtx)
}
}

void TaskRunner::initInfologger(InitContext& iCtx)
{
// TODO : the method should be merged with the other, similar, methods in *Runners

AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr;
AliceO2::InfoLogger::InfoLogger* il = nullptr;
try {
ilContext = &iCtx.services().get<AliceO2::InfoLogger::InfoLoggerContext>();
il = &iCtx.services().get<AliceO2::InfoLogger::InfoLogger>();
} catch (const RuntimeErrorRef& err) {
ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM;
}

mTaskConfig.infologgerDiscardParameters.discardFile = templateILDiscardFile(mTaskConfig.infologgerDiscardParameters.discardFile, iCtx);
QcInfoLogger::init("task/" + mTaskConfig.taskName,
mTaskConfig.infologgerDiscardParameters,
il,
ilContext);
QcInfoLogger::setDetector(mTaskConfig.detectorName);
}

void TaskRunner::init(InitContext& iCtx)
{
initInfologger(iCtx);
core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.taskName, mTaskConfig.detectorName);
ILOG(Info, Devel) << "Initializing TaskRunner" << ENDM;

refreshConfig(iCtx);
Expand Down
21 changes: 21 additions & 0 deletions Framework/src/runnerUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,25 @@ uint64_t getCurrentTimestamp()
return value.count();
}

void initInfologger(framework::InitContext& iCtx, core::DiscardFileParameters infologgerDiscardParameters, std::string facility, std::string detectorName)
{
AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr;
AliceO2::InfoLogger::InfoLogger* il = nullptr;
try {
ilContext = &iCtx.services().get<AliceO2::InfoLogger::InfoLoggerContext>();
il = &iCtx.services().get<AliceO2::InfoLogger::InfoLogger>();
} catch (const framework::RuntimeErrorRef& err) {
ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM;
}

infologgerDiscardParameters.discardFile = templateILDiscardFile(infologgerDiscardParameters.discardFile, iCtx);
QcInfoLogger::init(facility,
infologgerDiscardParameters,
il,
ilContext);
if (!detectorName.empty()) {
QcInfoLogger::setDetector(detectorName);
}
}

} // namespace o2::quality_control::core
Loading