#NEWLINE# def collect_cdf_datasources( self ) : #NEWLINE# #INDENT# '\n    Identify what cdf series exist in both the diffed reports and download them to the diff report resources directory\n    :return: True/False : return status of whether the download of time series resources succeeded.\n    ' #NEWLINE# report_count = 0 #NEWLINE# if ( self . status != 'OK' ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# diff_cdf_datasource = sorted ( ( set ( self . reports [ 0 ] . cdf_datasource ) & set ( self . reports [ 1 ] . cdf_datasource ) ) ) #NEWLINE# if diff_cdf_datasource : #NEWLINE# #INDENT# self . reports [ 0 ] . cdf_datasource = diff_cdf_datasource #NEWLINE# self . reports [ 1 ] . cdf_datasource = diff_cdf_datasource #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . status = 'NO_COMMON_STATS' #NEWLINE# logger . error ( 'No common metrics were found between the two reports' ) #NEWLINE# return False #NEWLINE# #UNINDENT# for report in self . reports : #NEWLINE# #INDENT# report . label = report_count #NEWLINE# report_count += 1 #NEWLINE# report . local_location = os . path . join ( self . resource_directory , str ( report . label ) ) #NEWLINE# try : #NEWLINE# #INDENT# os . makedirs ( self . local_location ) #NEWLINE# #UNINDENT# except OSError as exeption : #NEWLINE# #INDENT# if ( exeption . errno != errno . EEXIST ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# if ( report . remote_location != 'local' ) : #NEWLINE# #INDENT# naarad . httpdownload . download_url_list ( map ( ( lambda x : ( ( ( ( ( report . remote_location + '/' ) + self . resource_path ) + '/' ) + x ) + '.csv' ) ) , report . cdf_datasource ) , report . local_location ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# for filename in report . cdf_datasource : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# shutil . copy ( os . path . join ( os . path . join ( report . location , self . resource_path ) , ( filename + '.csv' ) ) , report . local_location ) #NEWLINE# #UNINDENT# except IOError as exeption : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return True