File indexing completed on 2026-04-10 08:39:06
0001 from pandaserver.taskbuffer import JobUtils
0002
0003 processGroups = [
0004 ("others", []),
0005 ("evgen", ["evgen"]),
0006 ("simul", ["simul"]),
0007 ("reprocessing", ["reprocessing"]),
0008 ("test", ["prod_test", "validation"] + JobUtils.list_ptest_prod_sources),
0009 ("mcore", ["mcore"]),
0010 ("group", ["group"]),
0011 ("deriv", ["deriv"]),
0012 ("pile", ["pile"]),
0013 ("merge", ["merge"]),
0014 ]
0015
0016
0017
0018
0019 maxDebugJobs = 3
0020
0021
0022 maxDebugProdJobs = 30
0023
0024
0025 maxDebugWgJobs = 10
0026
0027
0028 extensionLevel_1 = 1
0029
0030
0031
0032 def getProcessGroup(valGroup):
0033 tmpGroup = None
0034 for tmpKey, tmpList in processGroups:
0035
0036 if tmpGroup is None:
0037 tmpGroup = tmpKey
0038 continue
0039 if valGroup in tmpList:
0040 tmpGroup = tmpKey
0041 break
0042
0043 return tmpGroup
0044
0045
0046
0047 def converCPTforEPG(cloud, processingType, coreCount, workingGroup=None):
0048 if coreCount in [0, 1, None]:
0049
0050 if workingGroup is not None and workingGroup.startswith("GP_"):
0051 return cloud, "group"
0052 return cloud, processingType
0053 else:
0054
0055 return cloud, "mcore"
0056
0057
0058
0059 def countJobsPerGroup(valMap):
0060 ret = {}
0061
0062 for cloud in valMap:
0063 cloudVal = valMap[cloud]
0064
0065 ret.setdefault(cloud, {})
0066
0067 for site in cloudVal:
0068 siteVal = cloudVal[site]
0069
0070 ret[cloud].setdefault(site, {})
0071
0072 for pType in siteVal:
0073 typeVal = siteVal[pType]
0074
0075 tmpGroup = getProcessGroup(pType)
0076
0077 ret[cloud][site].setdefault(tmpGroup, {})
0078
0079 for jobStatus in typeVal:
0080 statVal = typeVal[jobStatus]
0081 ret[cloud][site][tmpGroup].setdefault(jobStatus, 0)
0082
0083 ret[cloud][site][tmpGroup][jobStatus] += statVal
0084
0085 return ret
0086
0087
0088
0089 def countJobsPerGroupForAnal(valMap):
0090 ret = {}
0091
0092 for site in valMap:
0093 siteVal = valMap[site]
0094
0095 ret.setdefault(site, {})
0096
0097 for pType in siteVal:
0098 typeVal = siteVal[pType]
0099
0100 tmpGroup = getProcessGroup(pType)
0101
0102 if tmpGroup not in ret[site]:
0103 ret[site][tmpGroup] = {}
0104
0105 for jobStatus in typeVal:
0106 statVal = typeVal[jobStatus]
0107 ret[site][tmpGroup].setdefault(jobStatus, 0)
0108
0109 ret[site][tmpGroup][jobStatus] += statVal
0110
0111 return ret