def get(self): cs_query = db.GqlQuery( "SELECT * FROM CronjobSettings WHERE name = :1 LIMIT 1", ScanStatus.settings_name) cs = cs_query.get() if cs == None: logging.info('initializing scanner for status') cs = CronjobSettings(name=ScanStatus.settings_name, step=ScanStatus.default_step, offset=0) cs.put() bugs_query = Bug.all() bugs_query.filter('linked =', True) if cs.offset > bugs_query.count(1000000): cs_offset = 0 bugs = [] bugs = bugs_query.fetch(cs.step, cs.offset) logging.debug("Cron job updater, found " + str(bugs_query.count(1000000)) + " bugs") for bg in bugs: if bg.updateStatusPriority(): logging.debug("Updated status and/or priority for bug: '" + str(bg.key().id()) + "'") bg.put() cs.offset += cs.step cs.put()
def get(self): hospital_query = HospitalizedReport.all() total_hospital = hospital_query.count() hospital_query = HospitalizedReport.all() hospital_query.filter('processed =', False) sick_hospital = hospital_query.count() crashes_query = CrashReport.all() bugId = self.request.get('bug_id') page = int(self.request.get('page', 0)) crashes = [] if bugId: bug = Bug.get_by_id(long(bugId)) crashes_query.filter("bugKey =", bug) crashes_query.order("-crashTime") total_results = crashes_query.count(1000000) last_page = max((total_results - 1) // 20, 0) if page > last_page: page = last_page crashes = crashes_query.fetch(20, int(page)*20) template_values = {'crashes_list': crashes, 'total_results': total_results, 'page_size': 20, 'page': page, 'last_page': last_page, 'bug_id': bugId, 'total_hospital': total_hospital, 'sick_hospital': sick_hospital} path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html') self.response.out.write(template.render(path, template_values))
def post(self): post_args = self.request.arguments() bugId = self.request.get('bug_id') bug = Bug.get_by_id(long(bugId)) issues = [] if bug: if "find_issue" in post_args: # Scan for matching issue issues = bug.findIssue() elif "save_issue" in post_args: # Save the entered issue issueName = self.request.get('issue') if re.search(r"^[0-9]*$", issueName): if issueName: bug.issueName = long(issueName) bug.linked = True bug.updateStatusPriority() else: bug.issueName = None bug.linked = False bug.status = '' bug.priority = '' bug.fixed = False bug.put() logging.debug("Saving issue - value: '" + issueName + "'") else: logging.warning("Saving issue - non numeric value: '" + issueName + "'") else: logging.warning("Saving issue - not valid bug ID: '" + bugId + "'") single_result = '' if len(issues) == 1: single_result = issues[0]['id'] template_values = {'bg': bug, 'issues': issues, 'single_result': single_result} path = os.path.join(os.path.dirname(__file__), 'templates/bug_view.html') self.response.out.write(template.render(path, template_values))
def get(self): versions = Lst.get('all_version_names_list') selectedVersion = self.request.get('filter_version', '') crashes = [] crashes_query = CrashReport.all() bugId = self.request.get('bug_id') if not bugId and not selectedVersion: selectedVersion = versions[0] cacheId = "CrashReport" if selectedVersion: crashes_query.filter("versionName =", selectedVersion) if bugId: bug = Bug.get_by_id(long(bugId)) crashes_query.filter("bugKey =", bug) cacheId += bugId if not selectedVersion: versions.insert(0, '') cacheId += selectedVersion cacheId += "_counter" crashes_query.order("-crashTime") logging.info("version: " + selectedVersion) page = int(self.request.get('page', 0)) crashes = crashes_query.fetch(20, int(page)*20) template_values = {'crashes_list': crashes, 'versions_list': versions, 'filter_version': selectedVersion, 'page_size': 20, 'page': page, 'bug_id': bugId} path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html') self.response.out.write(template.render(path, template_values))
def get(self): bugId = self.request.get('bug_id') bug = Bug.get_by_id(long(bugId)) template_values = {'bg': bug} path = os.path.join(os.path.dirname(__file__), 'templates/bug_view.html') self.response.out.write(template.render(path, template_values))
def get(self): cs_query = db.GqlQuery( "SELECT * FROM CronjobSettings WHERE name = :1 LIMIT 1", ScanIssues.settings_name) cs = cs_query.get() if cs == None: logging.info('initializing scanner for issues') cs = CronjobSettings(name=ScanIssues.settings_name, step=ScanIssues.default_step, offset=0) cs.put() bugs_query = Bug.all() bugs_query.filter('linked =', False) if cs.offset > bugs_query.count(1000000): cs_offset = 0 bugs = [] bugs = bugs_query.fetch(cs.step, cs.offset) for bg in bugs: issues = bg.findIssue() if issues: bg.issueName = issues[0]['id'] logging.info("ScanIssues: Autolinking bug " + str(bg.key().id()) + " to issue " + str(bg.issueName)) bg.put() cs.offset += cs.step cs.put()
def get(self): bugs_query = Bug.all() #bugs_query.filter('issueName !=', None) bugs_query.filter('linked =', True) bugs = [] bugs = bugs_query.fetch(1000) logging.debug("Cron job updater, found " + str(bugs_query.count(1000000)) + " bugs") for bg in bugs: if bg.updateStatusPriority(): logging.debug("Updated status and/or priority for bug: '" + str(bg.key().id()) + "'") bg.put()
def get(self): bugs_query = Bug.all() bugs_query.filter('linked =', False) bugs = [] bugs = bugs_query.fetch(1000) for bg in bugs: issues = bg.findIssue() if issues: bg.issueName = issues[0]['id'] logging.info("ScanIssues: Autolinking bug " + str(bg.key().id()) + " to issue " + str(bg.issueName)) bg.put()
def get(self): versions_query = AppVersion.all() versions_query.order("-activeFrom") versions_objs = versions_query.fetch(2000) versions = [v.name for v in versions_objs] versions.insert(0, "all") selectedVersion = self.request.get('filter_version', "all") bugs = [] page = int(self.request.get('page', 0)) if selectedVersion != "all": crashes = [] bugs_map = {} crashes_query = CrashReport.all() crashes_query.filter("versionName =", selectedVersion) crashes = crashes_query.fetch(1000000) for cr in crashes: if cr.bugKey.key().id() in bugs_map: bugs_map[cr.bugKey.key().id()].count += 1 if bugs_map[cr.bugKey.key().id()].lastIncident < cr.crashTime: bugs_map[cr.bugKey.key().id()].lastIncident = cr.crashTime else: bug = cr.bugKey bug.count = 1 bug.lastIncident = cr.crashTime bugs_map[cr.bugKey.key().id()] = bug unsorted_bugs = bugs_map.values() bugs = sorted(unsorted_bugs, key=attrgetter('count'), reverse=True) total_results = len(bugs) last_page = max((total_results - 1) // 20, 0) if page > last_page: page = last_page # trim results to a single page bugs[(page+1)*20:] = [] bugs[0:page*20] = [] else: bugs_query = Bug.all() bugs_query.order("-count") total_results = bugs_query.count(1000000) last_page = max((total_results - 1) // 20, 0) if page > last_page: page = last_page bugs = bugs_query.fetch(20, int(page)*20) template_values = {'bugs_list': bugs, 'versions_list': versions, 'filter_version': selectedVersion, 'total_results': total_results, 'page_size': 20, 'page': page, 'last_page': last_page} path = os.path.join(os.path.dirname(__file__), 'templates/bug_list.html') self.response.out.write(template.render(path, template_values))
def get(self): batch = RebuildBugs.batch_size crashes_query = CrashReport.all() crashes = [] page = int(self.request.get('page', 0)) if page == 0: # Remove Bugs bugs_query = Bug.all() bugs = bugs_query.fetch(2000) for b in bugs: b.delete() total_results = crashes_query.count(1000000) last_page = max((total_results - 1) // batch, 0) if page > last_page: page = last_page logging.info("Admin ops - total_results: ", str(total_results) + ", page: " + str(page) + "/" + str(last_page)) crashes = crashes_query.fetch(batch, page * batch) valueSet = {} valueSet["unlinked"] = 0 # Main ops loop for cr in crashes: cr.bugKey = None cr.crashSignature = CrashReport.getCrashSignature(cr.report) cr.put() if cr.crashSignature == '\n': logging.warning("Can't get signature for CrashReport: " + str(cr.key().id())) valueSet["unlinked"] = valueSet["unlinked"] + 1 else: cr.signHash = hashlib.sha256(cr.crashSignature).hexdigest() cr.linkToBug() bugId = str(cr.bugKey.key().id()) if bugId in valueSet: valueSet[bugId] = valueSet[bugId] + 1 else: valueSet[bugId] = 1 template_values = { 'values': valueSet, 'page': page, 'last_page': last_page, 'page_size': batch, 'op_link': 'rebuild_bugs', 'column_key': 'BugId', 'column_value': 'Count', 'page_results': len(crashes), 'total_results': total_results} path = os.path.join(os.path.dirname(__file__), 'templates/admin_ops.html') self.response.out.write(template.render(path, template_values))
def get(self): crashes_query = CrashReport.all() bugId = self.request.get('bug_id') crashes = [] if bugId: bug = Bug.get_by_id(long(bugId)) crashes_query.filter("bugKey =", bug) crashes_query.order("-crashTime") total_results = crashes_query.count(1000000) crashes = crashes_query.fetch(total_results, 0) template_values = {'crashes_list': crashes, 'total_results': total_results, 'bug_id': bugId} path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.csv') self.response.out.write(template.render(path, template_values))
def get(self): versions_query = AppVersion.all() versions_query.order("-activeFrom") versions_objs = versions_query.fetch(2000) versions = [v.name for v in versions_objs] versions.insert(0, "all") hospital_query = HospitalizedReport.all() total_hospital = hospital_query.count() hospital_query = HospitalizedReport.all() hospital_query.filter('processed =', False) sick_hospital = hospital_query.count() crashes_query = CrashReport.all() bugId = self.request.get('bug_id') page = int(self.request.get('page', 0)) selectedVersion = self.request.get('filter_version', "all") logging.info("version: " + selectedVersion) crashes = [] if bugId: bug = Bug.get_by_id(long(bugId)) crashes_query.filter("bugKey =", bug) if selectedVersion != "all": crashes_query.filter("versionName =", selectedVersion) crashes_query.order("-crashTime") total_results = crashes_query.count(1000000) last_page = max((total_results - 1) // 20, 0) if page > last_page: page = last_page crashes = crashes_query.fetch(20, int(page)*20) template_values = {'crashes_list': crashes, 'versions_list': versions, 'filter_version': selectedVersion, 'total_results': total_results, 'page_size': 20, 'page': page, 'last_page': last_page, 'bug_id': bugId, 'total_hospital': total_hospital, 'sick_hospital': sick_hospital} path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html') self.response.out.write(template.render(path, template_values))
def get(self): bugs_query = Bug.all() page = int(self.request.get('page', 0)) bugs = [] bugs_query.order("-count") total_results = bugs_query.count(1000000) last_page = max((total_results - 1) // 20, 0) if page > last_page: page = last_page bugs = bugs_query.fetch(20, int(page)*20) template_values = {'bugs_list': bugs, 'total_results': total_results, 'page_size': 20, 'page': page, 'last_page': last_page} path = os.path.join(os.path.dirname(__file__), 'templates/bug_list.html') self.response.out.write(template.render(path, template_values))
def post(self): post_args = self.request.arguments() bugId = self.request.get('bug_id') bug = Bug.get_by_id(long(bugId)) issues = [] if bug: if "find_issue" in post_args: # Scan for matching issue issues = bug.findIssue() elif "save_issue" in post_args: # Save the entered issue issueName = self.request.get('issue') if re.search(r"^[0-9]*$", issueName): if issueName: bug.issueName = long(issueName) bug.linked = True bug.updateStatusPriority() else: bug.issueName = None bug.linked = False bug.status = '' bug.priority = '' bug.fixed = False bug.put() logging.debug("Saving issue - value: '" + issueName + "'") else: logging.warning("Saving issue - non numeric value: '" + issueName + "'") else: logging.warning("Saving issue - not valid bug ID: '" + bugId + "'") single_result = '' if len(issues) == 1: single_result = issues[0]['id'] template_values = { 'bg': bug, 'issues': issues, 'single_result': single_result } path = os.path.join(os.path.dirname(__file__), 'templates/bug_view.html') self.response.out.write(template.render(path, template_values))
def get(self): cs_query = db.GqlQuery("SELECT * FROM CronjobSettings WHERE name = :1 LIMIT 1", ScanStatus.settings_name) cs = cs_query.get() if cs == None: logging.info('initializing scanner for status') cs = CronjobSettings(name = ScanStatus.settings_name, step = ScanStatus.default_step, offset = 0) cs.put() bugs_query = Bug.all() bugs_query.filter('linked =', True) if cs.offset > bugs_query.count(1000000): cs_offset = 0 bugs = [] bugs = bugs_query.fetch(cs.step, cs.offset) logging.debug("Cron job updater, found " + str(bugs_query.count(1000000)) + " bugs") for bg in bugs: if bg.updateStatusPriority(): logging.debug("Updated status and/or priority for bug: '" + str(bg.key().id()) + "'") bg.put() cs.offset += cs.step cs.put()
def get(self): cs_query = db.GqlQuery("SELECT * FROM CronjobSettings WHERE name = :1 LIMIT 1", ScanIssues.settings_name) cs = cs_query.get() if cs == None: logging.info('initializing scanner for issues') cs = CronjobSettings(name = ScanIssues.settings_name, step = ScanIssues.default_step, offset = 0) cs.put() bugs_query = Bug.all() bugs_query.filter('linked =', False) if cs.offset > bugs_query.count(1000000): cs_offset = 0 bugs = [] bugs = bugs_query.fetch(cs.step, cs.offset) for bg in bugs: issues = bg.findIssue() if issues: bg.issueName = issues[0]['id'] logging.info("ScanIssues: Autolinking bug " + str(bg.key().id()) + " to issue " + str(bg.issueName)) bg.put() cs.offset += cs.step cs.put()
def get(self): versions = Lst.get('all_version_names_list') selectedVersion = self.request.get('filter_version', '') crashes = [] crashes_query = CrashReport.all() bugId = self.request.get('bug_id') if not bugId and not selectedVersion: selectedVersion = versions[0] cacheId = "CrashReport" if selectedVersion: crashes_query.filter("versionName =", selectedVersion) if bugId: bug = Bug.get_by_id(long(bugId)) crashes_query.filter("bugKey =", bug) cacheId += bugId if not selectedVersion: versions.insert(0, '') cacheId += selectedVersion cacheId += "_counter" crashes_query.order("-crashTime") logging.info("version: " + selectedVersion) page = int(self.request.get('page', 0)) crashes = crashes_query.fetch(20, int(page) * 20) template_values = { 'crashes_list': crashes, 'versions_list': versions, 'filter_version': selectedVersion, 'page_size': 20, 'page': page, 'bug_id': bugId } path = os.path.join(os.path.dirname(__file__), 'templates/crash_list.html') self.response.out.write(template.render(path, template_values))