Skip to content
Snippets Groups Projects
Commit 70c18457 authored by Stewart Martin-Haugh's avatar Stewart Martin-Haugh
Browse files

Merge branch 'master-ShmProxy-Incident' into 'master'

One less incident to worry about

See merge request atlas/athena!24472
parents ed636579 da37d1c1
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHENAKERNEL_IMETADATATRANSITION_H
......@@ -13,6 +13,7 @@
#include "GaudiKernel/INamedInterface.h"
#include "GaudiKernel/Incident.h"
#include <string>
/** @class IMetadataTransition
* @brief This class provides the interface for MetadataTransitions.
......@@ -31,7 +32,7 @@ public: // Non-static members
/// Function called when the tool should write out its metadata
virtual StatusCode prepareOutput() = 0;
virtual StatusCode proxyIncident(const Incident&) = 0;
virtual StatusCode shmProxy(const std::string& filename) = 0;
/// Gaudi boilerplate
static const InterfaceID& interfaceID();
......
......@@ -128,7 +128,6 @@ StatusCode MetaDataSvc::initialize() {
m_incSvc->addListener(this, "BeginInputFile", 80);
m_incSvc->addListener(this, "EndInputFile", 10);
m_incSvc->addListener(this, "LastInputFile", 10);
m_incSvc->addListener(this, "ShmProxy", 90);
// Register this service for 'I/O' events
ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", this->name());
......@@ -220,6 +219,8 @@ StatusCode MetaDataSvc::stop() {
StatusCode MetaDataSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) {
if (riid == this->interfaceID()) {
*ppvInterface = this;
} else if (riid == IMetadataTransition::interfaceID()) {
*ppvInterface = dynamic_cast<IMetadataTransition*>(this);
} else {
// Interface is not directly available: try out a base class
return(::AthService::queryInterface(riid, ppvInterface));
......@@ -342,24 +343,19 @@ StatusCode MetaDataSvc::prepareOutput()
return rc;
}
StatusCode MetaDataSvc::proxyIncident(const Incident& inc)
StatusCode MetaDataSvc::shmProxy(const std::string& filename)
{
const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
if (fileInc == nullptr) {
ATH_MSG_ERROR("Unable to get FileName from EndInputFile incident");
return StatusCode::FAILURE;
}
const std::string fileName = fileInc->fileName();
if (!m_clearedInputDataStore) {
if (!m_inputDataStore->clearStore().isSuccess()) {
ATH_MSG_WARNING("Unable to clear input MetaData Proxies");
ATH_MSG_ERROR("Unable to clear input MetaData Proxies");
return StatusCode::FAILURE;
}
m_clearedInputDataStore = true;
}
if (!addProxyToInputMetaDataStore(fileName).isSuccess()) {
ATH_MSG_WARNING("Unable to add proxy to InputMetaDataStore");
if (!addProxyToInputMetaDataStore(filename).isSuccess()) {
ATH_MSG_ERROR("Unable to add proxy to InputMetaDataStore");
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
......@@ -394,10 +390,6 @@ void MetaDataSvc::handle(const Incident& inc) {
if (m_metaDataTools.release().isFailure()) {
ATH_MSG_WARNING("Cannot release " << m_metaDataTools);
}
} else if (inc.type() == "ShmProxy") {
if(proxyIncident(inc).isFailure()) {
ATH_MSG_ERROR("Could not process proxy incident for " << fileName);
}
}
}
//__________________________________________________________________________
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef METADATASVC_H
#define METADATASVC_H
#ifndef ATHENASERVICES_METADATASVC_H
#define ATHENASERVICES_METADATASVC_H
/** @file MetaDataSvc.h
* @brief This file contains the class definition for the MetaDataSvc class.
......@@ -76,8 +76,9 @@ public: // Non-static members
/// Function called when the current state of metadata must be made
/// ready for output
StatusCode prepareOutput();
StatusCode proxyIncident(const Incident&);
virtual StatusCode shmProxy(const std::string& filename) override;
StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface);
/// Get all addresses from provider. Called before begin event.
......
......@@ -21,6 +21,7 @@
#include "AthenaKernel/IAthenaSerializeSvc.h"
#include "AthenaKernel/IClassIDSvc.h"
#include "AthenaKernel/IAthenaOutputStreamTool.h"
#include "AthenaKernel/IMetadataTransition.h"
#include "PersistentDataModel/Placement.h"
#include "PersistentDataModel/Token.h"
#include "PersistentDataModel/TokenAddress.h"
......@@ -463,9 +464,13 @@ StatusCode AthenaPoolCnvSvc::commitOutput(const std::string& outputConnectionSpe
}
std::ostringstream oss2;
oss2 << std::dec << num;
// For Metadata fire incident to read object into store
FileIncident proxyIncident(name(), "ShmProxy", std::string(placementStr) + "[NUM=" + oss2.str() + "]");
incSvc->fireIncident(proxyIncident); // Object will be pulled out of shared memory by setObjPtr()
// Retrieve MetaDataSvc
ServiceHandle<IMetadataTransition> metadataTransition("MetaDataSvc", name());
ATH_CHECK(metadataTransition.retrieve());
if(!metadataTransition->shmProxy(std::string(placementStr) + "[NUM=" + oss2.str() + "]").isSuccess()) {
ATH_MSG_FATAL("IMetadataTransition::shmProxy() failed!");
return StatusCode::FAILURE;
}
} else {
Token readToken;
readToken.setOid(Token::OID_t(num, 0));
......
......@@ -2,8 +2,8 @@
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHENAPOOLCNVSVC_H
#define ATHENAPOOLCNVSVC_H
#ifndef ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
#define ATHENAPOOLCNVSVC_ATHENAPOOLCNVSVC_H
/** @file AthenaPoolCnvSvc.h
* @brief This file contains the class definition for the AthenaPoolCnvSvc class.
......
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