def get(self, *args): convertedArgs = webapi.typeConversion([str], args) parameters = util.DotDict(zip(['orderby'], convertedArgs)) connection = self.database.connection() cursor = connection.cursor() # use the last date that we have data for as the end currentVersions = """ /* socorro.services.CurrentVersions currentVersions */ SELECT product_name, product_version_id, version_string, is_featured, start_date, end_date, build_type, throttle FROM product_info ORDER BY product_name, version_sort DESC """ cursor.execute(currentVersions) result = [] for (product, product_id, version, featured, start, end, build_type, throttle) in cursor.fetchall(): releases = {'id': product_id, 'product': product, 'version': version, 'featured': featured, 'start_date': str(start), 'end_date': str(end), 'release': build_type, 'throttle': str(throttle) } result.append(releases) return {'currentversions': result}
def get(self, *args): convertedArgs = webapi.typeConversion([dataTypeOptions,str], args) parameters = util.DotDict(zip(['datatype','uuid'], convertedArgs)) logger.debug("GetCrash get %s", parameters) self.crashStorage = self.crashStoragePool.crashStorage() function_name = datatype_function_associations[parameters.datatype] function = self.__getattribute__(function_name) return function(parameters.uuid)
def get(self, *args): convertedArgs = webapi.typeConversion([str, str, dtutil.string_to_datetime, int, int, int], args) parameters = util.DotDict(zip(['product', 'version', 'end', 'duration', 'listsize', 'page'], convertedArgs)) connection = self.database.connection() cursor = connection.cursor() hangReportCountSql = """ /* socorro.services.HangReportCount */ SELECT count(*) FROM hang_report WHERE product = %(product)s AND version = %(version)s AND report_day >= ((%(end)s::DATE - %(duration)s)) """ logger.debug(cursor.mogrify(hangReportCountSql, parameters)) cursor.execute(hangReportCountSql, parameters) hangReportCount = cursor.fetchone()[0] listsize = parameters['listsize'] page = parameters['page'] totalPages = hangReportCount / listsize logger.debug('total pages: %s' % totalPages) parameters['offset'] = listsize * (page - 1) hangReportSql = """ /* socorro.services.HangReport */ SELECT browser_signature, plugin_signature, browser_hangid, flash_version, url, uuid, duplicates, report_day FROM hang_report WHERE product = %(product)s AND version = %(version)s AND report_day >= ((%(end)s)::DATE -%(duration)s) LIMIT %(listsize)s OFFSET %(offset)s""" logger.debug(cursor.mogrify(hangReportSql, parameters)) cursor.execute(hangReportSql, parameters) result = [] for row in cursor.fetchall(): (browser_signature, plugin_signature, browser_hangid, flash_version, url, uuid, duplicates, report_day) = row result.append({'browser_signature': browser_signature, 'plugin_signature': plugin_signature, 'browser_hangid': browser_hangid, 'flash_version': flash_version, 'url': url, 'uuid': uuid, 'duplicates': duplicates, 'report_day': str(report_day)}) return {'hangReport': result, 'endDate': str(parameters['end']), 'totalPages': totalPages, 'currentPage': page, 'totalCount': hangReportCount}
def get(self, *args): convertedArgs = webapi.typeConversion([str, semicolonStringToListSanitized, str, semicolonStringToListSanitized, dtutil.string_to_datetime, dtutil.string_to_datetime], args) parameters = util.DotDict(zip(['product', 'listOfVersions', 'report_type', 'listOfOs_names', 'start_date', 'end_date'], convertedArgs)) parameters.productdims_idList = [self.context['productVersionCache'].getId(parameters.product, x) for x in parameters.listOfVersions] self.connection = self.database.connection() try: return self.aduByDay(parameters) finally: self.connection.close()
def get(self, *args): " Webpy method receives inputs from uri " stringListFromCSV = lambda s: tuple([x.strip() for x in s.split(',')]) convertedArgs = webapi.typeConversion([str, stringListFromCSV, str, string_to_datetime, string_to_datetime], args) parameters = util.DotDict(zip(['product', 'versions', 'signature', 'start_date', 'end_date'], convertedArgs)) connection = self.database.connection() try: return {'emails': self.estimate_campaign_volume(connection, parameters)} finally: connection.close()
def post(self, *args): convertedArgs = webapi.typeConversion([str], args) parameters = util.DotDict(zip(['uuid'], convertedArgs)) connection = self.database.connection() sql = """INSERT INTO priorityjobs (uuid) VALUES (%s)""" try: connection.cursor().execute(sql, (parameters['uuid'],)) except Exception: connection.rollback() util.reportExceptionAndContinue(logger) return False connection.commit() return True
def get(self, *args): convertedArgs = webapi.typeConversion([str], args) parameters = util.DotDict(zip(['orderby'], convertedArgs)) connection = self.database.connection() cursor = connection.cursor() featured_only = False if 'featured' in args: featured_only = True # use the last date that we have data for as the end currentVersions = """ /* socorro.services.CurrentVersions curentVersions */ SELECT DISTINCT product_name, product_version_id, version_string, is_featured, start_date, end_date, build_type, throttle FROM product_info""" if featured_only: currentVersions += """ WHERE is_featured""" if parameters['orderby']: orderby = parameters['orderby'] orderby = urllib2.unquote(orderby) orderby = orderby.split(',') currentVersions += create_order_by(orderby) cursor.execute(currentVersions) result = [] for (product, product_id, version, featured, start, end, build_type, throttle) in cursor.fetchall(): releases = {'id': product_id, 'product': product, 'version': version, 'start_date': str(start), 'end_date': str(end), 'release': build_type, 'throttle': str(throttle) } if not featured_only: releases['featured'] = featured result.append(releases) return {'currentversions': result}
def get(self, *args): convertedArgs = webapi.typeConversion([str, str, u2.unquote, dtutil.string_to_datetime, dtutil.strHoursToTimeDelta, int], args) parameters = util.DotDict(zip(['product', 'version', 'signature', 'endDate', 'duration', 'steps'], convertedArgs)) parameters['productVersionCache'] = self.context['productVersionCache'] logger.debug("SignatureHistory get %s", parameters) self.connection = self.database.connection() #logger.debug('connection: %s', self.connection) try: impl = modern.SignatureHistoryModern(self.configContext) return impl.signatureHistory(parameters, self.connection) finally: self.connection.close()
def get(self, *args): " Webpy method receives inputs from uri " stringListFromCSV = lambda s: tuple([x.strip() for x in s.split(',')]) convertedArgs = webapi.typeConversion([ str, stringListFromCSV, str, string_to_datetime, string_to_datetime ], args) parameters = util.DotDict( zip(['product', 'versions', 'signature', 'start_date', 'end_date'], convertedArgs)) connection = self.database.connection() try: return { 'emails': self.estimate_campaign_volume(connection, parameters) } finally: connection.close()
def get(self, *args): convertedArgs = webapi.typeConversion([ str, str, u2.unquote, dtutil.string_to_datetime, dtutil.strHoursToTimeDelta, int ], args) parameters = util.DotDict( zip([ 'product', 'version', 'signature', 'endDate', 'duration', 'steps' ], convertedArgs)) parameters['productVersionCache'] = self.context['productVersionCache'] logger.debug("SignatureHistory get %s", parameters) self.connection = self.database.connection() #logger.debug('connection: %s', self.connection) try: impl = modern.SignatureHistoryModern(self.configContext) return impl.signatureHistory(parameters, self.connection) finally: self.connection.close()
def get(self, *args): convertedArgs = webapi.typeConversion( [str, str, u2.unquote, dtutil.string_to_datetime, dtutil.strHoursToTimeDelta, int], args ) parameters = util.DotDict( zip(["product", "version", "signature", "endDate", "duration", "steps"], convertedArgs) ) parameters["productVersionCache"] = self.context["productVersionCache"] logger.debug("SignatureHistory get %s", parameters) self.connection = self.database.connection() # logger.debug('connection: %s', self.connection) try: table_type = whichTCBS(self.connection.cursor(), {}, parameters["product"], parameters["version"]) impl = { "old": classic.SignatureHistoryClassic(self.configContext), "new": modern.SignatureHistoryModern(self.configContext), } return impl[table_type].signatureHistory(parameters, self.connection) finally: self.connection.close()
def get(self, *args): logger.debug('TopCrashBySignatureTrends get') convertedArgs = webapi.typeConversion([str, str, str, dtutil.string_to_datetime, dtutil.strHoursToTimeDelta, int], args) parameters = util.DotDict(zip(['product','version','crashType','endDate', 'duration', 'listSize'], convertedArgs)) logger.debug("TopCrashBySignatureTrends get %s", parameters) parameters.logger = logger parameters.productVersionCache = self.context['productVersionCache'] product = parameters['product'] version = parameters['version'] try: connection = self.database.connection() cursor = connection.cursor() table_type = whichTCBS(cursor, {}, product, version) impl = { "old": classic, "new": modern, } return impl[table_type].twoPeriodTopCrasherComparison(cursor, parameters) finally: connection.close()
def get(self, *args): convertedArgs = webapi.typeConversion([str], args) parameters = util.DotDict(zip(['orderby'], convertedArgs)) connection = self.database.connection() cursor = connection.cursor() # use the last date that we have data for as the end currentVersions = """ /* socorro.services.CurrentVersions currentVersions */ SELECT product_name, product_version_id, version_string, is_featured, start_date, end_date, build_type, throttle FROM product_info ORDER BY product_name, version_sort DESC """ cursor.execute(currentVersions) result = [] for (product, product_id, version, featured, start, end, build_type, throttle) in cursor.fetchall(): releases = { 'id': product_id, 'product': product, 'version': version, 'featured': featured, 'start_date': str(start), 'end_date': str(end), 'release': build_type, 'throttle': str(throttle) } result.append(releases) return {'currentversions': result}
def get(self, *args): convertedArgs = webapi.typeConversion( [str, str, dtutil.string_to_datetime, int, int, int], args) parameters = util.DotDict( zip(['product', 'version', 'end', 'duration', 'listsize', 'page'], convertedArgs)) connection = self.database.connection() cursor = connection.cursor() hangReportCountSql = """ /* socorro.services.HangReportCount */ SELECT count(*) FROM hang_report WHERE product = %(product)s AND version = %(version)s AND report_day >= ((%(end)s::DATE - %(duration)s)) """ logger.debug(cursor.mogrify(hangReportCountSql, parameters)) cursor.execute(hangReportCountSql, parameters) hangReportCount = cursor.fetchone()[0] listsize = parameters['listsize'] page = parameters['page'] totalPages = hangReportCount / listsize logger.debug('total pages: %s' % totalPages) parameters['offset'] = listsize * (page - 1) hangReportSql = """ /* socorro.services.HangReport */ SELECT browser_signature, plugin_signature, browser_hangid, flash_version, url, uuid, duplicates, report_day FROM hang_report WHERE product = %(product)s AND version = %(version)s AND report_day >= ((%(end)s)::DATE -%(duration)s) LIMIT %(listsize)s OFFSET %(offset)s""" logger.debug(cursor.mogrify(hangReportSql, parameters)) cursor.execute(hangReportSql, parameters) result = [] for row in cursor.fetchall(): (browser_signature, plugin_signature, browser_hangid, flash_version, url, uuid, duplicates, report_day) = row result.append({ 'browser_signature': browser_signature, 'plugin_signature': plugin_signature, 'browser_hangid': browser_hangid, 'flash_version': flash_version, 'url': url, 'uuid': uuid, 'duplicates': duplicates, 'report_day': str(report_day) }) return { 'hangReport': result, 'endDate': str(parameters['end']), 'totalPages': totalPages, 'currentPage': page, 'totalCount': hangReportCount }