Commit dd77137d authored by Nils Krumnack's avatar Nils Krumnack
Browse files

move call to xAOD::LoadDictionaries() earlier

It needs to happen as early as possible in the job, so I added a
separate point in the setup to call it.  This may still not fully work
for the legacy EL::Algorithm, just due to the fact that it gets
instantiated too early.
parent e95e0c71
......@@ -43,14 +43,24 @@ namespace EL
virtual ~Module () noexcept = default;
/// \brief action at the beginning of worker job
/// \brief action at the the very beginning of the worker job
///
/// This gets called as early as possible in the worker
/// initialization. The main purpose is to start any benchmarks
/// that are meant to capture the initialization process as
/// well.
/// initialization. Essentially all that should happen before
/// this is to load all the modules. The main purpose is to
/// start any benchmarks that are meant to capture the
/// initialization process as well.
public:
virtual ::StatusCode preInitialize (ModuleData& data);
virtual ::StatusCode firstInitialize (ModuleData& data);
/// \brief action before opening the first file in the worker
/// job
///
/// This is mostly meant to allow loading the dictionaries
/// before any files and associated information is loaded.
public:
virtual ::StatusCode preFileInitialize (ModuleData& data);
/// \brief action just before algorithms are initialized
......
......@@ -28,7 +28,7 @@ namespace EL
//
public:
virtual ::StatusCode preInitialize (ModuleData& data) override;
virtual ::StatusCode firstInitialize (ModuleData& data) override;
public:
virtual ::StatusCode onFileExecute (ModuleData& data) override;
......
......@@ -46,6 +46,9 @@ namespace EL
// interface inherited from Algorithm
//
public:
virtual ::StatusCode preFileInitialize (ModuleData& data) override;
public:
virtual ::StatusCode onInitialize (ModuleData& data) override;
......
......@@ -23,7 +23,13 @@ namespace EL
namespace Detail
{
::StatusCode Module ::
preInitialize (ModuleData& /*data*/)
firstInitialize (ModuleData& /*data*/)
{
return ::StatusCode::SUCCESS;
}
::StatusCode Module ::
preFileInitialize (ModuleData& /*data*/)
{
return ::StatusCode::SUCCESS;
}
......
......@@ -26,7 +26,7 @@ namespace EL
namespace Detail
{
::StatusCode StopwatchModule ::
preInitialize (ModuleData& /*data*/)
firstInitialize (ModuleData& /*data*/)
{
m_stopwatch = std::make_unique<TStopwatch> ();
......
......@@ -50,19 +50,9 @@ namespace EL
::StatusCode TEventModule ::
onInitialize (ModuleData& data)
preFileInitialize (ModuleData& data)
{
using namespace msgEventLoop;
if (m_event != nullptr || m_store != nullptr)
{
ANA_MSG_ERROR ("module initialized twice");
return ::StatusCode::FAILURE;
}
if (data.m_tevent != nullptr || data.m_tstore != nullptr)
{
ANA_MSG_ERROR ("duplicate TEventModule??");
return ::StatusCode::FAILURE;
}
// In order to properly read some of the xAOD objects and tools
// operating on them the dictionaries, some of the xAOD
......@@ -77,6 +67,26 @@ namespace EL
// an option and/or a dedicated module could be added for it.
ANA_CHECK (xAOD::LoadDictionaries());
return StatusCode::SUCCESS;
}
::StatusCode TEventModule ::
onInitialize (ModuleData& data)
{
using namespace msgEventLoop;
if (m_event != nullptr || m_store != nullptr)
{
ANA_MSG_ERROR ("module initialized twice");
return ::StatusCode::FAILURE;
}
if (data.m_tevent != nullptr || data.m_tstore != nullptr)
{
ANA_MSG_ERROR ("duplicate TEventModule??");
return ::StatusCode::FAILURE;
}
std::string modeStr = data.m_metaData->castString
(Job::optXaodAccessMode);
if (!modeStr.empty())
......
......@@ -398,8 +398,12 @@ namespace EL
("EventLoop_JobStats", "EventLoop job statistics");
m_jobStats->SetDirectory (nullptr);
ANA_MSG_INFO ("calling firstInitialize on all modules");
for (auto& module : m_modules)
ANA_CHECK (module->preInitialize (*this));
ANA_CHECK (module->firstInitialize (*this));
ANA_MSG_INFO ("calling preFileInitialize on all modules");
for (auto& module : m_modules)
ANA_CHECK (module->preFileInitialize (*this));
return ::StatusCode::SUCCESS;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment