Skip to content

Commit

Permalink
add function to prevent GEN-SIM reuse for special workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kpedro88 authored and cvuosalo committed Nov 16, 2020
1 parent 5986c00 commit e6aa365
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion Configuration/PyReleaseValidation/python/relval_steps.py
Expand Up @@ -3471,7 +3471,10 @@ def gen2021HiMix(fragment,howMuch):
#however, there can be a conflict of beam spots but this is lost in the dataset name
#so please be careful
s=frag[:-4]+'_'+key
if 'FastSim' not in k and s+'INPUT' not in steps and s in baseDataSetReleaseBetter and defaultDataSets[key] != '': # exclude upgradeKeys without input dataset
# exclude upgradeKeys without input dataset, and special WFs that disable reuse
istep = step+preventReuseKeyword
if 'FastSim' not in k and s+'INPUT' not in steps and s in baseDataSetReleaseBetter and defaultDataSets[key] != '' and \
(istep not in upgradeStepDict or key not in upgradeStepDict[istep] or upgradeStepDict[istep][key] is not None):
steps[k+'INPUT']={'INPUT':InputInfo(dataSet='/RelVal'+info.dataset+'/%s/GEN-SIM'%(baseDataSetReleaseBetter[s],),location='STD')}
else:
for key in [key for year in upgradeKeys for key in upgradeKeys[year]]:
Expand Down
Expand Up @@ -83,10 +83,12 @@
# setupPU() and setupPU_() operate similarly -> called in relval_steps.py *after* merging PUDataSets w/ regular steps
# workflow() adds a concrete workflow to the list based on condition() -> called in relval_upgrade.py
# every special workflow gets its own derived class, which must then be added to the global dict upgradeWFs
preventReuseKeyword = 'NOREUSE'
class UpgradeWorkflow(object):
def __init__(self,steps,PU,suffix,offset):
self.steps = steps
self.PU = PU
self.allowReuse = True

# ensure all PU steps are in normal step list
for step in self.PU:
Expand All @@ -98,23 +100,27 @@ def __init__(self,steps,PU,suffix,offset):
self.offset = offset
if self.offset < 0.0 or self.offset > 1.0:
raise ValueError("Special workflow offset must be between 0.0 and 1.0")
def getStepName(self, step):
stepName = step + self.suffix
def getStepName(self, step, extra=""):
stepName = step + self.suffix + extra
return stepName
def getStepNamePU(self, step):
stepNamePU = step + 'PU' + self.suffix
def getStepNamePU(self, step, extra=""):
stepNamePU = step + 'PU' + self.suffix + extra
return stepNamePU
def init(self, stepDict):
for step in self.steps:
stepDict[self.getStepName(step)] = {}
if not self.allowReuse: stepDict[self.getStepName(step,preventReuseKeyword)] = {}
for step in self.PU:
stepDict[self.getStepNamePU(step)] = {}
if not self.allowReuse: stepDict[self.getStepNamePU(step,preventReuseKeyword)] = {}
def setup(self, stepDict, k, properties):
for step in self.steps:
self.setup_(step, self.getStepName(step), stepDict, k, properties)
if not self.allowReuse: self.preventReuse(self.getStepName(step,preventReuseKeyword), stepDict, k)
def setupPU(self, stepDict, k, properties):
for step in self.PU:
self.setupPU_(step, self.getStepNamePU(step), stepDict, k, properties)
if not self.allowReuse: self.preventReuse(self.getStepNamePU(step,preventReuseKeyword), stepDict, k)
def setup_(self, step, stepName, stepDict, k, properties):
pass
def setupPU_(self, step, stepName, stepDict, k, properties):
Expand All @@ -128,6 +134,9 @@ def workflow_(self, workflows, num, fragment, stepList, key):
workflows[num+self.offset] = [ fragmentTmp, stepList ]
def condition(self, fragment, stepList, key, hasHarvest):
return False
def preventReuse(self, stepName, stepDict, k):
if "Sim" in stepName:
stepDict[stepName][k] = None
upgradeWFs = OrderedDict()

class UpgradeWorkflow_baseline(UpgradeWorkflow):
Expand Down Expand Up @@ -872,6 +881,7 @@ def condition(self, fragment, stepList, key, hasHarvest):
suffix = '_DD4hep',
offset = 0.911,
)
upgradeWFs['DD4hep'].allowReuse = False

# check for duplicate offsets
offsets = [specialWF.offset for specialType,specialWF in six.iteritems(upgradeWFs)]
Expand Down

0 comments on commit e6aa365

Please sign in to comment.