319def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr'):
320
321 from AthenaCommon.Logging import log
322 log.setLevel(flags.Exec.OutputLevel)
323
324 if flags.Exec.Interactive == "run":
325 LoopMgr="PyAthenaEventLoopMgr"
326 log.info("Interactive mode, switching to %s", LoopMgr)
327 else:
328
329 if flags.Exec.MPI:
330
331 msg = "ERRONEOUS CONFIGURATION FOR MPI:\n"
332 OK = True
333 if flags.Concurrency.NumThreads < 1:
334 msg = f"{msg} - Concurrency.NumThreads = {flags.Concurrency.NumThreads}, must be >= 1\n"
335 OK = False
336 if flags.Concurrency.NumProcs > 0:
337 msg = f"{msg} - Concurrency.NumProcs = {flags.Concurrency.NumProcs}, must be 0\n"
338 OK = False
339 if not OK:
340 raise Exception(msg)
341
342 if flags.Concurrency.NumThreads > 0:
343 if flags.Concurrency.NumConcurrentEvents==0:
344 raise Exception("Requested Concurrency.NumThreads>0 and Concurrency.NumConcurrentEvents==0, "
345 "which will not process events!")
346 if flags.Exec.MTEventService:
347 LoopMgr = "AthenaMtesEventLoopMgr"
348 elif flags.Exec.MPI:
349 LoopMgr = "MPIHiveEventLoopMgr"
350 else:
351 LoopMgr = "AthenaHiveEventLoopMgr"
352
353 if flags.Concurrency.NumProcs > 0:
354 LoopMgr = "AthMpEvtLoopMgr"
355
356
357 cfg = MainServicesMiniCfg(flags, loopMgr=LoopMgr, masterSequence='AthMasterSeq')
358
359
360 addMainSequences(flags, cfg)
361
362
363 cfg.addService(CompFactory.ClassIDSvc(CLIDDBFiles = ['clid.db','Gaudi_clid.db']))
364
365 cfg.addService(CompFactory.AlgContextSvc(BypassIncidents=True))
366 cfg.addAuditor(CompFactory.AlgContextAuditor())
367
368 cfg.addService(CompFactory.StoreGateSvc(Dump=flags.Debug.DumpEvtStore))
369 cfg.addService(CompFactory.StoreGateSvc("DetectorStore",Dump=flags.Debug.DumpDetStore))
370 cfg.addService(CompFactory.StoreGateSvc("HistoryStore"))
371 cfg.addService(CompFactory.StoreGateSvc("ConditionStore",Dump=flags.Debug.DumpCondStore))
372
373 cfg.merge(MessageSvcCfg(flags))
374
375 from AthenaConfiguration.FPEAndCoreDumpConfig import FPEAndCoreDumpCfg
376 cfg.merge(FPEAndCoreDumpCfg(flags))
377
378
379
380
381 cfg.addService(CompFactory.ExceptionSvc(Catch="NONE"))
382
383
384
385
386
387 cfg.addService(CompFactory.AthEnvironmentSvc(), create=True)
388
389
390 cfg.setAppProperty('AuditAlgorithms', True)
391 cfg.setAppProperty('InitializationLoopCheck', False)
392 cfg.setAppProperty('EvtMax', flags.Exec.MaxEvents)
393 if flags.Exec.OutputLevel > INFO:
394
395 cfg.setAppProperty('AppName', '')
396 cfg.setAppProperty('OutputLevel', flags.Exec.OutputLevel)
397
398 if flags.Exec.DebugStage != "":
399 cfg.setDebugStage(flags.Exec.DebugStage)
400
401 cfg.interactive=flags.Exec.Interactive
402
403 if flags.Concurrency.NumProcs > 0:
404 cfg.merge(AthenaMpEventLoopMgrCfg(flags))
405
406
407 if flags.Exec.EventTimeOut > 0:
408 timeoutAlg = CompFactory.TimeoutAlg(
409 Timeout = flags.Exec.EventTimeOut,
410 AbortJob = True,
411 DumpSchedulerState = False)
412 cfg.addEventAlgo(timeoutAlg, sequenceName='AthBeginSeq')
413
414
415 if flags.Concurrency.NumThreads > 0:
416 if flags.Exec.MTEventService:
417 cfg.merge(AthenaMtesEventLoopMgrCfg(flags,True,flags.Exec.MTEventServiceChannel))
418 elif flags.Exec.MPI:
419 cfg.merge(MPIHiveEventLoopMgrCfg(flags))
420 else:
421 cfg.merge(AthenaHiveEventLoopMgrCfg(flags))
422
423 cfg.addAuditor( CompFactory.SGCommitAuditor() )
424 elif LoopMgr == 'AthenaEventLoopMgr':
425 cfg.merge(AthenaEventLoopMgrCfg(flags))
426
427
428 if flags.PerfMon.doFastMonMT or flags.PerfMon.doFullMonMT:
429 from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
430 cfg.merge(PerfMonMTSvcCfg(flags))
431
432 if flags.PerfMon.doGPerfProf:
433 from PerfMonGPerfTools.GPT_ProfilerServiceConfig import GPT_ProfilerServiceCfg
434 cfg.merge(GPT_ProfilerServiceCfg(flags))
435
436 if len(flags.PerfMon.Valgrind.ProfiledAlgs)>0:
437 from Valkyrie.ValkyrieConfig import ValgrindServiceCfg
438 cfg.merge(ValgrindServiceCfg(flags))
439
440 return cfg
441
442