3 from __future__
import print_function
9 from Validation.Performance.parserPerfsuiteMetadata
import parserPerfsuiteMetadata
12 import Validation.Performance.parserEdmSize
as parserEdmSize
15 from commands
import getstatusoutput
17 """ indicates whether the CMSSW is [use False] available or not. on our testing machine it's not [use True] """ 20 """ global variables """ 21 test_timing_report_log = re.compile(
"TimingReport.log$", re.IGNORECASE)
22 test_igprof_report_log = re.compile(
"^(.*)(IgProfMem|IgProfPerf)\.gz", re.IGNORECASE)
23 test_memcheck_report_log = re.compile(
"^(.*)memcheck_vlgd.xml", re.IGNORECASE)
26 xmldoc = minidom.Document()
35 Usage: %(script)s [-v cmssw_version] [--version=cmssw_version] 37 if the cmssw version is in the system's environment (after running cmsenv): 40 otherwise one must specify the cmssw version: 41 $ %(script)s --version=CMSSW_3_2_0 42 $ %(script)s -v CMSSW_3_2_0 48 Returns the version of CMSSW to be used which it is taken from: 49 * command line parameter or 50 * environment variable 51 in case of error returns None 53 And also the directory to put the xml files to: if none --> returns "" 56 """ try to get the version for command line argument """ 63 xml_dir=
"PerfSuiteDBData" 65 opts, args = getopt.getopt(argv[1:],
"v:", [
"version=",
"outdir="])
66 except getopt.GetoptError
as e:
69 if opt
in (
"-v",
"--version"):
74 """ if not get it from environment string """ 77 version = os.environ[
"CMSSW_VERSION"]
81 return (version, xml_dir)
88 for prod
in edm_report:
91 if ec
not in EC_count:
95 for (ec, prods)
in EC_count.items():
96 print(
"==== %s EVENT CONTENT: have %d items, the listing is: ===" % (ec, len(prods)))
98 print(
"\n *".
join([
"%(cpp_type)s_%(module_name)s_%(module_label)s" % prod
for prod
in prods]))
102 """ returns modified product by adding the event content relationship """ 111 return [{
"name": seq,
"modules":
",".
join(modules)}
for (seq, modules)
in sequenceWithModulesString.items()]
115 jobID = igProfReport[
"jobID"]
117 candleLong = os.path.split(path)[1].
replace(
"_IgProf_Perf",
"").
replace(
"_IgProf_Mem",
"").
replace(
"_PU",
"")
120 if igProfType
in runinfo[
'TestResults']:
121 for result
in runinfo[
'TestResults'][igProfType]:
122 if candleLong == result[
"candle"]
and jobID[
"pileup_type"] == result[
'pileup_type']
and jobID[
"conditions"] == result[
'conditions']
and jobID[
"event_content"] == result[
'event_content']:
123 jobID[
"candle"] = jobID[
"candle"].
upper()
124 if "jobs" not in result:
126 result[
'jobs'].
append(igProfReport)
131 print(
"============ (almost) ERROR: NOT FOUND THE ENTRY in cmsPerfSuite.log, exporting as separate entry ======== ")
133 print(
" ====================== ")
134 runinfo[
'unrecognized_jobs'].
append(igProfReport)
139 candleLong = os.path.split(path)[1].
replace(
"_TimeSize",
"").
replace(
"_PU",
"")
140 jobID = timeSizeReport[
"jobID"]
144 if 'TimeSize' in runinfo[
'TestResults']:
145 for result
in runinfo[
'TestResults'][
'TimeSize']:
147 """ If this is the testResult which fits TimeSize job """ 150 if result[
'candle'] == candleLong
and jobID[
"pileup_type"] == result[
'pileup_type']
and jobID[
"conditions"] == result[
'conditions']
and jobID[
"event_content"] == result[
'event_content']:
152 if "jobs" not in result:
154 result[
'jobs'].
append(timeSizeReport)
159 print(
"============ (almost) ERROR: NOT FOUND THE ENTRY in cmsPerfSuite.log, exporting as separate entry ======== ")
161 print(
" ====================== ")
162 runinfo[
'unrecognized_jobs'].
append(timeSizeReport)
166 candleLong = os.path.split(path)[1].
replace(
"_Memcheck",
"").
replace(
"_PU",
"")
167 jobID = MemcheckReport[
"jobID"]
171 if 'Memcheck' in runinfo[
'TestResults']:
172 for result
in runinfo[
'TestResults'][
'Memcheck']:
175 """ If this is the testResult which fits Memcheck job """ 178 if result[
'candle'] == candleLong
and jobID[
"pileup_type"] == result[
'pileup_type']
and jobID[
"conditions"] == result[
'conditions']
and jobID[
"event_content"] == result[
'event_content']:
180 if "jobs" not in result:
182 result[
'jobs'].
append(MemcheckReport)
187 print(
"============ (almost) ERROR: NOT FOUND THE ENTRY in cmsPerfSuite.log, exporting as separate entry ======== ")
189 print(
" ====================== ")
190 runinfo[
'unrecognized_jobs'].
append(MemcheckReport)
193 global release,event_content,conditions
194 """ if the release is not provided explicitly we take it from the Simulation candles file """ 197 release = release_fromlogfile
198 print(
"release from simulation candles: %s" % release)
202 raise Exception(
"the release was not found!")
205 """ process the TimingReport log files """ 208 files = os.listdir(path)
209 timing_report_files = [os.path.join(path, f)
for f
in files
210 if test_timing_report_log.search(f)
211 and os.path.isfile(os.path.join(path, f)) ]
214 for timelog_f
in timing_report_files:
215 print(
"\nProcessing file: %s" % timelog_f)
220 (candle, step, pileup_type, conditions, event_content) = jobID
221 jobID =
dict(
list(
zip((
"candle",
"step",
"pileup_type",
"conditions",
"event_content"), jobID)))
222 print(
"Dictionary based jobID %s: " %
str(jobID))
225 discard = len([key
for key, value
in jobID.items()
if key !=
"pileup_type" and not value])
227 print(
" ====================== The job HAS BEEN DISCARDED =============== ")
228 print(
" NOT ALL DATA WAS AVAILABLE ")
230 print(
" ======================= end ===================================== ")
234 (mod_timelog, evt_timelog, rss_data, vsize_data) =
loadTimeLog(timelog_f)
237 print(
"Number of modules grouped by (module_label+module_name): %s" % len(mod_timelog))
243 pileups[
"NoPileUp"]=1
245 pileups[pileup_type] = 1
248 root_file_size =
getRootFileSize(path = path, candle = candle, step = step.replace(
':',
'='))
254 if edm_report !=
False:
257 edm_report =
map(assign_event_content_for_product, edm_report)
260 except Exception
as e:
266 "timelog_result": (mod_timelog, evt_timelog, rss_data, vsize_data),
267 "metadata": {
"testname":
"TimeSize",
"root_file_size": root_file_size,
"num_events": num_events},
268 "edmSize_result": edm_report
275 global release,event_content,conditions
276 """ if the release is not provided explicitly we take it from the Simulation candles file """ 279 release = release_fromlogfile
280 print(
"release from simulation candles: %s" % release)
284 raise Exception(
"the release was not found!")
286 """ process the vlgd files """ 289 files = os.listdir(path)
290 memcheck_files = [os.path.join(path, f)
for f
in files
291 if test_memcheck_report_log.search(f)
292 and os.path.isfile(os.path.join(path, f)) ]
294 if len(memcheck_files) == 0:
295 print(
"No _vlgd files found!")
297 for file
in memcheck_files:
300 (candle, step, pileup_type, conditions, event_content) = jobID
303 jobID =
dict(
list(
zip((
"candle",
"step",
"pileup_type",
"conditions",
"event_content"), jobID)))
305 print(
"Dictionary based jobID %s: " %
str(jobID))
308 discard = len([key
for key, value
in jobID.items()
if key !=
"pileup_type" and not value])
310 print(
" ====================== The job HAS BEEN DISCARDED =============== ")
311 print(
" NOT ALL DATA WAS AVAILABLE ")
313 print(
" ======================= end ===================================== ")
318 candles[candle.upper()] = 1
320 pileups[
"NoPileUp"]=1
322 pileups[pileup_type] = 1
329 "memcheck_errors": {
"error_num": memerror},
330 "metadata": {
"testname":
"Memcheck"},
337 globbed = glob.glob(os.path.join(path,
"*memcheck_vlgd.xml"))
343 cmd =
"grep '<error>' "+f+
" | wc -l " 344 p = os.popen(cmd,
'r') 345 errnum += int(p.readlines()[0]) 351 global release,event_content,conditions
352 """ if the release is not provided explicitly we take it from the Simulation candles file """ 355 release = release_fromlogfile
356 print(
"release from simulation candles: %s" % release)
360 raise Exception(
"the release was not found!")
362 """ process the IgProf sql3 files """ 365 files = os.listdir(path)
366 igprof_files = [os.path.join(path, f)
for f
in files
367 if test_igprof_report_log.search(f)
368 and os.path.isfile(os.path.join(path, f)) ]
370 if len(igprof_files) == 0:
371 print(
"No igprof files found!")
373 for file
in igprof_files:
376 (candle, step, pileup_type, conditions, event_content) = jobID
379 jobID =
dict(
list(
zip((
"candle",
"step",
"pileup_type",
"conditions",
"event_content"), jobID)))
381 print(
"Dictionary based jobID %s: " %
str(jobID))
386 discard = len([key
for key, value
in jobID.items()
if key !=
"pileup_type" and not value])
388 print(
" ====================== The job HAS BEEN DISCARDED =============== ")
389 print(
" NOT ALL DATA WAS AVAILABLE ")
391 print(
" ======================= end ===================================== ")
396 candles[candle.upper()] = 1
398 pileups[
"NoPileUp"]=1
400 pileups[pileup_type] = 1
408 "igprof_result": igs,
409 "metadata": {
"testname": igProfType},
419 globbed = glob.glob(os.path.join(path,
"*.sql3"))
426 cumCounts, cumCalls = profileInfo
427 dump, architecture, release, rest = f.rsplit(
"/", 3)
428 candle, sequence, pileup, conditions, process, counterType, events = rest.split(
"___")
429 events = events.replace(
".sql3",
"")
430 igresult.append({
"counter_type": counterType,
"event": events,
"cumcounts": cumCounts,
"cumcalls": cumCalls})
434 if 'diff' in ig[
'event']:
435 eventLast,eventOne = ig[
'event'].
split(
'_diff_')
436 for part
in igresult:
437 if part[
'counter_type'] == ig[
'counter_type']
and part[
'event'] == eventOne:
438 cumcountsOne = part[
'cumcounts']
439 cumcallsOne = part[
'cumcalls']
440 if part[
'counter_type'] == ig[
'counter_type']
and part[
'event'] == eventLast:
441 cumcountsLast = part[
'cumcounts']
442 cumcallsLast = part[
'cumcalls']
443 ig[
'cumcounts'] = cumcountsLast - cumcountsOne
444 ig[
'cumcalls'] = cumcallsLast - cumcallsOne
449 summary_query=
"""SELECT counter, total_count, total_freq, tick_period 451 error, output =
doQuery(summary_query, database)
452 if error
or not output
or output.count(
"\n") > 1:
454 counter, total_count, total_freq, tick_period = output.split(
"@@@")
455 if counter ==
"PERF_TICKS":
456 return float(tick_period) *
float(total_count),
int(total_freq)
458 return int(total_count),
int(total_freq)
461 if os.path.exists(
"/usr/bin/sqlite3"):
462 sqlite=
"/usr/bin/sqlite3" 464 sqlite=
"/afs/cern.ch/user/e/eulisse/www/bin/sqlite" 465 return getstatusoutput(
"echo '%s' | %s -separator @@@ %s" % (query, sqlite, database))
469 """ so far we will use the current dir to search in """ 472 print(
'full path =', os.path.abspath(path))
474 files = os.listdir(path)
476 test_timeSizeDirs = re.compile(
"_TimeSize$", re.IGNORECASE)
477 timesize_dirs = [os.path.join(path, f)
for f
in files
if test_timeSizeDirs.search(f)
and os.path.isdir(os.path.join(path, f))]
479 for timesize_dir
in timesize_dirs:
485 """ so far we will use the current dir to search in """ 488 print(
'full path =', os.path.abspath(path))
490 files = os.listdir(path)
492 test_MemcheckDirs = re.compile(
"_Memcheck(.*)$", re.IGNORECASE)
493 memcheck_dirs = [os.path.join(path, f)
for f
in files
if test_MemcheckDirs.search(f)
and os.path.isdir(os.path.join(path, f))]
495 for memcheck_dir
in memcheck_dirs:
501 """ so far we will use the current dir to search in """ 504 print(
'full path =', os.path.abspath(path))
506 files = os.listdir(path)
508 test_IgProfDirs = re.compile(
"_IgProf(.*)$", re.IGNORECASE)
509 igprof_dirs = [os.path.join(path, f)
for f
in files
if test_IgProfDirs.search(f)
and os.path.isdir(os.path.join(path, f))]
511 for igprof_dir
in igprof_dirs:
516 """ Exports the sequences to XML Doc """ 518 env_cmssw_version = os.environ[
"CMSSW_VERSION"]
520 print(
"<<<<< ====== Error: cannot get CMSSW version [just integrity check for sequences]. \ 521 Is the CMSSW environment initialized? (use cmsenv) ==== >>>>")
522 env_cmssw_version =
None 524 print(
" ==== exporting the sequences. loading files for currently loaded CMSSW version: %s, while the CMSSW we are currently harversting is %s ===" %(env_cmssw_version, release))
529 if __name__ ==
"__main__":
537 """ print usage(sys.argv) 539 print(
"The version was not provided explicitly, will try to get one from SimulationCandles file """) 542 # Export the metadata from cmsPerfSuite.log (in current working directory!) 543 print("Parsing cmsPerfSuite.log: getting all the metadata concerning the run") 544 p = parserPerfsuiteMetadata(os.getcwd()) 545 run_info = p.parseAll() 547 print("Loading Sequences and Event-Content(s). Please wait...") 550 EventContents_OK = False 554 import Validation.Performance.ModuleToSequenceAssign as ModuleToSequenceAssign 556 except Exception as e: 559 import Validation.Performance.parseEventContent as parseEventContent 560 EventContents_OK = True 561 except Exception as e: 564 print("Parsing TimeSize report") 565 # Search for TimeSize files: EdmSize, TimingReport 566 searchTimeSizeFiles(run_info) 567 print("Parsing IgProf report") 568 # Search for IgProf files 569 searchIgProfFiles(run_info) 570 print("Parsing Memcheck report") 571 # Search for Memcheck files 572 searchMemcheckFiles(run_info) 575 print("Exporting sequences and event-content rules") 577 """ for testing on laptom we have no CMSSW
""" 578 # export sequences (for currently loaded CMSSW) 583 # export event's content rules 584 eventContentRules = parseEventContent.getTxtEventContentRules() 585 cmssw_exportdb_xml.exportECRules(xmldoc, eventContentRules) 588 cmssw_exportdb_xml.exportRunInfo(xmldoc, run_info, release = release) 589 #save the XML file, TODO: change fileName after introducting the JobID 591 now = datetime.datetime.now() 592 #Changing slightly the XML filename format 593 #FIXME: review this convention and archive the xml in a separate CASTOR xml directory for quick recovery of DB... 594 file_name = "%s___%s___%s___%s___%s___%s___%s.xml" % (release, "_".join(steps.keys()), "_".join(candles.keys()), "_".join(pileups.keys()),event_content,conditions,now.isoformat()) 595 print("Writing the output to: %s " % file_name) 597 write_xml(xmldoc, output_dir, file_name) #change this function to be able to handle directories in remote machines (via tar pipes for now could always revert to rsync later). 598 #NB write_xml is in Validation/Performance/python/cmssw_exportdb_xml.py def process_igprof_dir(path, runinfo)
def doQuery(query, database)
def read_SimulationCandles(path)
def xml_export_Sequences(xml_doc, sequences, release)
def assignModulesToSeqs()
def exportIgProfReport(path, igProfReport, igProfType, runinfo)
def searchMemcheckFiles(runinfo)
def replace(string, replacements)
def assign_event_content_for_product(product)
def exportTimeSizeJob(path, timeSizeReport, runinfo)
S & print(S &os, JobReport::InputFile const &f)
def searchTimeSizeFiles(runinfo)
def List_ECs_forProduct(product)
def getEdmReport(path, candle, step)
def searchIgProfFiles(runinfo)
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
def get_modules_sequences_relationships()
def getJobID_fromIgProfLogName(logfile_name)
def loadTimeLog(log_filename, maxsize_rad=0)
def processModuleTimeLogData(modules_timelog, groupBy="module_name")
mod_data["stats"] =calc_MinMaxAvgRMS(f_time = lambda x: x["time"], f_evt_num = lambda x: x["event_num...
def getRootFileSize(path, candle, step)
static std::string join(char **cmd)
def getSummaryInfo(database)
def _eventContent_DEBUG(edm_report)
def read_ConfigurationFromSimulationCandles(path, step, is_pileup)
def process_timesize_dir(path, runinfo)
def getMemcheckError(path)
def process_memcheck_dir(path, runinfo)
def getJobID_fromMemcheckLogName(logfile_name)
def getJobID_fromTimeReportLogName(logfile_name)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def exportMemcheckReport(path, MemcheckReport, runinfo)