diff --git a/FWCore/Framework/interface/EDConsumerBase.h b/FWCore/Framework/interface/EDConsumerBase.h index 843aae23ee95d..5ab4ee348cda2 100644 --- a/FWCore/Framework/interface/EDConsumerBase.h +++ b/FWCore/Framework/interface/EDConsumerBase.h @@ -234,9 +234,6 @@ namespace edm { return ESGetTokenGeneric(static_cast(Tr), index, iRecord.type()); } - //used for FinalPath - void resetItemsToGetFrom(BranchType iType) { itemsToGetFromBranch_[iType].clear(); } - private: virtual void extendUpdateLookup(BranchType iBranchType, ProductResolverIndexHelper const&); virtual void registerLateConsumes(eventsetup::ESRecordsToProductResolverIndices const&) {} diff --git a/FWCore/Framework/interface/OutputModuleCore.h b/FWCore/Framework/interface/OutputModuleCore.h index ffc22168f4c9e..48d04b56386ba 100644 --- a/FWCore/Framework/interface/OutputModuleCore.h +++ b/FWCore/Framework/interface/OutputModuleCore.h @@ -180,8 +180,6 @@ namespace edm { bool wantAllEvents_; std::vector selectors_; ParameterSet selectEvents_; - std::vector tokensForEndPaths_; //needed for FinalPath - bool onFinalPath_ = false; // ID of the ParameterSet that configured the event selector // subsystem. ParameterSetID selector_config_id_; diff --git a/FWCore/Framework/src/OutputModuleCore.cc b/FWCore/Framework/src/OutputModuleCore.cc index 014da9f27f9cd..4843591063d37 100644 --- a/FWCore/Framework/src/OutputModuleCore.cc +++ b/FWCore/Framework/src/OutputModuleCore.cc @@ -77,25 +77,6 @@ namespace edm { selectors_.resize(1); wantAllEvents_ = detail::configureEventSelector( selectEvents_, process_name_, getAllTriggerNames(), selectors_[0], consumesCollector()); - - //Check if on final path - if (pset.exists("@onFinalPath")) { - onFinalPath_ = pset.getUntrackedParameter("@onFinalPath"); - } - if (onFinalPath_) { - wantAllEvents_ = false; - if (not getAllTriggerNames().empty() and selectors_.front().numberOfTokens() == 0) { - //need to wait for trigger paths to finish - tokensForEndPaths_.push_back(consumes(edm::InputTag("TriggerResults", "", process_name_))); - } - //need to wait for EndPaths to finish - for (auto const& n : tns->getEndPaths()) { - if (n == "@finalPath") { - continue; - } - tokensForEndPaths_.push_back(consumes(edm::InputTag(n, "", process_name_))); - } - } } void OutputModuleCore::configure(OutputModuleDescription const& desc) { @@ -249,13 +230,7 @@ namespace edm { void OutputModuleCore::preallocLumis(unsigned int) {} - void OutputModuleCore::doBeginJob_() { - this->beginJob(); - if (onFinalPath_) { - //this stops prefetching of the data products - resetItemsToGetFrom(edm::InEvent); - } - } + void OutputModuleCore::doBeginJob_() { this->beginJob(); } void OutputModuleCore::doEndJob() { endJob(); } @@ -273,14 +248,11 @@ namespace edm { std::vector returnValue; auto const& s = selectors_[0]; auto const n = s.numberOfTokens(); - returnValue.reserve(n + tokensForEndPaths_.size()); + returnValue.reserve(n); for (unsigned int i = 0; i < n; ++i) { returnValue.emplace_back(uncheckedIndexFrom(s.token(i))); } - for (auto token : tokensForEndPaths_) { - returnValue.emplace_back(uncheckedIndexFrom(token)); - } return returnValue; } @@ -400,7 +372,6 @@ namespace edm { std::vector const& defaultOutputCommands) { ProductSelectorRules::fillDescription(desc, "outputCommands", defaultOutputCommands); EventSelector::fillDescription(desc); - desc.addOptionalNode(ParameterDescription("@onFinalPath", false, false), false); } void OutputModuleCore::prevalidate(ConfigurationDescriptions&) {} diff --git a/FWCore/Framework/src/Schedule.cc b/FWCore/Framework/src/Schedule.cc index a442455db3f4d..eb0ec9398ead7 100644 --- a/FWCore/Framework/src/Schedule.cc +++ b/FWCore/Framework/src/Schedule.cc @@ -515,7 +515,6 @@ namespace edm { std::string("PathStatusInserter")); if (endPathNames_->size() > 1) { - //NOTE: FinalPaths are a type of EndPath makePathStatusInserters(endPathStatusInserters_, *endPathNames_, prealloc, diff --git a/FWCore/Integration/test/BuildFile.xml b/FWCore/Integration/test/BuildFile.xml index 2be611c092a66..7abb1a2c2d89a 100644 --- a/FWCore/Integration/test/BuildFile.xml +++ b/FWCore/Integration/test/BuildFile.xml @@ -220,8 +220,6 @@ - - diff --git a/FWCore/Integration/test/test_finalpath.sh b/FWCore/Integration/test/test_finalpath.sh deleted file mode 100755 index 2b3c9dd1b7c22..0000000000000 --- a/FWCore/Integration/test/test_finalpath.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -LOCAL_TEST_DIR=${SCRAM_TEST_PATH} - -# Pass in name and status -function die { echo $1: status $2 ; echo === Log file === ; cat ${3:-/dev/null} ; echo === End log file === ; exit $2; } - -cat < finalpath_expected_empty.log -EOF - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py >& finalpath.log || die "failed test_finalpath_cfg.py" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_empty.log - || die "differences for test_finalpath_cfg.py" $? - - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --schedule >& finalpath.log || die "failed test_finalpath_cfg.py --schedule" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_empty.log - || die "differences for test_finalpath_cfg.py" $? - - -cat < finalpath_expected_not_found.log -did not find thing '' TEST -did not find thing '' TEST -did not find thing '' TEST -found thing 'beginLumi' TEST -found thing 'endLumi' TEST -found thing 'beginRun' TEST -found thing 'endRun' TEST -EOF -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --schedule --task >& finalpath.log || die "failed test_finalpath_cfg.py --schedule --task" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_not_found.log - || die "differences for test_finalpath_cfg.py --schedule --task" $? - - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --endpath >& finalpath.log || die "failed test_finalpath_cfg.py --endpath" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_empty.log - || die "differences for test_finalpath_cfg.py --endpath" $? - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --schedule --endpath >& finalpath.log || die "failed test_finalpath_cfg.py --schedule --endpath" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_empty.log - || die "differences for test_finalpath_cfg.py --schedule --endpath" $? - - -cat < finalpath_expected_found.log -found thing '' TEST -found thing '' TEST -found thing '' TEST -found thing 'beginLumi' TEST -found thing 'endLumi' TEST -found thing 'beginRun' TEST -found thing 'endRun' TEST -EOF -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --endpath --task >& finalpath.log || die "failed test_finalpath_cfg.py --endpath --task" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_found.log - || die "differences for test_finalpath_cfg.py --endpath --task" $? - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --endpath --task --schedule >& finalpath.log || die "failed test_finalpath_cfg.py --endpath --task --schedule" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_found.log - || die "differences for test_finalpath_cfg.py --endpath --task --schedule" $? - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --path --task >& finalpath.log || die "failed test_finalpath_cfg.py --path --task" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_found.log - || die "differences for test_finalpath_cfg.py --path --task" $? - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --path --task --schedule >& finalpath.log || die "failed test_finalpath_cfg.py --path --task --schedule" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_found.log - || die "differences for test_finalpath_cfg.py --path --task --schedule" $? - - -cat < finalpath_expected_filter.log -did not find thing '' TEST -found thing '' TEST -did not find thing '' TEST -found thing 'beginLumi' TEST -found thing 'endLumi' TEST -found thing 'beginRun' TEST -found thing 'endRun' TEST -EOF - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --path --filter >& finalpath.log || die "failed test_finalpath_cfg.py --path --filter" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_filter.log - || die "differences for test_finalpath_cfg.py --path --filter" $? - - -cmsRun ${LOCAL_TEST_DIR}/test_finalpath_cfg.py --path --filter --task >& finalpath.log || die "failed test_finalpath_cfg.py --path --filter --task" $? -grep "thing '.*' TEST" finalpath.log | diff finalpath_expected_filter.log - || die "differences for test_finalpath_cfg.py --path --filter --task" $? diff --git a/FWCore/Integration/test/test_finalpath_cfg.py b/FWCore/Integration/test/test_finalpath_cfg.py deleted file mode 100644 index cd1f4f5ad7320..0000000000000 --- a/FWCore/Integration/test/test_finalpath_cfg.py +++ /dev/null @@ -1,65 +0,0 @@ -import FWCore.ParameterSet.Config as cms -import argparse -import sys - -parser = argparse.ArgumentParser(prog=sys.argv[0], description='Test FinalPath.') - -parser.add_argument("--schedule", help="use cms.Schedule", action="store_true") -parser.add_argument("--task", help="put EDProducer into a task", action="store_true") -parser.add_argument("--path", help="put a consumer of the product onto a Path", action="store_true") -parser.add_argument("--endpath", help="put a consumer of the product onto an EndPath", action="store_true") -parser.add_argument("--filter", action="store_true") -parser.add_argument("--tracer", help="add Tracer service", action="store_true") - -print(sys.argv) -args = parser.parse_args() - -process = cms.Process("TEST") - -process.MessageLogger.cerr.INFO.limit = 10000 - -process.source = cms.Source("EmptySource") - -process.maxEvents.input = 3 - -process.thing = cms.EDProducer("ThingProducer") - -scheduledPaths =[] -if args.path: - print("adding Path") - process.otherThing = cms.EDProducer("OtherThingProducer", thingTag = cms.InputTag("thing")) - p = cms.Path() - if args.filter: - process.fltr = cms.EDFilter("Prescaler", prescaleFactor = cms.int32(2), prescaleOffset=cms.int32(0)) - p += process.fltr - if not args.task: - p += process.thing - p += process.otherThing - process.p = p - scheduledPaths.append(process.p) - if args.task: - process.p.associate(cms.Task(process.thing)) - -if args.endpath: - print("adding EndPath") - process.out2 = cms.OutputModule("AsciiOutputModule",outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*")) - process.o = cms.EndPath(process.out2) - scheduledPaths.append(process.o) - if args.task: - process.o.associate(cms.Task(process.thing)) - -process.out = cms.OutputModule("GetProductCheckerOutputModule", verbose= cms.untracked.bool(True), outputCommands = cms.untracked.vstring("drop *", "keep *_thing_*_*")) -process.f = cms.FinalPath(process.out) - -if args.schedule: - print("adding Schedule") - scheduledPaths.append(process.f) - process.schedule = cms.Schedule(*scheduledPaths) - if args.task: - process.schedule.associate(cms.Task(process.thing)) - -if args.tracer: - process.add_(cms.Service("Tracer")) - -process.options.numberOfThreads=3 -process.options.numberOfStreams=1 diff --git a/FWCore/ParameterSet/python/Config.py b/FWCore/ParameterSet/python/Config.py index e87e8ba4433a1..7a3e347b9d06b 100644 --- a/FWCore/ParameterSet/python/Config.py +++ b/FWCore/ParameterSet/python/Config.py @@ -16,7 +16,7 @@ from .Modules import _Module from .SequenceTypes import * from .SequenceTypes import _ModuleSequenceType, _Sequenceable #extend needs it -from .SequenceVisitors import PathValidator, EndPathValidator, FinalPathValidator, ScheduleTaskValidator, NodeVisitor, CompositeVisitor, ModuleNamesFromGlobalsVisitor +from .SequenceVisitors import PathValidator, EndPathValidator, ScheduleTaskValidator, NodeVisitor, CompositeVisitor, ModuleNamesFromGlobalsVisitor from .MessageLogger import MessageLogger from . import DictTypes @@ -131,7 +131,6 @@ def __init__(self,name: str, *Mods): self.__dict__['_Process__outputmodules'] = {} self.__dict__['_Process__paths'] = DictTypes.SortedKeysDict() # have to keep the order self.__dict__['_Process__endpaths'] = DictTypes.SortedKeysDict() # of definition - self.__dict__['_Process__finalpaths'] = DictTypes.SortedKeysDict() # of definition self.__dict__['_Process__sequences'] = {} self.__dict__['_Process__tasks'] = {} self.__dict__['_Process__conditionaltasks'] = {} @@ -314,10 +313,6 @@ def endpaths_(self): """returns a dict of the endpaths that have been added to the Process""" return DictTypes.SortedAndFixedKeysDict(self.__endpaths) endpaths = property(endpaths_,doc="dictionary containing the endpaths for the process") - def finalpaths_(self): - """returns a dict of the finalpaths that have been added to the Process""" - return DictTypes.SortedAndFixedKeysDict(self.__finalpaths) - finalpaths = property(finalpaths_,doc="dictionary containing the finalpaths for the process") def sequences_(self): """returns a dict of the sequences that have been added to the Process""" return DictTypes.FixedKeysDict(self.__sequences) @@ -520,9 +515,6 @@ def __setattr__(self,name:str,value): s = self.__findFirstUsingModule(self.endpaths,oldValue) if s is not None: raise ValueError(msg1+"endpath "+s.label_()+msg2) - s = self.__findFirstUsingModule(self.finalpaths,oldValue) - if s is not None: - raise ValueError(msg1+"finalpath "+s.label_()+msg2) # In case of EDAlias, raise Exception always to avoid surprises if isinstance(newValue, EDAlias): @@ -549,9 +541,6 @@ def __setattr__(self,name:str,value): s = self.__findFirstUsingModule(self.endpaths,oldValue) if s is not None: raise ValueError(msg1+"endpath "+s.label_()+msg2) - s = self.__findFirstUsingModule(self.finalpaths,oldValue) - if s is not None: - raise ValueError(msg1+"finalpath "+s.label_()+msg2) if not self.__InExtendCall and (Schedule._itemIsValid(newValue) or isinstance(newValue, Task)): self._replaceInScheduleDirectly(name, newValue) @@ -702,13 +691,6 @@ def _placeEndPath(self,name:str,mod): except ModuleCloneError as msg: context = format_outerframe(4) raise Exception("%sThe module %s in endpath %s is unknown to the process %s." %(context, msg, name, self._Process__name)) - def _placeFinalPath(self,name:str,mod): - self._validateSequence(mod, name) - try: - self._place(name, mod, self.__finalpaths) - except ModuleCloneError as msg: - context = format_outerframe(4) - raise Exception("%sThe module %s in finalpath %s is unknown to the process %s." %(context, msg, name, self._Process__name)) def _placeSequence(self,name:str,mod): self._validateSequence(mod, name) self._place(name, mod, self.__sequences) @@ -874,9 +856,6 @@ def dumpConfig(self, options:PrintOptions=PrintOptions()) -> str: config+=self._dumpConfigNamedList(self.endpaths_().items(), 'endpath', options) - config+=self._dumpConfigNamedList(self.finalpaths_().items(), - 'finalpath', - options) config+=self._dumpConfigUnnamedList(self.services_().items(), 'service', options) @@ -1081,7 +1060,6 @@ def dumpPython(self, options=PrintOptions()) -> str: result+=self._dumpPythonList(self._itemsInDependencyOrder(self.sequences), options) result+=self._dumpPythonList(self.paths_(), options) result+=self._dumpPythonList(self.endpaths_(), options) - result+=self._dumpPythonList(self.finalpaths_(), options) result+=self._dumpPythonList(self.aliases_(), options) if not self.schedule_() == None: result += 'process.schedule = ' + self.schedule.dumpPython(options) @@ -1128,7 +1106,6 @@ def splitPython(self, options:PrintOptions = PrintOptions()) -> dict: parts.update(self._splitPythonList('sequences', self._itemsInDependencyOrder(self.sequences), options)) parts.update(self._splitPythonList('paths', self.paths_(), options)) parts.update(self._splitPythonList('paths', self.endpaths_(), options)) - parts.update(self._splitPythonList('paths', self.finalpaths_(), options)) parts.update(self._splitPythonList('modules', self.aliases_(), options)) if options.targetDirectory is not None: @@ -1177,8 +1154,6 @@ def _replaceInSequences(self, label:str, new): sequenceable.replace(old,new) for sequenceable in self.endpaths.values(): sequenceable.replace(old,new) - for sequenceable in self.finalpaths.values(): - sequenceable.replace(old,new) def _replaceInTasks(self, label:str, new): old = getattr(self,label) for task in self.tasks.values(): @@ -1249,7 +1224,6 @@ def _insertPaths(self, processPSet, nodeVisitor): scheduledPaths = [] triggerPaths = [] endpaths = [] - finalpaths = [] if self.schedule_() == None: # make one from triggerpaths & endpaths for name in self.paths_(): @@ -1258,45 +1232,19 @@ def _insertPaths(self, processPSet, nodeVisitor): for name in self.endpaths_(): scheduledPaths.append(name) endpaths.append(name) - for name in self.finalpaths_(): - finalpaths.append(name) else: for path in self.schedule_(): pathname = path.label_() + scheduledPaths.append(pathname) if pathname in self.endpaths_(): endpaths.append(pathname) - scheduledPaths.append(pathname) - elif pathname in self.finalpaths_(): - finalpaths.append(pathname) else: - scheduledPaths.append(pathname) triggerPaths.append(pathname) for task in self.schedule_()._tasks: task.resolve(self.__dict__) scheduleTaskValidator = ScheduleTaskValidator() task.visit(scheduleTaskValidator) task.visit(nodeVisitor) - # consolidate all final_paths into one EndPath - endPathWithFinalPathModulesName ="@finalPath" - finalPathEndPath = EndPath() - if finalpaths: - endpaths.append(endPathWithFinalPathModulesName) - scheduledPaths.append(endPathWithFinalPathModulesName) - finalpathValidator = FinalPathValidator() - modulesOnFinalPath = [] - for finalpathname in finalpaths: - iFinalPath = self.finalpaths_()[finalpathname] - iFinalPath.resolve(self.__dict__) - finalpathValidator.setLabel(finalpathname) - iFinalPath.visit(finalpathValidator) - invalidModules = finalpathValidator.invalidModulesOnFinalpaths - if invalidModules: - raise RuntimeError("FinalPath %s has non OutputModules %s" % (finalpathname, ",".join(invalidModules))) - modulesOnFinalPath.extend(iFinalPath.moduleNames()) - for m in modulesOnFinalPath: - mod = getattr(self, m) - setattr(mod, "@onFinalPath", untracked.bool(True)) - finalPathEndPath += mod processPSet.addVString(True, "@end_paths", endpaths) processPSet.addVString(True, "@paths", scheduledPaths) @@ -1328,10 +1276,7 @@ def _insertPaths(self, processPSet, nodeVisitor): decoratedList.append("@") iPath.insertInto(processPSet, triggername, decoratedList[:]) for endpathname in endpaths: - if endpathname is not endPathWithFinalPathModulesName: - iEndPath = self.endpaths_()[endpathname] - else: - iEndPath = finalPathEndPath + iEndPath = self.endpaths_()[endpathname] iEndPath.resolve(self.__dict__) endpathValidator.setLabel(endpathname) lister.initialize() @@ -1345,8 +1290,6 @@ def resolve(self,keepUnresolvedSequencePlaceholders:bool=False): x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders) for x in self.endpaths.values(): x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders) - for x in self.finalpaths.values(): - x.resolve(self.__dict__,keepUnresolvedSequencePlaceholders) if not self.schedule_() == None: for task in self.schedule_()._tasks: task.resolve(self.__dict__,keepUnresolvedSequencePlaceholders) @@ -1375,7 +1318,6 @@ def prune(self,verbose=False,keepUnresolvedSequencePlaceholders:bool=False): schedNames = set(( x.label_() for x in self.schedule_())) names = set(self.paths) names.update(set(self.endpaths)) - names.update(set(self.finalpaths)) unneededPaths = names - schedNames for n in unneededPaths: delattr(self,n) @@ -1386,7 +1328,6 @@ def prune(self,verbose=False,keepUnresolvedSequencePlaceholders:bool=False): else: pths = list(self.paths.values()) pths.extend(self.endpaths.values()) - pths.extend(self.finalpaths.values()) temp = Schedule(*pths) usedModules=set(temp.moduleNames()) unneededModules = self._pruneModules(self.producers_(), usedModules) @@ -1402,9 +1343,6 @@ def prune(self,verbose=False,keepUnresolvedSequencePlaceholders:bool=False): for p in self.endpaths.values(): p.visit(sv) p.visit(tv) - for p in self.finalpaths.values(): - p.visit(sv) - p.visit(tv) def removeUnneeded(seqOrTasks, allSequencesOrTasks): _keepSet = set(( s for s in seqOrTasks if s.hasLabel_())) _availableSet = set(allSequencesOrTasks.values()) @@ -1421,7 +1359,7 @@ def removeUnneeded(seqOrTasks, allSequencesOrTasks): print(" modules:"+",".join(unneededModules)) print(" tasks:"+",".join(unneededTaskLabels)) print(" sequences:"+",".join(unneededSeqLabels)) - print(" paths/endpaths/finalpaths:"+",".join(unneededPaths)) + print(" paths/endpaths:"+",".join(unneededPaths)) def _pruneModules(self, d, scheduledNames): moduleNames = set(d.keys()) junk = moduleNames - scheduledNames @@ -3316,65 +3254,6 @@ def testPath(self): t = Path(p.a, p.t1, Task(), p.t1) self.assertEqual(t.dumpPython(PrintOptions()), 'cms.Path(process.a, cms.Task(), process.t1)\n') - def testFinalPath(self): - p = Process("test") - p.a = OutputModule("MyOutputModule") - p.b = OutputModule("YourOutputModule") - p.c = OutputModule("OurOutputModule") - path = FinalPath(p.a) - path *= p.b - path += p.c - self.assertEqual(str(path),'a+b+c') - path = FinalPath(p.a*p.b+p.c) - self.assertEqual(str(path),'a+b+c') - path = FinalPath(p.a+ p.b*p.c) - self.assertEqual(str(path),'a+b+c') - path = FinalPath(p.a*(p.b+p.c)) - self.assertEqual(str(path),'a+b+c') - p.es = ESProducer("AnESProducer") - self.assertRaises(TypeError,FinalPath, p.es) - - t = FinalPath() - self.assertEqual(t.dumpPython(PrintOptions()), 'cms.FinalPath()\n') - - t = FinalPath(p.a) - self.assertEqual(t.dumpPython(PrintOptions()), 'cms.FinalPath(process.a)\n') - - self.assertRaises(TypeError, FinalPath, Task()) - self.assertRaises(TypeError, FinalPath, p.a, Task()) - - p.prod = EDProducer("prodName") - p.t1 = Task(p.prod) - self.assertRaises(TypeError, FinalPath, p.a, p.t1, Task(), p.t1) - - p.prod = EDProducer("prodName") - p.t1 = ConditionalTask(p.prod) - self.assertRaises(TypeError, FinalPath, p.a, p.t1, ConditionalTask(), p.t1) - - p.t = FinalPath(p.a) - p.a = OutputModule("ReplacedOutputModule") - self.assertEqual(p.t.dumpPython(PrintOptions()), 'cms.FinalPath(process.a)\n') - - p.anal = EDAnalyzer("MyAnalyzer") - p.t = FinalPath(p.anal) - pset = TestMakePSet() - self.assertRaises(RuntimeError, p.fillProcessDesc, pset) - - p.prod = EDProducer("MyProducer") - p.t = FinalPath(p.prod) - pset = TestMakePSet() - self.assertRaises(RuntimeError, p.fillProcessDesc, pset) - - p.filt = EDFilter("MyFilter") - p.t = FinalPath(p.filt) - pset = TestMakePSet() - self.assertRaises(RuntimeError, p.fillProcessDesc, pset) - - p.outp = OutputModule("MyOutputModule") - p.t = FinalPath(p.outp) - pset = TestMakePSet() - p.fillProcessDesc(pset) - def testCloneSequence(self): p = Process("test") a = EDAnalyzer("MyAnalyzer") diff --git a/FWCore/ParameterSet/python/SequenceTypes.py b/FWCore/ParameterSet/python/SequenceTypes.py index 07bf14f45f1de..ce61981c1a62b 100644 --- a/FWCore/ParameterSet/python/SequenceTypes.py +++ b/FWCore/ParameterSet/python/SequenceTypes.py @@ -660,14 +660,6 @@ def __init__(self,*arg,**argv): def _placeImpl(self,name:str,proc): proc._placeEndPath(name,self) -class FinalPath(_ModuleSequenceType): - def __init__(self,*arg,**argv): - super(FinalPath,self).__init__(*arg,**argv) - def _placeImpl(self,name:str,proc): - proc._placeFinalPath(name,self) - def associate(self,task): - raise TypeError("FinalPath does not allow associations with Tasks") - class Sequence(_ModuleSequenceType,_Sequenceable): def __init__(self,*arg,**argv): super(Sequence,self).__init__(*arg,**argv) @@ -763,7 +755,7 @@ def associate(self,*tasks): self._tasks.add(task) @staticmethod def _itemIsValid(item) -> bool: - return isinstance(item,Path) or isinstance(item,EndPath) or isinstance(item,FinalPath) + return isinstance(item,Path) or isinstance(item,EndPath) def copy(self): import copy aCopy = copy.copy(self) @@ -2350,14 +2342,6 @@ def testReplace(self): ct2.replace(m2,ct3) self.assertEqual(ct2.dumpPython(), "cms.ConditionalTask(process.m1, process.m3, process.m5)\n") - #FinalPath - fp = FinalPath() - fp.replace(m1,m2) - self.assertEqual(fp.dumpPython(), "cms.FinalPath()\n") - fp = FinalPath(m1) - fp.replace(m1,m2) - self.assertEqual(fp.dumpPython(), "cms.FinalPath(process.m2)\n") - def testReplaceIfHeldDirectly(self): m1 = DummyModule("m1") m2 = DummyModule("m2") @@ -2661,13 +2645,6 @@ def testRemove(self): self.assertEqual(t3.dumpPython(), "cms.ConditionalTask(process.m2)\n") t3.remove(m2) self.assertEqual(t3.dumpPython(), "cms.ConditionalTask()\n") - #FinalPath - fp = FinalPath(m1+m2) - fp.remove(m1) - self.assertEqual(fp.dumpPython(), "cms.FinalPath(process.m2)\n") - fp = FinalPath(m1) - fp.remove(m1) - self.assertEqual(fp.dumpPython(), "cms.FinalPath()\n") def testCopyAndExclude(self): a = DummyModule("a") diff --git a/FWCore/ParameterSet/python/SequenceVisitors.py b/FWCore/ParameterSet/python/SequenceVisitors.py index a9c642813e0d4..2e933a7a0df8d 100644 --- a/FWCore/ParameterSet/python/SequenceVisitors.py +++ b/FWCore/ParameterSet/python/SequenceVisitors.py @@ -66,33 +66,6 @@ def leave(self,visitee): if isinstance(visitee, Task): self._levelInTasks -= 1 -# Use this on EndPaths -class FinalPathValidator(object): - def __init__(self): - self.__label = '' - self._levelInTasks = 0 - self.invalidModulesOnFinalpaths = [] - def setLabel(self,label:str): - self.__label = "'"+label+"' " - def enter(self,visitee): - if visitee.isLeaf(): - if isinstance(visitee, _Labelable): - if not visitee.hasLabel_(): - raise ValueError("FinalPath "+self.__label+"contains a module of type '"+visitee.type_()+"' which has\nno assigned label.") - elif isinstance(visitee, Service): - if not visitee._inProcess: - raise ValueError("FinalPath "+self.__label+"contains a service of type '"+visitee.type_()+"' which is not attached to the process.\n") - if isinstance(visitee, Task): - self._levelInTasks += 1 - if self._levelInTasks > 0: - return - if isinstance(visitee,(EDAnalyzer,EDProducer,EDFilter)): - self.invalidModulesOnFinalpaths.append(visitee.type_()) - def leave(self,visitee): - if self._levelInTasks > 0: - if isinstance(visitee, Task): - self._levelInTasks -= 1 - class NodeVisitor(object): """Form sets of all modules, ESProducers, ESSources and Services in visited objects. Can be used to visit Paths, EndPaths, Sequences or Tasks. Includes in sets objects on sub-Sequences and sub-Tasks""" diff --git a/HLTrigger/Configuration/scripts/hltDumpStream b/HLTrigger/Configuration/scripts/hltDumpStream index 34a3b75d7a98d..025deee452615 100755 --- a/HLTrigger/Configuration/scripts/hltDumpStream +++ b/HLTrigger/Configuration/scripts/hltDumpStream @@ -89,8 +89,8 @@ def getStreamsInfoFromProcess(process, prescaleValues, numberOfPrescaleColumns): each stream dict contains the following entries (key: value) - name: name of the stream - - path: cms.EndPath/FinalPath associated to the stream - - prescales: list of prescale values (1 per PS column) applied to the EndPath/FinalPath associated to the stream + - path: cms.EndPath associated to the stream + - prescales: list of prescale values (1 per PS column) applied to the EndPath associated to the stream - smartPrescales: dictionary (path:ps) of smart-prescales applied at stream level - datasets: list of dataset dictionaries (see below) @@ -123,9 +123,9 @@ def getStreamsInfoFromProcess(process, prescaleValues, numberOfPrescaleColumns): raise RuntimeError('ERROR -- the process holds multiple partial schedules: '+str(process._Process__partialschedules)) # find list of streams: - # - stream XYZ exists if the configuration contains a EndPath/FinalPath that contains an OutputModule named hltOutputXYZ - # - if more than one such EndPath/FinalPath exists, it is an error (unsupported configuration) - # - if the configuration contains a cms.Schedule, the EndPath/FinalPath is required to be part of the cms.Schedule + # - stream XYZ exists if the configuration contains a EndPath that contains an OutputModule named hltOutputXYZ + # - if more than one such EndPath exists, it is an error (unsupported configuration) + # - if the configuration contains a cms.Schedule, the EndPath is required to be part of the cms.Schedule # - reliance on the PSet "streams" is minimised: # - the latter PSet, if present, should be a superset of the streams found in the configuration # (this is the case for HLT configs containing only a subset of the triggers of a menu, e.g. "hltGetConfiguration --paths [..]") @@ -141,27 +141,26 @@ def getStreamsInfoFromProcess(process, prescaleValues, numberOfPrescaleColumns): continue streamName = outModName[len('hltOutput'):] - # find EndPath/FinalPath containing stream OutputModule + # find EndPath containing stream OutputModule streamPath = None outputModule = process.outputModules_()[outModName] - for efPaths in [process.endpaths_().values(), process.finalpaths_().values()]: - for efPath in efPaths: - if procSchedule != None: - # skip EndPath/FinalPath if not included in the schedule - # (schedule.contains does not seem to be enough, so the index of the EndPath/FinalPath in the schedule is searched; - # if the EndPath/FinalPath is not in the schedule, this search leads to a runtime-error) - try: procSchedule.index(efPath) - except: continue - if efPath.contains(outputModule): - # if streamPath is already set, throw a runtime error: - # no more than one EndPath/FinalPath can hold a given OutputModule in valid HLT configurations - if streamPath != None: - errMsg = 'ERROR -- output module "'+outModName+'" is associated to' - errMsg += ' more than one EndPath/FinalPath: '+str([streamPath.label(), efPath.label()]) - raise RuntimeError(errMsg) - streamPath = efPath - - # OutputModule not included in any active EndPath/FinalPath + for efPath in process.endpaths_().values(): + if procSchedule != None: + # skip EndPath if not included in the schedule + # (schedule.contains does not seem to be enough, so the index of the EndPath in the schedule is searched; + # if the EndPath is not in the schedule, this search leads to a runtime-error) + try: procSchedule.index(efPath) + except: continue + if efPath.contains(outputModule): + # if streamPath is already set, throw a runtime error: + # no more than one EndPath can hold a given OutputModule in valid HLT configurations + if streamPath != None: + errMsg = 'ERROR -- output module "'+outModName+'" is associated to' + errMsg += ' more than one EndPath: '+str([streamPath.label(), efPath.label()]) + raise RuntimeError(errMsg) + streamPath = efPath + + # OutputModule not included in any active EndPath if streamPath == None: continue @@ -290,9 +289,8 @@ def getStreamsInfoFromProcess(process, prescaleValues, numberOfPrescaleColumns): # fill smart-PS applied at stream level # (in Run-2 HLT menus, smart-PSs are applied to standard Paths in the stream EndPath) - # (in Run-3 HLT menus, prescales at stream level have not been used yet, plus they cannot be applied inside FinalPaths) streamSmartPrescales = {} # dictionary of smart-PSs applied at stream level - smartPSModuleName = None # smart-PS module in the stream EndPath/FinalPath + smartPSModuleName = None # smart-PS module in the stream EndPath # build list of Paths that can have a smart-PS at stream level: # this includes the Paths of all datasets in the stream, and the DatasetPaths (if present) @@ -307,7 +305,7 @@ def getStreamsInfoFromProcess(process, prescaleValues, numberOfPrescaleColumns): for foo in pathNamesForStreamSmartPS: streamSmartPrescales[foo] = 1 - # loop on modules preceding the OutputModule in the EndPath/FinalPath + # loop on modules preceding the OutputModule in the EndPath # to extract smart prescales at stream level, requiring no more than one smart-PS module streamPathExpanded = streamPath.expandAndClone() for modIdx in range(streamPathExpanded.index(outputModule)): diff --git a/HLTrigger/Configuration/scripts/hltListPaths b/HLTrigger/Configuration/scripts/hltListPaths index 4f215948c2efc..f19e3dea057ec 100755 --- a/HLTrigger/Configuration/scripts/hltListPaths +++ b/HLTrigger/Configuration/scripts/hltListPaths @@ -37,7 +37,7 @@ def getPathList(args): if not isinstance(process, cms.Process): raise Exception(f'query did not return a valid HLT menu:\n query="{cmdline}"') - usePaths, useEndPaths, useFinalPaths = False, False, False + usePaths, useEndPaths = False, False # Paths only if args.selection == 'paths': @@ -47,17 +47,13 @@ def getPathList(args): elif args.selection == 'endpaths': useEndPaths = True - # FinalPaths only - elif args.selection == 'finalpaths': - useFinalPaths = True - - # Paths, EndPaths, and FinalPaths ('all') + # Paths and EndPaths ('all') elif args.selection == 'all': - usePaths, useEndPaths, useFinalPaths = True, True, True + usePaths, useEndPaths = True, True # invalid value else: - raise RuntimeError(f'ERROR: invalid value for option "--selection" (must be "paths", "endpaths", "finalpaths", or "all"): {args.selection}') + raise RuntimeError(f'ERROR: invalid value for option "--selection" (must be "paths", "endpaths", or "all"): {args.selection}') path_keep_rules = [] for path_keep_rule in args.path_keep_rules.split(','): @@ -72,7 +68,6 @@ def getPathList(args): for pathDict in [ process.paths_() if usePaths else None, process.endpaths_() if useEndPaths else None, - process.finalpaths_() if useFinalPaths else None, ]: if pathDict == None: continue @@ -145,7 +140,7 @@ def hltMenu(name): return name if os.path.isfile(name) else options.ConnectionHLTMenu(name) parser = argparse.ArgumentParser( - description = 'List all the Paths, EndPaths and FinalPaths of an HLT configuration.', + description = 'List all the Paths and EndPaths of an HLT configuration.', argument_default = argparse.SUPPRESS, formatter_class = formatter, add_help = False ) @@ -187,17 +182,12 @@ group.add_argument('-e', '--only-endpaths', action = 'store_const', const = 'endpaths', help = 'List only EndPaths' ) -group.add_argument('-f', '--only-finalpaths', - dest = 'selection', - action = 'store_const', - const = 'finalpaths', - help = 'List only FinalPaths' ) group.add_argument('-a', '--all', dest = 'selection', action = 'store_const', const = 'all', default = 'all', - help = 'List Paths, EndPaths and FinalPaths (default)' ) + help = 'List Paths and EndPaths (default)' ) parser.add_argument('--no-dependent-paths', dest = 'no_dependent_paths',