1 from __future__
import print_function
3 import FWCore.ParameterSet.Config
as cms
4 import FWCore.ParameterSet.Modules
as mod
9 if isinstance(item,mod._Module):
11 elif isinstance(item,cms.Sequence):
20 if isinstance(o,mod._Module):
22 elif isinstance(o, cms.Sequence):
24 elif isinstance(o,sqt._Sequenceable):
29 allEndPathModules = []
30 for name
in process._Process__endpaths:
31 endpath = getattr(process,name)
34 allEndPathModules.extend(list)
35 allUsedOutputModules = []
36 for module
in allEndPathModules:
37 if isinstance(module, cms.OutputModule):
38 allUsedOutputModules.append(module)
39 return allUsedOutputModules
41 if __name__ ==
"__main__":
46 p.foo = cms.EDProducer(
"Foo")
53 p.foo = cms.OutputModule(
"Foo")
54 p.bar = cms.OutputModule(
"Bar")
55 p.unused = cms.OutputModule(
"Unused")
56 p.p = cms.EndPath(p.foo*p.bar)
58 print(len(usedOutputs))
61 p.foo = cms.EDProducer(
"Foo")
62 p.bar = cms.EDProducer(
"Bar")
63 p.s = cms.Sequence(p.foo*p.bar)
64 p.fii = cms.EDProducer(
"Fii")
65 p.p = cms.Path(p.s*p.fii)