-
Notifications
You must be signed in to change notification settings - Fork 245
/
RelValArgs.py
executable file
·165 lines (151 loc) · 4.96 KB
/
RelValArgs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env python
from __future__ import print_function
import re
from os import environ, uname
from os.path import dirname, abspath
from _py2with3compatibility import run_cmd
monitor_script = ""
if "CMS_DISABLE_MONITORING" not in environ:
monitor_script = dirname(abspath(__file__)) + "/monitor_workflow.py"
e, o = run_cmd("python2 -c 'import psutil'")
if e:
e, o = run_cmd("python3 -c 'import psutil'")
if e:
print("Monitoring of relval steps disabled: import psutils failed")
monitor_script = ""
else:
monitor_script = "python3 " + monitor_script
else:
monitor_script = "python2 " + monitor_script
RELVAL_KEYS = {
"customiseWithTimeMemorySummary": [],
"enableIMT": [],
"PREFIX": [],
"USER_OVERRIDE_OPTS": [],
"USER_OVERRIDE_COMMAND_OPTS": [],
"JOB_REPORT": [],
"USE_INPUT": [],
"THREADED": [],
"WORKFLOWS": [],
"TIMEOUT": [],
}
THREADED_ROOT = "NON_THREADED_CMSSW"
THREADED_IBS = "NON_THREADED_CMSSW"
if not "CMSSW_NON_THREADED" in environ:
THREADED_ROOT = "CMSSW_9_[1-9]_ROOT6_X_.+"
THREADED_IBS = "CMSSW_(8_[1-9][0-9]*|(9|[1-9][0-9]+)_[0-9]+)_.+:([a-z]+)([6-9]|[1-9][0-9]+)_[^_]+_gcc(5[3-9]|[6-9]|[1-9][0-9])[0-9]*"
RELVAL_KEYS["customiseWithTimeMemorySummary"].append(
[".+", "--customise Validation/Performance/TimeMemorySummary.customiseWithTimeMemorySummary"]
)
RELVAL_KEYS["PREFIX"].append(
["CMSSW_[1-7]_.+", "--prefix '%s timeout --signal SIGSEGV @TIMEOUT@ '" % monitor_script]
)
RELVAL_KEYS["PREFIX"].append(
["CMSSW_.+", "--prefix '%s timeout --signal SIGTERM @TIMEOUT@ '" % monitor_script]
)
RELVAL_KEYS["JOB_REPORT"].append([".+", "--job-reports"])
RELVAL_KEYS["USE_INPUT"].append([".+", "--useInput all"])
RELVAL_KEYS["THREADED"].append([THREADED_IBS, "-t 4"])
RELVAL_KEYS["WORKFLOWS"].append(
[
"_SLHCDEV_",
"-w upgrade -l 10000,10061,10200,10261,10800,10861,12200,12261,14400,14461,12600,12661,14000,14061,12800,12861,13000,13061,13800,13861",
]
)
RELVAL_KEYS["WORKFLOWS"].append(
[
"_SLHC_",
"-w upgrade -l 10000,10061,10200,10261,12200,12261,14400,14461,12600,12661,14000,14061,12800,12861,13000,13061,13800,13861",
]
)
RELVAL_KEYS["WORKFLOWS"].append(["_(GPU|ROCM)_", "-w gpu"])
RELVAL_KEYS["enableIMT"].append(
[THREADED_ROOT, "--customise FWCore/Concurrency/enableIMT.enableIMT"]
)
RELVAL_KEYS["TIMEOUT"].append(["(ASAN|_ppc64|_aarch64_)", "14400"])
RELVAL_KEYS["TIMEOUT"].append([".+", "9000"])
if "CMS_RELVALS_USER_OPTS" in environ:
RELVAL_KEYS["USER_OVERRIDE_OPTS"].append([".+", environ["CMS_RELVALS_USER_OPTS"]])
if "CMS_RELVALS_USER_COMMAND_OPTS" in environ:
RELVAL_KEYS["USER_OVERRIDE_COMMAND_OPTS"].append(
[".+", environ["CMS_RELVALS_USER_COMMAND_OPTS"]]
)
RELVAL_ARGS = []
RELVAL_ARGS.append({})
# For SLHC releases
RELVAL_ARGS[len(RELVAL_ARGS) - 1][
"_SLHC(DEV|)_"
] = """
@USE_INPUT@
@WORKFLOWS@
"""
RELVAL_ARGS[len(RELVAL_ARGS) - 1]["CMSSW_4_2_"] = ""
RELVAL_ARGS.append({})
# For rleease cycles >= 7
RELVAL_ARGS[len(RELVAL_ARGS) - 1][
"CMSSW_([1-9][0-9]|[7-9])_"
] = """
@USE_INPUT@
@JOB_REPORT@
--command "
@customiseWithTimeMemorySummary@
@enableIMT@
@PREFIX@
@USER_OVERRIDE_COMMAND_OPTS@
"
@THREADED@
@WORKFLOWS@
@USER_OVERRIDE_OPTS@
"""
RELVAL_ARGS.append({})
# For all other releases
RELVAL_ARGS[len(RELVAL_ARGS) - 1][
".+"
] = """
@USE_INPUT@
"""
def isThreaded(release, arch):
if re.search(THREADED_IBS, release + ":" + arch):
return True
return False
def GetMatrixOptions(release, arch, dasfile=None):
rel_arch = release + ":" + arch
cmd = ""
for rel in RELVAL_ARGS:
for exp in rel:
if re.search(exp, rel_arch):
cmd = rel[exp].replace("\n", " ")
break
if cmd:
break
m = re.search("(@([a-zA-Z_]+)@)", cmd)
while m:
key = m.group(2)
val = ""
if key in RELVAL_KEYS:
for exp, data in RELVAL_KEYS[key]:
if re.search(exp, rel_arch):
val = data + " "
break
cmd = cmd.replace(m.group(1), val)
m = re.search("(@([a-zA-Z_]+)@)", cmd)
return re.sub("\\s+", " ", cmd)
def GetWFThreads(args):
if not " -t " in args:
return "1"
return args.split(" -t ")[-1].strip().split()[0]
def FixWFArgs(release, arch, wf, args):
if isThreaded(release, arch):
if int(release.split("_")[1]) >= 12:
return args
NonThreadedWF = ["101.0", "102.0"]
if wf in NonThreadedWF:
for k in ["THREADED", "enableIMT"]:
if k in RELVAL_KEYS:
thds = [d for e, d in RELVAL_KEYS[k] if THREADED_IBS == e]
roots = [d for e, d in RELVAL_KEYS[k] if THREADED_ROOT == e]
if thds:
args = args.replace(thds[0], "")
elif roots:
args = args.replace(roots[0], "")
return args