query and conversion completed

better query for summary page
we want only one status from the combination of tree,compiler and host that
has maximum age, ths query group by ensures that only 1 result from each
such combination is used  and having filers each such combination result so
that the selected row is the one with the maximum age.


i am uploading two files one corresponds to the results of original and the
other corresponds to the results of query you can compare them both
the same values are selcted

if you want to apply this query on the qriginal database containing the
130k builds u need to modify it because some ot the earlier builds are of
typr string and the recent builds are of type unicode. sent a file showing
their types named 130k and this is the reason why the query fails in this
scenario

(sqldb.py)
def summary_builds(self, result):
    self.result=result
    query = "SELECT tree,status,compiler,host FROM build GROUP BY
tree,host,compiler having max(age);"
    return self.result.execute(query)

(web/init.py)
class ViewSummaryPage(BuildFarmPage):

    def _get_counts(self):
        broken_count = defaultdict(lambda: 0)
        panic_count = defaultdict(lambda: 0)
        host_count = defaultdict(lambda: 0)

        # set up a variable to store the broken builds table's code, so we
can
        # output when we want
        broken_table = ""

        builds = self.buildfarm.get_summary_builds()

        done = set()
        for build in builds:
            *key = (build[0], build[2], build[3])*
*            if key in done:*
*                continue*
*            done.add(key)*
            host_count[build[0]]+=1
            status = BuildStatus.__deserialize__(build[1])

            if status.failed:
                broken_count[build[0]]+=1
                if "panic" in status.other_failures:
                    panic_count[build[0]]+=1
        return (host_count, broken_count, panic_count)


the code that i have submitted to you for revies i have made sure that only
unicode values are added to the database when the log files are shifted
from upload to oldrevs when daemon is run


On Tue, Jun 24, 2014 at 1:34 AM, Jelmer Vernooij <notifications@github.com>
wrote:

> In buildfarm/sqldb.py:
>
> > @@ -139,6 +139,10 @@ def distinct_builds(builds):
> >          done.add(key)
> >          yield build
> >
> > +def summary_builds(self, result):
> > +    self.result = result
> > +    return self.result.execute("SELECT tree,status FROM build GROUP BY tree,host,compiler having max(age);")
>
> See my email from this weekend - this query is nonsensical.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/jelmer/build-farm/pull/8/files#r14096826>.
>



-- 
krishna teja perannagari