Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
    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()
Ejemplo n.º 3
0
	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()
Ejemplo n.º 4
0
	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()
Ejemplo n.º 5
0
	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))
Ejemplo n.º 6
0
	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))
Ejemplo n.º 7
0
	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))
Ejemplo n.º 8
0
	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()
Ejemplo n.º 9
0
	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()