7 import GaudiPython.Bindings
as PyGaudi
16 """ try to install seek-stuff on the EventSelector side.
17 if `silent` is True, only an attempt at installing the seeking is performed.
18 otherwise an exception is raised if the seeking could not be installed.
22 from AthenaCommon.Logging
import log
as msg
23 if 'AthenaPoolCnvSvc.ReadAthenaPool' not in sys.modules:
29 _msg(
"Cannot enable 'seeking' b/c module "
30 "[AthenaPoolCnvSvc.ReadAthenaPool] hasn't been imported..." )
31 _msg(
"Modify your jobOptions to import that module "+ \
32 "(or just ignore this message)" )
35 raise RuntimeError(
"configuration-logic error")
39 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
41 collectionType = svcMgr.EventSelector.properties()[
"CollectionType"]
43 if collectionType
in (
"ImplicitROOT", Configurable.propertyNoValue, ):
44 msg.info (
"=> Seeking enabled." )
47 msg.warning(
"Input seeking is not compatible with collection type of %s",
48 svcMgr.EventSelector.properties()[
"CollectionType"] )
49 msg.warning(
"=> Seeking disabled." )
51 raise RuntimeError(
"could not install seeking")
53 from AthenaCommon.AppMgr
import theApp
54 if theApp.state() != theApp.State.OFFLINE:
56 svcMgr.EventSelector.setup()
60 from AthenaConfiguration.ComponentFactory
import isComponentAccumulatorCfg
67 del _setupEvtSelForSeekOps
75 PyGaudi.iService.__init__( self,
'PyAthenaEventLoopMgr' )
100 self.__dict__[
'_evtSeek' ] = cppyy.bind_object( cppself, cppyy.gbl.IEventSeek )
103 self.__dict__[
'_isvc' ] = PyGaudi.InterfaceCast( cppyy.gbl.IService )( self._evtSeek )
104 self.__dict__[
'_ip' ] = PyGaudi.InterfaceCast( cppyy.gbl.IProperty )( self._evtSeek )
107 self.__dict__[
'_state' ] = PyGaudi.InterfaceCast( cppyy.gbl.IStateful )( self._evtSeek )
108 self.__dict__[
'_evtpro' ] = PyGaudi.InterfaceCast( cppyy.gbl.IEventProcessor )( self._evtSeek )
112 for obj
in [ self._evtSeek, self._state, self._evtpro ]:
114 return getattr( obj, attr )
119 return super( PyAthenaEventLoopMgr, self ).
__getattr__( attr )
123 from AthenaPython.PyAthena
import py_svc
124 from AthenaPython.PyAthenaComps
import StatusCode
125 appmgr =
py_svc(
'ApplicationMgr',iface=
"IProperty")
126 algmgr =
py_svc(
'ApplicationMgr',iface=
'IAlgManager')
129 ctx = cppyy.bind_object(cppcontext,
"EventContext")
132 for name
in appmgr.getProperty(
"TopAlg").
value():
133 ialg=algmgr.algorithm(name).
get()
134 ialg.execState(ctx).
reset()
135 result = ialg.sysExecute(ctx)
136 if result.isFailure():
137 from AthenaCommon.Logging
import log
as msg
138 msg.error(
"Execution of algorithm %s failed", name )
139 return result.getCode()
140 except KeyboardInterrupt:
141 from AthenaCommon.Logging
import log
as msg
142 msg.critical(
"event loop stopped by user interrupt" )
143 return StatusCode.Failure
145 return StatusCode.Success