CMS 3D CMS Logo

Functions | Variables

parserEdmSize Namespace Reference

Functions

def getEdmReport
def parseEdmSize

Variables

tuple edmSize_line_parsing_reg
tuple test_edm_file = re.compile("_EdmSize$", re.IGNORECASE)

Function Documentation

def parserEdmSize::getEdmReport (   path,
  candle,
  step 
)

Definition at line 42 of file parserEdmSize.py.

00043                                     :
00044         files = os.listdir(path)
00045         edm_files = [os.path.join(path, f) for f in files
00046                                  if test_edm_file.search(f) 
00047                                         and os.path.isfile(os.path.join(path, f)) ]
00048 
00049         """ get the size of file if it is the root file for current candle and step """
00050         # TODO: a function candle, step --> file name
00051 
00052         try:
00053                 edm_fn = [f for f in edm_files
00054                          if f_candle_and_step_inJobID(candle, step, getJobID_fromEdmSizeFileName(f))][0] #that's in the same dir so candle and step is more than enough
00055         except IndexError, e: #this would happen if there's no Edmsize report existing !!!
00056                 return False
00057 
00058         # open the file and read into lines
00059         edm_file = open(edm_fn)
00060         lines = edm_file.readlines()
00061         edm_file.close()
00062 
00063         #return the parsed data
00064         products = parseEdmSize(lines)
00065         
00066         return products
00067 
def parserEdmSize::parseEdmSize (   lines)
Returns a list of dictionaries

Example of data:
>>> parseEdmSize(lines = ( 'File MINBIAS__RAW2DIGI,RECO.root Events 8000', 'TrackingRecHitsOwned_generalTracks__RECO. 407639 18448.4', 'recoPreshowerClusterShapes_multi5x5PreshowerClusterShape_multi5x5PreshowerXClustersShape_RECO. 289.787 41.3311', 'recoPreshowerClusterShapes_multi5x5PreshowerClusterShape_multi5x5PreshowerYClustersShape_RECO. 289.767 47.2686', 'recoCaloClustersToOnerecoClusterShapesAssociation_hybridSuperClusters_hybridShapeAssoc_RECO. 272.111 65.4852'))
[{'module_name': 'generalTracks', 'module_label': '', 'size_compressed': '18448.4', 'cpp_type': 'TrackingRecHitsOwned', 'size_uncompressed': '407639'}, {'module_name': 'multi5x5PreshowerClusterShape', 'module_label': 'multi5x5PreshowerXClustersShape', 'size_compressed': '41.3311', 'cpp_type': 'recoPreshowerClusterShapes', 'size_uncompressed': '289.787'}, {'module_name': 'multi5x5PreshowerClusterShape', 'module_label': 'multi5x5PreshowerYClustersShape', 'size_compressed': '47.2686', 'cpp_type': 'recoPreshowerClusterShapes', 'size_uncompressed': '289.767'}, {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}]

Definition at line 20 of file parserEdmSize.py.

00021                        :
00022         """
00023         Returns a list of dictionaries
00024 
00025         Example of data:
00026         >>> parseEdmSize(lines = ( 'File MINBIAS__RAW2DIGI,RECO.root Events 8000', 'TrackingRecHitsOwned_generalTracks__RECO. 407639 18448.4', 'recoPreshowerClusterShapes_multi5x5PreshowerClusterShape_multi5x5PreshowerXClustersShape_RECO. 289.787 41.3311', 'recoPreshowerClusterShapes_multi5x5PreshowerClusterShape_multi5x5PreshowerYClustersShape_RECO. 289.767 47.2686', 'recoCaloClustersToOnerecoClusterShapesAssociation_hybridSuperClusters_hybridShapeAssoc_RECO. 272.111 65.4852'))
00027         [{'module_name': 'generalTracks', 'module_label': '', 'size_compressed': '18448.4', 'cpp_type': 'TrackingRecHitsOwned', 'size_uncompressed': '407639'}, {'module_name': 'multi5x5PreshowerClusterShape', 'module_label': 'multi5x5PreshowerXClustersShape', 'size_compressed': '41.3311', 'cpp_type': 'recoPreshowerClusterShapes', 'size_uncompressed': '289.787'}, {'module_name': 'multi5x5PreshowerClusterShape', 'module_label': 'multi5x5PreshowerYClustersShape', 'size_compressed': '47.2686', 'cpp_type': 'recoPreshowerClusterShapes', 'size_uncompressed': '289.767'}, {'module_name': 'hybridSuperClusters', 'module_label': 'hybridShapeAssoc', 'size_compressed': '65.4852', 'cpp_type': 'recoCaloClustersToOnerecoClusterShapesAssociation', 'size_uncompressed': '272.111'}]
00028 
00029         """
00030         #reg returns (cpp_type, mod_name, mod_label, proc_name, size_uncomp, size_comp)
00031 
00032         #TODO: I could change this into shorter ---...
00033 
00034         return [ {"cpp_type": cpp_type, "module_name": mod_name, "module_label": mod_label,
00035                         "size_uncompressed": size_uncomp, "size_compressed": size_comp} # we filter out the proc_name, AND CONVERT TO DICTIONARY
00036                 for (cpp_type, mod_name, mod_label, proc_name, size_uncomp, size_comp) in [
00037                         reg.groups() for reg in [
00038                                 edmSize_line_parsing_reg.search(line) for line in lines] 
00039                         if reg ] # we filter out not matched lines
00040         ]
00041 
""" Get EdmSize file size for the candle, step in current dir """

Variable Documentation

Initial value:
00001 re.compile( \
00002         r"""    # <C++ type>_<module_name>_[opt:_<module label>]_<process name which produced>.(dot)            ^([^_]+)_([^_]+)_([^_]*)_([^.]+[.])     # <plain_size> <compressed_size>        \s([^\s]+)\s(.+)$""", re.VERBOSE)

Definition at line 11 of file parserEdmSize.py.

tuple parserEdmSize::test_edm_file = re.compile("_EdmSize$", re.IGNORECASE)

Definition at line 5 of file parserEdmSize.py.