The Gaudi Framework  v32r2 (46d42edc)
HiveDataBrokerSvc Class Referencefinal

#include <src/HiveDataBroker.h>

Inheritance diagram for HiveDataBrokerSvc:
Collaboration diagram for HiveDataBrokerSvc:

Classes

struct  AlgEntry
 

Public Member Functions

std::vector< Gaudi::Algorithm * > algorithmsRequiredFor (const DataObjIDColl &requested, const std::vector< std::string > &stoppers={}) const override
 
std::vector< Gaudi::Algorithm * > algorithmsRequiredFor (const Gaudi::Utils::TypeNameString &alg, const std::vector< std::string > &stoppers={}) const override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
- Public Member Functions inherited from extends< Service, IDataBroker >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service. More...
 
StatusCode sysStart () override
 Initialize Service. More...
 
StatusCode sysStop () override
 Initialize Service. More...
 
StatusCode sysFinalize () override
 Finalize Service. More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const
 Backward compatibility function for getting the output level. More...
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
const SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 

Private Member Functions

std::vector< AlgEntryinstantiateAndInitializeAlgorithms (const std::vector< std::string > &names) const
 
std::map< DataObjID, AlgEntry * > mapProducers (std::vector< AlgEntry > &algorithms) const
 

Private Attributes

Gaudi::Property< std::stringm_dataLoader
 
Gaudi::Property< std::vector< std::string > > m_producers
 
std::vector< AlgEntrym_algorithms
 
std::vector< AlgEntrym_cfnodes
 
std::map< DataObjID, AlgEntry * > m_dependencies
 

Additional Inherited Members

- Public Types inherited from extends< Service, IDataBroker >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::Property< int > m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
 
Gaudi::Property< bool > m_auditInit {this, "AuditServices", false, " unused"}
 
Gaudi::Property< bool > m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
 
Gaudi::Property< bool > m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
 
Gaudi::Property< bool > m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
 
Gaudi::Property< bool > m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
 
Gaudi::Property< bool > m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
 
Gaudi::Property< bool > m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

Definition at line 7 of file HiveDataBroker.h.

Member Function Documentation

◆ algorithmsRequiredFor() [1/2]

std::vector< Gaudi::Algorithm * > HiveDataBrokerSvc::algorithmsRequiredFor ( const DataObjIDColl requested,
const std::vector< std::string > &  stoppers = {} 
) const
override

Definition at line 248 of file HiveDataBroker.cpp.

249  {
251 
253  deps.reserve( requested.size() );
254 
255  // start with seeding from the initial request
256  for ( const auto& req : requested ) {
257  DataObjID id = req;
258  if ( id.key().find( ":" ) != std::string::npos ) {
259  warning() << req.key() << " contains alternatives which require resolution...\n";
260  auto tokens = boost::tokenizer<boost::char_separator<char>>{id.key(), boost::char_separator<char>{":"}};
261  auto itok = std::find_if( tokens.begin(), tokens.end(),
262  [&]( DataObjID t ) { return m_dependencies.find( t ) != m_dependencies.end(); } );
263  if ( itok != tokens.end() ) {
264  warning() << "found matching output for " << *itok << " -- updating info\n";
265  id.updateKey( *itok );
266  warning() << "Please update input to not require alternatives, and "
267  "instead properly configure the dataloader"
268  << endmsg;
269  } else {
270  error() << "failed to find alternate in global output list"
271  << " for id: " << id << endmsg;
272  }
273  }
274  auto i = m_dependencies.find( id );
275  if ( i == m_dependencies.end() )
276  throw GaudiException( "unknown requested input: " + id.key(), __func__, StatusCode::FAILURE );
277  deps.push_back( i->second );
278  }
279  // insert the (direct) dependencies of 'current' right after 'current', and
280  // interate until done...
281  for ( auto current = deps.begin(); current != deps.end(); ++current ) {
282  if ( std::any_of( std::begin( stoppers ), std::end( stoppers ),
283  [current]( auto& stopper ) { return ( *current )->alg->name() == stopper; } ) ) {
284  continue;
285  }
286  for ( auto* entry : ( *current )->dependsOn ) {
287  if ( std::find( std::next( current ), deps.end(), entry ) != deps.end() ) continue; // already there downstream...
288 
289  auto dup = std::find( deps.begin(), current, entry );
290  // if present upstream, move it downstream. Otherwise, insert
291  // downstream...
292  current = std::prev( dup != current ? std::rotate( dup, std::next( dup ), std::next( current ) )
293  : deps.insert( std::next( current ), entry ) );
294  }
295  }
296  auto range = ( deps | ranges::view::transform( []( auto& i ) { return i->alg; } ) | ranges::view::reverse );
297  return {begin( range ), end( range )};
298 }
Define general base for Gaudi exception.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
::details::reverse_wrapper< T > reverse(T &&iterable)
Definition: reverse.h:49
T end(T... args)
std::map< DataObjID, AlgEntry * > m_dependencies
T prev(T... args)
T push_back(T... args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
T next(T... args)
def end
Definition: IOTest.py:113
T insert(T... args)
T find_if(T... args)
T size(T... args)
T begin(T... args)
T any_of(T... args)
T rotate(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
T reserve(T... args)

◆ algorithmsRequiredFor() [2/2]

std::vector< Gaudi::Algorithm * > HiveDataBrokerSvc::algorithmsRequiredFor ( const Gaudi::Utils::TypeNameString alg,
const std::vector< std::string > &  stoppers = {} 
) const
override

Definition at line 301 of file HiveDataBroker.cpp.

302  {
304 
305  auto alg = std::find_if( begin( m_cfnodes ), end( m_cfnodes ),
306  [&]( const AlgEntry& ae ) { return ae.alg->name() == requested.name(); } );
307 
308  if ( alg != end( m_cfnodes ) && alg->alg->type() != requested.type() ) {
309  error() << "requested " << requested << " but have matching name with different type: " << alg->alg->type()
310  << endmsg;
311  }
312  if ( alg == end( m_cfnodes ) ) {
313  auto av = instantiateAndInitializeAlgorithms( {requested.type() + '/' + requested.name()} );
314  assert( av.size() == 1 );
315  m_cfnodes.push_back( std::move( av.front() ) );
316  alg = std::next( m_cfnodes.rbegin() ).base();
317  }
318  assert( alg != end( m_cfnodes ) );
319  assert( alg->alg != nullptr );
320  if ( std::find_if( std::begin( stoppers ), std::end( stoppers ),
321  [&requested]( auto& stopper ) { return requested.name() == stopper; } ) == std::end( stoppers ) ) {
322  result = algorithmsRequiredFor( alg->alg->inputDataObjs(), stoppers );
323  }
324  result.push_back( alg->alg );
325  if ( msgLevel( MSG::DEBUG ) ) {
326  debug() << std::endl << "requested " << requested << " returning " << std::endl << " ";
328  debug(), result, ",\n ",
329  []( auto& os, const Gaudi::Algorithm* a ) -> decltype( auto ) { return os << AlgorithmRepr{*a}; } );
330  debug() << std::endl << endmsg;
331  }
332  return result;
333 }
std::vector< AlgEntry > m_cfnodes
T endl(T... args)
T end(T... args)
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
T push_back(T... args)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
T next(T... args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
def end
Definition: IOTest.py:113
T move(T... args)
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Definition: SerializeSTL.h:37
std::vector< Gaudi::Algorithm * > algorithmsRequiredFor(const DataObjIDColl &requested, const std::vector< std::string > &stoppers={}) const override
T find_if(T... args)
T begin(T... args)
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
std::vector< AlgEntry > instantiateAndInitializeAlgorithms(const std::vector< std::string > &names) const
AttribStringParser::Iterator begin(const AttribStringParser &parser)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ finalize()

StatusCode HiveDataBrokerSvc::finalize ( )
override

Definition at line 125 of file HiveDataBroker.cpp.

125  {
126  ranges::for_each( m_algorithms | ranges::view::transform( &AlgEntry::alg ),
127  []( Gaudi::Algorithm* alg ) { alg->sysFinalize(); } );
128  m_algorithms.clear();
129  return Service::finalize();
130 }
StatusCode finalize() override
Definition: Service.cpp:164
std::vector< AlgEntry > m_algorithms
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
Gaudi::Algorithm * alg

◆ initialize()

StatusCode HiveDataBrokerSvc::initialize ( )
override

Definition at line 50 of file HiveDataBroker.cpp.

50  {
51  auto sc = Service::initialize();
52  if ( sc.isFailure() ) return sc;
53  // populate m_algorithms
55  if ( sc.isFailure() ) return sc;
56 
57  // warn about non-reentrant algorithms
58  ranges::for_each( m_algorithms | ranges::view::transform( []( const auto& entry ) { return entry.alg; } ) |
59  ranges::view::remove_if( []( const auto* alg ) { return alg->cardinality() == 0; } ),
60  [&]( const Gaudi::Algorithm* alg ) {
61  this->warning() << "non-reentrant algorithm: " << AlgorithmRepr{*alg} << endmsg;
62  } );
63  //== Print the list of the created algorithms
64  if ( msgLevel( MSG::DEBUG ) ) {
65  MsgStream& msg = debug();
66  msg << "Available DataProducers: ";
68  msg, m_algorithms, ", ",
69  []( auto& os, const AlgEntry& e ) -> decltype( auto ) { return os << AlgorithmRepr{*e.alg}; } );
70  msg << endmsg;
71  }
72 
73  // populate m_dependencies
75  return sc;
76 }
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
StatusCode initialize() override
Definition: Service.cpp:60
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
std::map< DataObjID, AlgEntry * > mapProducers(std::vector< AlgEntry > &algorithms) const
std::map< DataObjID, AlgEntry * > m_dependencies
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
Gaudi::Property< std::vector< std::string > > m_producers
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< AlgEntry > m_algorithms
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Definition: SerializeSTL.h:37
MsgStream & msg() const
shortcut for the method msgStream(MSG::INFO)
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:79
std::vector< AlgEntry > instantiateAndInitializeAlgorithms(const std::vector< std::string > &names) const
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ instantiateAndInitializeAlgorithms()

std::vector< HiveDataBrokerSvc::AlgEntry > HiveDataBrokerSvc::instantiateAndInitializeAlgorithms ( const std::vector< std::string > &  names) const
private

Definition at line 134 of file HiveDataBroker.cpp.

134  {
135  std::vector<AlgEntry> algorithms;
136 
137  //= Get the Application manager, to see if algorithm exist
138  auto appMgr = service<IAlgManager>( "ApplicationMgr" );
139  for ( const Gaudi::Utils::TypeNameString item : names ) {
140  const std::string& theName = item.name();
141  const std::string& theType = item.type();
142 
143  //== Check wether the specified algorithm already exists. If not, create it
144  SmartIF<IAlgorithm> myIAlg = appMgr->algorithm( item, false ); // do not create it now
145  if ( !myIAlg ) {
146  myIAlg = createAlgorithm( *appMgr, theType, theName );
147  } else {
148  // when the algorithm is not created, the ref count is short by one, so we
149  // have to fix it.
150  myIAlg->addRef();
151  }
152 
153  if ( !myIAlg ) {
154  throw GaudiException{"Failed to create " + boost::lexical_cast<std::string>( item ), __func__,
156  }
157 
158  // propagate the sub-algorithm into own state.
159  StatusCode sc = myIAlg->sysInitialize();
160  if ( sc.isFailure() ) {
161  throw GaudiException{"Failed to initialize " + boost::lexical_cast<std::string>( item ), __func__,
163  }
164 
165  algorithms.emplace_back( std::move( myIAlg ) );
166  }
167 
168  return algorithms;
169 }
Define general base for Gaudi exception.
virtual StatusCode sysInitialize()=0
Initialization method invoked by the framework.
STL class.
Helper class to parse a string of format "type/name".
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
T move(T... args)
STL class.
appMgr
Definition: IOTest.py:93
constexpr static const auto FAILURE
Definition: StatusCode.h:86
bool isFailure() const
Definition: StatusCode.h:130
T emplace_back(T... args)

◆ mapProducers()

std::map< DataObjID, HiveDataBrokerSvc::AlgEntry * > HiveDataBrokerSvc::mapProducers ( std::vector< AlgEntry > &  algorithms) const
private

Definition at line 172 of file HiveDataBroker.cpp.

172  {
173  if ( msgLevel( MSG::DEBUG ) ) {
174  debug() << "Data Dependencies for Algorithms:";
175  for ( const auto& entry : m_algorithms ) {
176  debug() << "\n " << entry.alg->name() << " :";
177  for ( const auto* id : sortedDataObjIDColl( entry.alg->inputDataObjs() ) ) {
178  debug() << "\n o INPUT " << id->key();
179  }
180  for ( const auto* id : sortedDataObjIDColl( entry.alg->outputDataObjs() ) ) {
181  debug() << "\n o OUTPUT " << id->key();
182  }
183  }
184  debug() << endmsg;
185  }
186 
187  // figure out all outputs
189  for ( AlgEntry& alg : algorithms ) {
190  const auto& output = alg.alg->outputDataObjs();
191  if ( output.empty() ) { continue; }
192  for ( auto id : output ) {
193  if ( id.key().find( ":" ) != std::string::npos ) {
194  error() << " in Alg " << AlgorithmRepr{*alg.alg} << " alternatives are NOT allowed for outputs! id: " << id
195  << endmsg;
196  }
197 
198  auto r = producers.emplace( id, &alg );
199  if ( !r.second ) {
200  throw GaudiException( "multiple algorithms declare " + id.key() + " as output. This is not allowed", __func__,
202  }
203  }
204  }
205 
206  // resolve dependencies
207  for ( auto& algEntry : algorithms ) {
208  auto input = sortedDataObjIDColl( algEntry.alg->inputDataObjs() );
209  for ( const DataObjID* idp : input ) {
210  DataObjID id = *idp;
211  if ( id.key().find( ":" ) != std::string::npos ) {
212  warning() << AlgorithmRepr{*( algEntry.alg )} << " contains alternatives which require resolution...\n";
213  auto tokens = boost::tokenizer<boost::char_separator<char>>{id.key(), boost::char_separator<char>{":"}};
214  auto itok = std::find_if( tokens.begin(), tokens.end(),
215  [&]( DataObjID t ) { return producers.find( t ) != producers.end(); } );
216  if ( itok != tokens.end() ) {
217  warning() << "found matching output for " << *itok << " -- updating info\n";
218  id.updateKey( *itok );
219  warning() << "Please update input to not require alternatives, and "
220  "instead properly configure the dataloader"
221  << endmsg;
222  } else {
223  error() << "failed to find alternate in global output list"
224  << " for id: " << id << " in Alg " << algEntry.alg << endmsg;
225  }
226  }
227  auto iproducer = producers.find( id );
228  if ( iproducer != producers.end() ) {
229  algEntry.dependsOn.insert( iproducer->second );
230  } else {
231  std::ostringstream error_message;
232  error_message << "\nUnknown requested input by " << AlgorithmRepr{*( algEntry.alg )} << " : " << id.key()
233  << " .\n";
234  error_message << "You can set the OutputLevel of HiveDataBrokerSvc to DEBUG to get a list of inputs and "
235  "outputs of every algorithm.\n";
236  throw GaudiException( error_message.str(), __func__, StatusCode::FAILURE );
237  // TODO: assign to dataloader!
238  // algEntry.dependsOn.insert(dataloader.alg);
239  // dataloader.data.emplace( id ); // TODO: we may ask to much of the
240  // dataloader this way...
241  }
242  }
243  }
244  return producers;
245 }
Define general base for Gaudi exception.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
T end(T... args)
STL class.
MSG::Level msgLevel() const
get the cached level (originally extracted from the embedded MsgStream)
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
std::set< AlgEntry * > dependsOn
T str(T... args)
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
std::vector< AlgEntry > m_algorithms
T find_if(T... args)
T emplace(T... args)
constexpr static const auto FAILURE
Definition: StatusCode.h:86
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ start()

StatusCode HiveDataBrokerSvc::start ( )
override

Definition at line 78 of file HiveDataBroker.cpp.

78  {
79 
81  if ( !ss.isSuccess() ) return ss;
82 
83  // sysStart for m_algorithms
84  for ( AlgEntry& algEntry : m_algorithms ) {
85  ss = algEntry.alg->sysStart();
86  if ( ss.isFailure() ) {
87  error() << "Unable to start Algorithm: " << algEntry.alg->name() << endmsg;
88  return ss;
89  }
90  }
91  // sysStart for m_cfnodes
92  for ( AlgEntry& algEntry : m_cfnodes ) {
93  ss = algEntry.alg->sysStart();
94  if ( ss.isFailure() ) {
95  error() << "Unable to start Algorithm: " << algEntry.alg->name() << endmsg;
96  return ss;
97  }
98  }
99  return ss;
100 }
StatusCode start() override
Definition: Service.cpp:129
std::vector< AlgEntry > m_cfnodes
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
bool isSuccess() const
Definition: StatusCode.h:267
std::vector< AlgEntry > m_algorithms
bool isFailure() const
Definition: StatusCode.h:130
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

◆ stop()

StatusCode HiveDataBrokerSvc::stop ( )
override

Definition at line 102 of file HiveDataBroker.cpp.

102  {
103  StatusCode ss = Service::stop();
104  if ( !ss.isSuccess() ) return ss;
105 
106  // sysStart for m_algorithms
107  for ( AlgEntry& algEntry : m_algorithms ) {
108  ss = algEntry.alg->sysStop();
109  if ( ss.isFailure() ) {
110  error() << "Unable to stop Algorithm: " << algEntry.alg->name() << endmsg;
111  return ss;
112  }
113  }
114  // sysStart for m_cfnodes
115  for ( AlgEntry& algEntry : m_cfnodes ) {
116  ss = algEntry.alg->sysStop();
117  if ( ss.isFailure() ) {
118  error() << "Unable to stop Algorithm: " << algEntry.alg->name() << endmsg;
119  return ss;
120  }
121  }
122  return ss;
123 }
std::vector< AlgEntry > m_cfnodes
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode stop() override
Definition: Service.cpp:123
bool isSuccess() const
Definition: StatusCode.h:267
std::vector< AlgEntry > m_algorithms
bool isFailure() const
Definition: StatusCode.h:130
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

Member Data Documentation

◆ m_algorithms

std::vector<AlgEntry> HiveDataBrokerSvc::m_algorithms
private

Definition at line 45 of file HiveDataBroker.h.

◆ m_cfnodes

std::vector<AlgEntry> HiveDataBrokerSvc::m_cfnodes
mutableprivate

Definition at line 47 of file HiveDataBroker.h.

◆ m_dataLoader

Gaudi::Property<std::string> HiveDataBrokerSvc::m_dataLoader
private
Initial value:
{this, "DataLoader", "",
"Attribute any unmet input dependencies to this Algorithm"}

Definition at line 22 of file HiveDataBroker.h.

◆ m_dependencies

std::map<DataObjID, AlgEntry*> HiveDataBrokerSvc::m_dependencies
private

Definition at line 51 of file HiveDataBroker.h.

◆ m_producers

Gaudi::Property<std::vector<std::string> > HiveDataBrokerSvc::m_producers
private
Initial value:
{
this, "DataProducers", {}, "List of algorithms to be used to resolve data dependencies"}

Definition at line 24 of file HiveDataBroker.h.


The documentation for this class was generated from the following files: