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