Skip to content
Snippets Groups Projects
Commit e1e6eb24 authored by cranshaw's avatar cranshaw
Browse files

Change AthenaOutputStream metadata handling back to using the

MetaDataStop incident rather than the stop method as this was
not compatible with AthenaMP.
parent 4bd7e054
No related branches found
No related tags found
10 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!28528Revert 63f845ae,!27054Atr20369 210,!26342Monopole: Handle fractionally charged particles,!20646Fix incompatibility of rel 22 metadata with athenaMP,!20570Fix incompatibility of rel 22 metadata with athenaMP
......@@ -318,6 +318,7 @@ StatusCode AthenaOutputStream::initialize() {
StatusCode AthenaOutputStream::stop()
{
ATH_MSG_DEBUG("AthenaOutputStream " << this->name() << " ::stop()");
/*
for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin();
iter != m_helperTools.end(); iter++) {
if (!(*iter)->preFinalize().isSuccess()) {
......@@ -369,6 +370,7 @@ StatusCode AthenaOutputStream::stop()
}
ATH_MSG_INFO("Records written: " << m_events);
}
*/
return StatusCode::SUCCESS;
}
......@@ -377,6 +379,60 @@ void AthenaOutputStream::handle(const Incident& inc) {
if (inc.type() == "MetaDataStop") {
// Moved preFinalize of helper tools to stop - want to optimize the
// output file in finalize RDS 12/2009
for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin();
iter != m_helperTools.end(); iter++) {
if (!(*iter)->preFinalize().isSuccess()) {
ATH_MSG_ERROR("Cannot finalize helper tool");
}
}
// Make sure the metadata tools finalize their output
ServiceHandle<MetaDataSvc> mdsvc("MetaDataSvc", name());
if (mdsvc.retrieve().isFailure()) {
ATH_MSG_ERROR("Could not retrieve MetaDataSvc for stop actions");
}
else {
if (mdsvc->prepareOutput().isFailure()) {
ATH_MSG_ERROR("Failed on MetaDataSvc prepareOutput");
}
}
// Always force a final commit in stop - mainly applies to AthenaPool
if (m_writeOnFinalize) {
if (write().isFailure()) { // true mean write AND commit
ATH_MSG_ERROR("Cannot write on finalize");
}
ATH_MSG_INFO("Records written: " << m_events);
}
if (!m_metadataItemList.value().empty()) {
m_currentStore = &m_metadataStore;
StatusCode status = m_streamer->connectServices(m_metadataStore.type(), m_persName, false);
if (status.isFailure()) {
throw GaudiException("Unable to connect metadata services", name(), StatusCode::FAILURE);
}
m_checkNumberOfWrites = false;
m_outputAttributes = "[OutputCollection=MetaDataHdr][PoolContainerPrefix=MetaData][AttributeListKey=][DataHeaderSatellites=]";
m_p2BWritten->clear();
IProperty *pAsIProp(nullptr);
if ((m_p2BWritten.retrieve()).isFailure() ||
nullptr == (pAsIProp = dynamic_cast<IProperty*>(&*m_p2BWritten)) ||
(pAsIProp->setProperty("ItemList", m_metadataItemList.toString())).isFailure()) {
throw GaudiException("Folder property [metadataItemList] not found", name(), StatusCode::FAILURE);
}
if (write().isFailure()) { // true mean write AND commit
ATH_MSG_ERROR("Cannot write metadata");
}
m_outputAttributes.clear();
m_currentStore = &m_dataStore;
status = m_streamer->connectServices(m_dataStore.type(), m_persName, m_extendProvenanceRecord);
if (status.isFailure()) {
throw GaudiException("Unable to re-connect services", name(), StatusCode::FAILURE);
}
m_p2BWritten->clear();
if ((pAsIProp->setProperty(m_itemList)).isFailure()) {
throw GaudiException("Folder property [itemList] not found", name(), StatusCode::FAILURE);
}
ATH_MSG_INFO("Records written: " << m_events);
}
} else if (inc.type() == "UpdateOutputFile") {
const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
if(fileInc!=nullptr) {
......@@ -862,6 +918,8 @@ StatusCode AthenaOutputStream::io_reinit() {
}
return StatusCode::SUCCESS;
}
StatusCode AthenaOutputStream::io_finalize() {
ATH_MSG_INFO("I/O finalization...");
for (std::vector<ToolHandle<IAthenaOutputTool> >::iterator iter = m_helperTools.begin();
......
......@@ -185,6 +185,7 @@ StatusCode MetaDataSvc::finalize() {
}
//__________________________________________________________________________
StatusCode MetaDataSvc::stop() {
ATH_MSG_INFO("MetaDataSvc::stop()");
ServiceHandle<IJobOptionsSvc> joSvc("JobOptionsSvc", name());
if (!joSvc.retrieve().isSuccess()) {
ATH_MSG_WARNING("Cannot get JobOptionsSvc.");
......@@ -205,6 +206,10 @@ StatusCode MetaDataSvc::stop() {
}
}
// Set to be listener for end of event
Incident metaDataStopIncident(name(), "MetaDataStop");
m_incSvc->fireIncident(metaDataStopIncident);
// finalizing tools via metaDataStop
ATH_CHECK(this->prepareOutput());
......@@ -318,6 +323,7 @@ StatusCode MetaDataSvc::retireMetadataSource(const Incident& inc)
StatusCode MetaDataSvc::prepareOutput()
{
ATH_MSG_DEBUG("prepareOutput");
StatusCode rc(StatusCode::SUCCESS);
for (auto it = m_metaDataTools.begin(); it != m_metaDataTools.end(); ++it) {
ATH_MSG_DEBUG(" calling metaDataStop for " << (*it)->name());
......@@ -397,6 +403,9 @@ StatusCode MetaDataSvc::transitionMetaDataFile(bool ignoreInputFile) {
return(StatusCode::FAILURE);
}
Incident metaDataStopIncident(name(), "MetaDataStop");
m_incSvc->fireIncident(metaDataStopIncident);
// Set to be listener for end of event
ATH_CHECK(this->prepareOutput());
......
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