#NEWLINE# def load_tool( result ) : #NEWLINE# #INDENT# '\n    Load the module with the tool-specific code.\n    ' #NEWLINE# def load_tool_module( tool_module ) : #NEWLINE# #INDENT# if ( not tool_module ) : #NEWLINE# #INDENT# logging . warning ( 'Cannot extract values from log files for benchmark results %s (missing attribute "toolmodule" on tag "result").' , Util . prettylist ( result . attributes [ 'name' ] ) ) #NEWLINE# return None #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# logging . debug ( 'Loading %s' , tool_module ) #NEWLINE# return __import__ ( tool_module , fromlist = [ 'Tool' ] ) . Tool ( ) #NEWLINE# #UNINDENT# except ImportError as ie : #NEWLINE# #INDENT# logging . warning ( 'Missing module "%s", cannot extract values from log files (ImportError: %s).' , tool_module , ie ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# logging . warning ( 'The module "%s" does not define the necessary class Tool, cannot extract values from log files.' , tool_module ) #NEWLINE# #UNINDENT# return None #NEWLINE# #UNINDENT# tool_module = ( result . attributes [ 'toolmodule' ] [ 0 ] if ( 'toolmodule' in result . attributes ) else None ) #NEWLINE# if ( tool_module in loaded_tools ) : #NEWLINE# #INDENT# return loaded_tools [ tool_module ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# result = load_tool_module ( result ) #NEWLINE# loaded_tools [ tool_module ] = result #NEWLINE# return result