2 import FWCore.ParameterSet.Config
as cms
3 import FWCore.ParameterSet.Modules
as mod
8 if isinstance(item,mod._Module):
10 elif isinstance(item,cms.Sequence):
19 if isinstance(o,mod._Module):
21 elif isinstance(o, cms.Sequence):
23 elif isinstance(o,sqt._Sequenceable):
28 allEndPathModules = []
29 for name
in process._Process__endpaths:
30 endpath = getattr(process,name)
33 allEndPathModules.extend(list)
34 allUsedOutputModules = []
35 for module
in allEndPathModules:
36 if isinstance(module, cms.OutputModule):
37 allUsedOutputModules.append(module)
38 return allUsedOutputModules
40 if __name__ ==
"__main__":
45 p.foo = cms.EDProducer(
"Foo")
52 p.foo = cms.OutputModule(
"Foo")
53 p.bar = cms.OutputModule(
"Bar")
54 p.unused = cms.OutputModule(
"Unused")
55 p.p = cms.EndPath(p.foo*p.bar)
57 print len(usedOutputs)
60 p.foo = cms.EDProducer(
"Foo")
61 p.bar = cms.EDProducer(
"Bar")
62 p.s = cms.Sequence(p.foo*p.bar)
63 p.fii = cms.EDProducer(
"Fii")
64 p.p = cms.Path(p.s*p.fii)
def extractUsedOutputs(process)
def _getModulesFromOp(op, list)
def getModulesFromSequence(sequence, list)