Skip to content

Commit

Permalink
followup of 957ed95: preserve order of paths in schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
missirol authored and silviodonato committed Nov 22, 2021
1 parent c5a8851 commit 0b031c0
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ def __init__(self, options, process = None, with_output = False, with_input = Fa
self.create_process()
self.define_Configs()
self.schedule = list()
self.scheduleIndexOfFirstHLTPath = None

# we are doing three things here:
# creating a process to catch errors
Expand Down Expand Up @@ -1574,9 +1575,10 @@ def prepare_HLT(self, sequence = None):
if self.process.schedule == None:
raise Exception('the HLT step did not attach a valid schedule to the process')

self.scheduleIndexOfFirstHLTPath = len(self.schedule)
[self.blacklist_paths.append(path) for path in self.process.schedule if isinstance(path,(cms.Path,cms.EndPath))]

#this is a fake, to be removed with fastim migration and HLT menu dump
# this is a fake, to be removed with fastim migration and HLT menu dump
if self._options.fast:
if not hasattr(self.process,'HLTEndSequence'):
self.executeAndRemember("process.HLTEndSequence = cms.Sequence( process.dummyModule )")
Expand Down Expand Up @@ -2247,16 +2249,24 @@ def prepare(self, doChecking = False):
pathNames = ['process.'+p.label_() for p in self.schedule]
if self.process.schedule == None:
self.process.schedule = cms.Schedule()
for item in self.schedule:
self.process.schedule.append(item)
result = 'process.schedule = cms.Schedule('+','.join(pathNames)+')\n'
else:
result = "# process.schedule imported from cff in HLTrigger.Configuration\n"
result += 'process.schedule.extend(['+','.join(pathNames)+'])\n'
if not isinstance(self.scheduleIndexOfFirstHLTPath, int):
raise Exception('the schedule was imported from a cff in HLTrigger.Configuration, but the final index of the first HLT path is undefined')

for item in self.schedule:
if not isinstance(item, cms.Schedule):
self.process.schedule.append(item)
else:
self.process.schedule.extend(item)
for index, item in enumerate(self.schedule):
if index < self.scheduleIndexOfFirstHLTPath:
self.process.schedule.insert(index, item)
else:
self.process.schedule.append(item)

result = "# process.schedule imported from cff in HLTrigger.Configuration\n"
for index, item in enumerate(pathNames[:self.scheduleIndexOfFirstHLTPath]):
result += 'process.schedule.insert('+str(index)+', '+item+')\n'
if self.scheduleIndexOfFirstHLTPath < len(pathNames):
result += 'process.schedule.extend(['+','.join(pathNames[self.scheduleIndexOfFirstHLTPath:])+'])\n'

self.pythonCfgCode += result

Expand Down

0 comments on commit 0b031c0

Please sign in to comment.