Skip to content

Commit

Permalink
Characterization and propagation of task type based on cmsDriver step…
Browse files Browse the repository at this point in the history
…s parameters
  • Loading branch information
khurtado committed Jul 28, 2023
1 parent 4e1d8fb commit 02a979d
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/python/WMCore/WMSpec/WMStep.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

from WMCore.WMSpec.ConfigSectionTree import ConfigSectionTree, TreeHelper
from WMCore.WMSpec.Steps.StepFactory import getStepTypeHelper

from WMCore.Cache import WMConfigCache as ConfigCache
import shlex

class WMStepHelper(TreeHelper):
"""
Expand Down Expand Up @@ -276,6 +277,42 @@ def getConfigInfo(self):
return cacheUrl, cacheDb, configId


def getStepTypeFromArg(self, stepsArg):
"""
_getStepType_
Get information about the step physics type, based on the
cmsDriver command line --steps argument
"""
if 'SIM' in stepsArg:
return SIM
else:
# Not implemented yet
return "Unknown"


def getStepType(self):
"""
_getStepType_
Get information about the step physics type
"""

url, dbName, docId = self.getConfigInfo()
cache = ConfigCache.ConfigCache(url, dbName)
cache.loadByID(docId)
myconf = cache.getConfig()
# command arguments are in line 4
cmd = myconf.split('\n')[4]
cmd = shlex.split(cmd)
try:
stepsArg = cmd[cmd.index("--step")+1]
except ValueError:
stepsArg = "Unknown"

return self.getStepTypeFromArg(stepsArg)


def listAnalysisFiles(self):
"""
_listAnalysisFiles_
Expand Down
37 changes: 37 additions & 0 deletions src/python/WMCore/WMSpec/WMTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,43 @@ def getConfigCacheIDs(self):
IDs.append(ID)
return IDs

def getStepTypes(self):
"""
_getStepTypes_
Get the type for all steps
"""
types = []
for stepName in self.listAllStepNames():
stepHelper = self.getStepHelper(stepName)
stepType = stepHelper.getStepType()
types.append(stepType)
return types

def setCMSTaskType(self):
"""
_setCMSType_
Set the CMS task type based on the steps parameter
for all steps.
We basically expand the standard "Production" taskType to
detail the process better.
From "Processing" to ["GENSIM", "GEN", "DIGI", "RECO", "DIGIRECO", "MINIAOD"]
CMStypes = ["DataProcessing", "GENSIM", "GEN", "DIGI", "RECO", "DIGIRECO", "MINIAOD",
"LogCollect", "Skim", "Merge", "Harvesting",
"Cleanup", "Repack", "Express"]
"""
cmsType = "Unknown"
if self.taskType() == "Processing":
cmsType = "DataProcessing"
elif self.taskType() == "Production":
stepTypes = self.getStepTypes()
cmsType = ",".join(stepTypes)
else:
cmsType = self.taskType()

return cmsType

def setProcessingVersion(self, procVer, parentProcessingVersion=0, stepChainMap=False):
"""
_setProcessingVersion_
Expand Down

0 comments on commit 02a979d

Please sign in to comment.