Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:48

0001 import FWCore.ParameterSet.Config as cms
0002 from FWCore.Modules.logErrorHarvester_cfi import logErrorHarvester
0003 
0004 def customiseLogErrorHarvesterUsingOutputCommands(process):
0005     logName = 'logErrorHarvester'
0006     if not hasattr(process,logName):
0007         return process
0008 
0009     modulesFromAllOutput = set()
0010     onlyOneOutput = (len(process.outputModules_()) == 1)
0011     for o in process.outputModules_().values():
0012         if not hasattr(o,"outputCommands"):
0013             continue
0014         modulesFromOutput = set()
0015         storesLogs = False
0016         if (not onlyOneOutput) and hasattr(o,"SelectEvents") and hasattr(o.SelectEvents,"SelectEvents") and o.SelectEvents.SelectEvents:
0017             #if the output module is skimming events, we do not want to force running of 
0018             # unscheduled modules
0019             continue
0020         for ln in o.outputCommands.value():
0021             if -1 != ln.find("keep"):
0022                 s = ln.split("_")
0023                 if len(s)>1:
0024                     if s[1].find("*")==-1:
0025                         if s[1] != logName:
0026                             modulesFromOutput.add(s[1])
0027                         else:
0028                             storesLogs = True
0029         if storesLogs:
0030             modulesFromAllOutput =modulesFromAllOutput.union(modulesFromOutput)
0031     if hasattr(process.logErrorHarvester,"includeModules"):
0032         #need to exclude items from includeModules which are not being stored
0033         includeMods = set(process.logErrorHarvester.includeModules)
0034         toExclude = includeMods.difference(modulesFromAllOutput)
0035         if hasattr(process.logErrorHarvester,"excludeModules"):
0036             toExclude = toExclude.union(set(process.logErrorHarvester.excludeModules.value()))
0037         process.logErrorHarvester.excludeModules = cms.untracked.vstring(sorted(toExclude))
0038     else:
0039         process.logErrorHarvester.includeModules = cms.untracked.vstring(sorted(modulesFromAllOutput))
0040     return process