Ejemplo n.º 1
0
def hot(request, *args, **kwargs):
    db = pyfaf.storage.getDatabase()
    params = dict(request.REQUEST)
    params.update(kwargs)
    form = OsAssociateComponentFilterForm(db, params)
    last_date = datetime.date.today() - datetime.timedelta(days=14)

    ids = (r[0] for r in form.get_release_selection())

    problems = query_hot_problems(db,
        flatten(ids),
        form.get_component_selection(),
        last_date)

    if "application/json" in request.META.get("HTTP_ACCEPT"):
        return HttpResponse(json.dumps(problems, cls=WebfafJSONEncoder),
                            status=200, mimetype="application/json")
    else:
        problems = paginate(problems, request)
        forward = {'problems': problems,
                   'form': form}

        return render_to_response('problems/hot.html',
                                  forward,
                                  context_instance=RequestContext(request))
Ejemplo n.º 2
0
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db,
                                 release_ids,
                                 history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]
        hot = [p for p in hot if p.type in self.ptypes]

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("problems.dashboard")
                out += "\n\n"

        lt = query_longterm_problems(db,
                                     release_ids,
                                     history=self.history_type)
        if not cmdline.include_low_quality:
            lt = [x for x in lt if x.quality >= 0]
        lt = [p for p in lt if p.type in self.ptypes]

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n\n"

        return out
Ejemplo n.º 3
0
Archivo: stats.py Proyecto: trams/faf
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = filter(lambda x: x.quality >= 0, hot)

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("webfaf.problems.views.hot")
                out += "\n\n"

        lt = query_longterm_problems(db, release_ids, history=self.history_type)
        if not cmdline.include_low_quality:
            lt = filter(lambda x: x.quality >= 0, lt)

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("webfaf.problems.views.longterm")
                out += "\n\n"

        return out
Ejemplo n.º 4
0
    def problems(self, cmdline, db, opsys, release):
        """
        Get hot/long-term problem statistics
        """

        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]
        hot = [p for p in hot if p.type in self.ptypes]

        out = ""
        if hot:
            out += "Hot problems:\n\n"
            out += self._render_problems(hot, cmdline.count, release_ids)
            out += "\n"
            if webfaf_installed():
                out += "URL: "
                out += reverse("problems.dashboard")
                out += "\n\n"

        lt = query_longterm_problems(db, release_ids, history=self.history_type)
        if not cmdline.include_low_quality:
            lt = [x for x in lt if x.quality >= 0]
        lt = [p for p in lt if p.type in self.ptypes]

        if lt:
            out += "Long-term problems:\n\n"
            out += self._render_problems(lt, cmdline.count, release_ids)
            out += "\n\n"

        return out
Ejemplo n.º 5
0
    def text_overview(self, cmdline, db, opsys, release):
        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db,
                                 release_ids,
                                 history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]

        ptypes = ""
        if len(self.ptypes) != len(problemtypes):
            ptypes = " " + ", ".join(self.ptypes)
        out = "Overview of the top {0}{1} crashes over the last {2} days:\n".format(
            cmdline.count, ptypes, num_days)

        hot = [p for p in hot if p.type in self.ptypes]

        for (rank, problem) in enumerate(hot[:cmdline.count]):
            out += "#{0} {1} - {2}x\n".format(
                rank + 1, ', '.join(problem.unique_component_names),
                problem.count)

            # Reports with bugzillas for this OpSysRelease go first
            reports = sorted(
                problem.reports,
                cmp=lambda x, y: len(
                    [b for b in x.bugs if b.opsysrelease_id in release_ids]) -
                len([b for b in y.bugs if b.opsysrelease_id in release_ids]),
                reverse=True)

            if webfaf_installed():
                for report in reports[:3]:
                    out += "{0}\n".format(
                        reverse("reports.bthash_forward",
                                bthash=report.hashes[0].hash))
                    for bug in report.bugs:
                        out += "  {0}\n".format(bug.url)
            else:
                for report in reports[:3]:
                    out += "Report BT hash: {0}\n".format(
                        report.hashes[0].hash)
            if len(problem.reports) > 3:
                out += "... and {0} more.\n".format(len(problem.reports) - 3)

            if problem.tainted:
                out += "Kernel tainted.\n"

            crash_function = problem.crash_function
            if crash_function:
                out += "Crash function: {0}\n".format(crash_function)

            affected_all = []
            for report in problem.reports:
                affected_known = [
                    (affected.build.base_package_name, affected.build.epoch,
                     affected.build.version, affected.build.release)
                    for affected in get_crashed_package_for_report(
                        db, report.id)
                ]

                affected_unknown = \
                    get_crashed_unknown_package_nevr_for_report(db, report.id)

                affected_all += affected_known + affected_unknown
            affected_all = sorted(set(affected_all),
                                  cmp=lambda a, b: cmp_evr(a[1:], b[1:]),
                                  reverse=True)

            if affected_all:
                out += "Affected builds: {0}".format(", ".join([
                    "{0}-{1}:{2}-{3}".format(n, e, v, r)
                    for (n, e, v, r) in affected_all[:5]
                ]))
                if len(problem.reports) > 5:
                    out += " and {0} more.".format(len(problem.reports) - 5)
                out += "\n"

            pfix = problem.probable_fix_for_opsysrelease_ids(release_ids)
            if len(pfix) > 0:
                out += ("Problem seems to be fixed since the release of {0}\n".
                        format(pfix))
            out += "\n"

        return out
Ejemplo n.º 6
0
    def text_overview(self, cmdline, db, opsys, release):
        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = [x for x in hot if x.quality >= 0]

        ptypes = ""
        if len(self.ptypes) != len(problemtypes):
            ptypes = " "+", ".join(self.ptypes)
        out = "Overview of the top {0}{1} crashes over the last {2} days:\n".format(
            cmdline.count, ptypes, num_days)

        hot = [p for p in hot if p.type in self.ptypes]

        for (rank, problem) in enumerate(hot[:cmdline.count]):
            out += "#{0} {1} - {2}x\n".format(
                rank+1,
                ', '.join(problem.unique_component_names),
                problem.count)

            # Reports with bugzillas for this OpSysRelease go first
            reports = sorted(problem.reports,
                             cmp=lambda x, y: len([b for b in x.bugs if b.opsysrelease_id in release_ids])
                             - len([b for b in y.bugs if b.opsysrelease_id in release_ids]), reverse=True)

            if webfaf_installed():
                for report in reports[:3]:
                    out += "{0}\n".format(reverse("reports.bthash_forward",
                                                  bthash=report.hashes[0].hash))
                    for bug in report.bugs:
                        out += "  {0}\n".format(bug.url)
            else:
                for report in reports[:3]:
                    out += "Report BT hash: {0}\n".format(report.hashes[0].hash)
            if len(problem.reports) > 3:
                out += "... and {0} more.\n".format(len(problem.reports)-3)

            if problem.tainted:
                out += "Kernel tainted.\n"

            crash_function = problem.crash_function
            if crash_function:
                out += "Crash function: {0}\n".format(crash_function)

            affected_all = []
            for report in problem.reports:
                affected_known = [
                    (affected.build.base_package_name,
                     affected.build.epoch,
                     affected.build.version,
                     affected.build.release) for affected in
                    get_crashed_package_for_report(db, report.id)]

                affected_unknown = \
                    get_crashed_unknown_package_nevr_for_report(db, report.id)

                affected_all += affected_known + affected_unknown
            affected_all = sorted(set(affected_all),
                                  cmp=lambda a, b: cmp_evr(a[1:], b[1:]),
                                  reverse=True)

            if affected_all:
                out += "Affected builds: {0}".format(", ".join(
                    ["{0}-{1}:{2}-{3}".format(n, e, v, r)
                     for (n, e, v, r) in affected_all[:5]]))
                if len(problem.reports) > 5:
                    out += " and {0} more.".format(len(problem.reports)-5)
                out += "\n"

            pfix = problem.probable_fix_for_opsysrelease_ids(release_ids)
            if pfix:
                out += ("Problem seems to be fixed since the release of {0}\n"
                        .format(pfix))
            out += "\n"

        return out
Ejemplo n.º 7
0
Archivo: stats.py Proyecto: trams/faf
    def text_overview(self, cmdline, db, opsys, release):
        release_ids = get_release_ids(db, opsys, release)

        num_days = 7
        if cmdline.last:
            num_days = int(cmdline.last)

        since = datetime.datetime.now() - datetime.timedelta(days=num_days)

        hot = query_hot_problems(db, release_ids, history=self.history_type,
                                 last_date=since)

        if not cmdline.include_low_quality:
            hot = filter(lambda x: x.quality >= 0, hot)

        out = "Overview of the top {0} crashes over the last {1} days:\n".format(
            cmdline.count, num_days)

        for (rank, problem) in enumerate(hot[:cmdline.count]):
            out += "#{0} {1} - {2}x\n".format(
                rank+1,
                ', '.join(problem.unique_component_names),
                problem.count)
            if webfaf_installed():
                for report in problem.reports:
                    out += "{0}\n".format(reverse("webfaf.reports.views.bthash_forward",
                                          args=[report.hashes[0].hash]))
            else:
                for report in problem.reports:
                    out += "Report BT hash: {0}\n".format(report.hashes[0].hash)

            if problem.tainted:
                out += "Kernel tainted.\n"

            crash_function = problem.crash_function
            if crash_function:
                out += "Crash function: {0}\n".format(crash_function)

            affected_all = []
            for report in problem.reports:
                affected_known = [
                    (affected.build.base_package_name,
                     affected.build.epoch,
                     affected.build.version,
                     affected.build.release) for affected in
                    get_crashed_package_for_report(db, report.id)]

                affected_unknown = \
                    get_crashed_unknown_package_nevr_for_report(db, report.id)

                affected_all += affected_known + affected_unknown
            affected_all = sorted(set(affected_all), cmp=lambda a, b: cmp_evr(a[1:], b[1:]))

            if affected_all:
                out += "Affected builds: {0}\n".format(", ".join(
                    ["{0}-{1}:{2}-{3}".format(n, e, v, r)
                     for (n, e, v, r) in affected_all]))

            pfix = problem.probable_fix_for_opsysrelease_ids(release_ids)
            if len(pfix) > 0:
                out += ("Problem seems to be fixed since the release of {0}\n"
                        .format(pfix))
            out += "\n"

        return out