Skip to content
Snippets Groups Projects
Commit 5187a41f authored by James Beacham's avatar James Beacham
Browse files

Merge branch '21.0-skipeventsignore-ES' into '21.0'

Ignoring skipEvents in Event Service jobs

See merge request atlas/athena!7101

Former-commit-id: e6f0f2a58ea59e1c4e497e86035c40f2cb9f4ebe
parents 40f2c6af 634ec637
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ AthMpEvtLoopMgr::AthMpEvtLoopMgr(const std::string& name ...@@ -42,6 +42,7 @@ AthMpEvtLoopMgr::AthMpEvtLoopMgr(const std::string& name
, ISvcLocator* svcLocator) , ISvcLocator* svcLocator)
: AthService(name,svcLocator) : AthService(name,svcLocator)
, m_evtProcessor("AthenaEventLoopMgr", name) , m_evtProcessor("AthenaEventLoopMgr", name)
, m_evtSelector(nullptr)
, m_nWorkers(0) , m_nWorkers(0)
, m_workerTopDir("athenaMP_workers") , m_workerTopDir("athenaMP_workers")
, m_outputReportName("AthenaMPOutputs") , m_outputReportName("AthenaMPOutputs")
...@@ -75,11 +76,29 @@ StatusCode AthMpEvtLoopMgr::initialize() ...@@ -75,11 +76,29 @@ StatusCode AthMpEvtLoopMgr::initialize()
{ {
ATH_MSG_DEBUG("in initialize() ... "); ATH_MSG_DEBUG("in initialize() ... ");
if(m_strategy=="EventService" && m_nEventsBeforeFork!=0) { SmartIF<IProperty> prpMgr(serviceLocator());
ATH_MSG_ERROR("The EventService strategy cannot run with non-zero value for EventsBeforeFork"); if(!prpMgr.isValid()) {
ATH_MSG_ERROR("Failed to get hold of the Property Manager");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
ATH_CHECK(serviceLocator()->service(evtSelName,m_evtSelector));
if(m_strategy=="EventService") {
// ES with non-zero events before forking makes no sense
if(m_nEventsBeforeFork!=0) {
ATH_MSG_ERROR("The EventService strategy cannot run with non-zero value for EventsBeforeFork");
return StatusCode::FAILURE;
}
// We need to ignore SkipEvents in ES
if(updateSkipEvents(0).isFailure()) {
ATH_MSG_ERROR("Failed to set skipEvents=0 in Event Service");
return StatusCode::FAILURE;
}
}
if(m_isPileup) { if(m_isPileup) {
m_evtProcessor = ServiceHandle<IEventProcessor>("PileUpEventLoopMgr",name()); m_evtProcessor = ServiceHandle<IEventProcessor>("PileUpEventLoopMgr",name());
ATH_MSG_INFO("ELM: The job running in pileup mode"); ATH_MSG_INFO("ELM: The job running in pileup mode");
...@@ -320,17 +339,7 @@ StatusCode AthMpEvtLoopMgr::executeRun(int maxevt) ...@@ -320,17 +339,7 @@ StatusCode AthMpEvtLoopMgr::executeRun(int maxevt)
} }
// Restart the event selector in order to avoid segfault at stop() // Restart the event selector in order to avoid segfault at stop()
SmartIF<IProperty> prpMgr(serviceLocator()); ATH_CHECK(m_evtSelector->start());
if(prpMgr.isValid()) {
std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
IService* evtSelector(0);
ATH_CHECK(serviceLocator()->service(evtSelName,evtSelector));
ATH_CHECK(evtSelector->start());
}
else {
ATH_MSG_ERROR("Failed to get hold of the Property Manager");
return StatusCode::FAILURE;
}
if(sc.isSuccess()) if(sc.isSuccess())
return generateOutputReport(); return generateOutputReport();
...@@ -643,22 +652,12 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt) ...@@ -643,22 +652,12 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
} }
// Change the InputCollections property of the event selector // Change the InputCollections property of the event selector
SmartIF<IProperty> prpMgr(serviceLocator()); IProperty* propertyServer = dynamic_cast<IProperty*>(m_evtSelector);
IService* evtSelector(0);
if(prpMgr.isValid()) {
std::string evtSelName = prpMgr->getProperty("EvtSel").toString();
ATH_CHECK(serviceLocator()->service(evtSelName,evtSelector));
}
else {
ATH_MSG_ERROR("Failed to get hold of the Property Manager");
return StatusCode::FAILURE;
}
IProperty* propertyServer = dynamic_cast<IProperty*>(evtSelector);
if(!propertyServer) { if(!propertyServer) {
ATH_MSG_ERROR("Unable to dyn-cast the event selector to IProperty"); ATH_MSG_ERROR("Unable to dyn-cast the event selector to IProperty");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
std::string propertyName("InputCollections"); std::string propertyName("InputCollections");
StringArrayProperty newInputFileList(propertyName, inpFiles); StringArrayProperty newInputFileList(propertyName, inpFiles);
if(propertyServer->setProperty(newInputFileList).isFailure()) { if(propertyServer->setProperty(newInputFileList).isFailure()) {
...@@ -668,7 +667,7 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt) ...@@ -668,7 +667,7 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
ATH_MSG_INFO("Updated the InputCollections property of the event selector"); ATH_MSG_INFO("Updated the InputCollections property of the event selector");
// Register new input files with the I/O component manager // Register new input files with the I/O component manager
IIoComponent* iocomp = dynamic_cast<IIoComponent*>(evtSelector); IIoComponent* iocomp = dynamic_cast<IIoComponent*>(m_evtSelector);
if(iocomp==nullptr) { if(iocomp==nullptr) {
ATH_MSG_FATAL("Unable to dyn-cast Event Selector to IIoComponent"); ATH_MSG_FATAL("Unable to dyn-cast Event Selector to IIoComponent");
return StatusCode::FAILURE; return StatusCode::FAILURE;
...@@ -707,14 +706,22 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt) ...@@ -707,14 +706,22 @@ StatusCode AthMpEvtLoopMgr::afterRestart(int& maxevt)
// _______________________ Update Skip Events ___________________________ // _______________________ Update Skip Events ___________________________
int skipEvents = std::atoi(tokens["skipEvents"].c_str()); int skipEvents = std::atoi(tokens["skipEvents"].c_str());
return updateSkipEvents(skipEvents);
}
StatusCode AthMpEvtLoopMgr::updateSkipEvents(int skipEvents)
{
IProperty* propertyServer = dynamic_cast<IProperty*>(m_evtSelector);
if(!propertyServer) {
ATH_MSG_ERROR("Unable to dyn-cast the event selector to IProperty");
return StatusCode::FAILURE;
}
propertyName = "SkipEvents"; IntegerProperty skipEventsProperty("SkipEvents", skipEvents);
IntegerProperty skipEventsProperty(propertyName, skipEvents);
if(propertyServer->setProperty(skipEventsProperty).isFailure()) { if(propertyServer->setProperty(skipEventsProperty).isFailure()) {
ATH_MSG_ERROR("Unable to update " << skipEventsProperty.name() << " property on the Event Selector"); ATH_MSG_ERROR("Unable to update " << skipEventsProperty.name() << " property on the Event Selector");
return StatusCode::FAILURE; return StatusCode::FAILURE;
} }
ATH_MSG_INFO("Updated the SkipEvents property of the event selector. New value: " << skipEvents); ATH_MSG_INFO("Updated the SkipEvents property of the event selector. New value: " << skipEvents);
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
#ifndef ATHENAMP_ATHMPEVTLOOPMGR_H #ifndef ATHENAMP_ATHMPEVTLOOPMGR_H
#define ATHENAMP_ATHMPEVTLOOPMGR_H 1 #define ATHENAMP_ATHMPEVTLOOPMGR_H
#include "GaudiKernel/IEventProcessor.h" #include "GaudiKernel/IEventProcessor.h"
#include "AthenaBaseComps/AthService.h" #include "AthenaBaseComps/AthService.h"
...@@ -38,6 +38,7 @@ class AthMpEvtLoopMgr ...@@ -38,6 +38,7 @@ class AthMpEvtLoopMgr
private: private:
ServiceHandle<IEventProcessor> m_evtProcessor; ServiceHandle<IEventProcessor> m_evtProcessor;
IService* m_evtSelector;
int m_nWorkers; int m_nWorkers;
std::string m_workerTopDir; std::string m_workerTopDir;
std::string m_outputReportName; std::string m_outputReportName;
...@@ -64,7 +65,8 @@ class AthMpEvtLoopMgr ...@@ -64,7 +65,8 @@ class AthMpEvtLoopMgr
StatusCode wait(); StatusCode wait();
StatusCode generateOutputReport(); StatusCode generateOutputReport();
boost::shared_ptr<AthenaInterprocess::FdsRegistry> extractFds(); boost::shared_ptr<AthenaInterprocess::FdsRegistry> extractFds();
StatusCode afterRestart(int&); StatusCode afterRestart(int& maxevt);
StatusCode updateSkipEvents(int skipEvents);
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment