Skip to content

Commit

Permalink
merge the initInfologger methods from the runners
Browse files Browse the repository at this point in the history
  • Loading branch information
Barthelemy committed Nov 8, 2023
1 parent 85f30bc commit 519ebd4
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 49 deletions.
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
17 changes: 1 addition & 16 deletions Framework/src/AggregatorRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -315,22 +315,7 @@ void AggregatorRunner::initAggregators()

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);
core::initInfologger(iCtx, mRunnerConfig.infologgerDiscardParameters, "aggregator");
}

void AggregatorRunner::initLibraries()
Expand Down
17 changes: 1 addition & 16 deletions Framework/src/CheckRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -499,22 +499,7 @@ void CheckRunner::initServiceDiscovery()

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);
core::initInfologger(iCtx, mConfig.infologgerDiscardParameters, createCheckRunnerFacility(mDeviceName));
}

void CheckRunner::initLibraries()
Expand Down
18 changes: 1 addition & 17 deletions Framework/src/TaskRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,7 @@ 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);
core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.taskName, mTaskConfig.detectorName);
}

void TaskRunner::init(InitContext& 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

0 comments on commit 519ebd4

Please sign in to comment.