117 import os, sys, string
119 joparts = (os.path.basename(jofile)).
split(
".")
121 if joparts[0].startswith(
"mc")
and all(c
in string.digits
for c
in joparts[0][2:]):
124 if len(joparts) != 3:
125 evgenLog.error(jofile +
" name format is wrong: must be of the form mc.<physicsShort>.py: please rename.")
128 jo_physshortpart = joparts[1]
129 if len(jo_physshortpart) > 50:
130 evgenLog.error(jofile +
" contains a physicsShort field of more than 60 characters: please rename.")
133 jo_physshortparts = jo_physshortpart.split(
"_")
134 if len(jo_physshortparts) < 2:
135 evgenLog.error(jofile +
" has too few physicsShort fields separated by '_': should contain <generators>(_<tune+PDF_if_available>)_<process>. Please rename.")
139 check_jofiles=
"/cvmfs/atlas.cern.ch/repo/sw/Generators/MC16JobOptions/scripts"
140 sys.path.append(check_jofiles)
141 from check_jo_consistency
import check_naming
142 if os.path.exists(check_jofiles):
143 check_naming(os.path.basename(jofile))
145 evgenLog.error(
"check_jo_consistency.py not found")
150 if sample.nEventsPerJob < 1:
151 raise RuntimeError(
"nEventsPerJob must be at least 1")
152 elif sample.nEventsPerJob > 100000:
153 raise RuntimeError(
"nEventsPerJob can be max. 100000")
155 allowed_nEventsPerJob_lt1000 = [1, 2, 5, 10, 20, 25, 50, 100, 200, 500, 1000]
156 if sample.nEventsPerJob >= 1000
and sample.nEventsPerJob <= 10000
and \
157 (sample.nEventsPerJob % 1000 != 0
or 10000 % sample.nEventsPerJob != 0):
158 raise RuntimeError(
"nEventsPerJob in range [1K, 10K] must be a multiple of 1K and a divisor of 10K")
159 elif sample.nEventsPerJob > 10000
and sample.nEventsPerJob % 10000 != 0:
160 raise RuntimeError(
"nEventsPerJob >10K must be a multiple of 10K")
161 elif sample.nEventsPerJob < 1000
and sample.nEventsPerJob
not in allowed_nEventsPerJob_lt1000:
162 raise RuntimeError(
"nEventsPerJob in range <= 1000 must be one of %s" % allowed_nEventsPerJob_lt1000)
193 from AthenaCommon.Utils.unixtools
import find_datafile
194 lkwpath = find_datafile(
"CategoryList.txt")
199 from ast
import literal_eval
200 with open(lkwpath,
'r')
as catlist:
202 allowed_list = literal_eval(line)
203 allowed_cat.append(allowed_list)
207 it = iter(sample.categories)
211 if "L1:" in l2
and "L2:" in l1:
213 print (
"first",l1,
"second",l2)
214 bad_cat.extend([l1, l2])
215 for a1,a2
in allowed_cat:
216 if l1.strip().lower()==a1.strip().lower()
and l2.strip().lower()==a2.strip().lower():
219 msg =
"categories contains non-standard category: %s. " %
", ".join(bad_cat)
220 msg +=
"Please check the allowed categories list and fix."
226 evgenLog.warning(
"Could not find CategoryList.txt file ", lkwpath,
" in $DATAPATH")