From: Ian Jackson Subject: [OSSTEST PATCH 2/2] sg-report-job-history: Show which host test ran on Date: Mon, 9 Feb 2015 18:07:13 +0000 Message-ID: <1423505233-9957-2-git-send-email-ian.jackson@eu.citrix.com> References: <1423505233-9957-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YKsk0-0003gj-9x for xen-devel@lists.xenproject.org; Mon, 09 Feb 2015 18:07:24 +0000 In-Reply-To: <1423505233-9957-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Add a column listing the host(s) used. We first find the relevant set of host runvars (with a SELECT DISTINCT) and then look up each var for each actual flight. We do the pattern-matching on runvar names in perl to avoid giving the postgresql optimiser a chance to turn this query into a full table scan of the runvars table. (A previous iteration of this patch searched, in the per-flight loop, for all runvars whose name was appropriately LIKE, with appalling performance.) Signed-off-by: Ian Jackson --- sg-report-job-history | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sg-report-job-history b/sg-report-job-history index 479e347..3e4b0ef 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -172,9 +172,34 @@ END END $flightsq->execute(@params); + my $hostsq= $dbh_tests->prepare(<execute(@params); + my @hostvarcols; + while (my ($hostvar) = $hostsq->fetchrow_array()) { + next unless $hostvar =~ m/(^|_)host$/; + push @hostvarcols, $hostvar; + } + + my $hostq= $dbh_tests->prepare(<fetchrow_hashref()) { my $ri= run_getinfo($f); + $ri->{Hosts} = [ ]; + foreach my $hostvar (@hostvarcols) { + $hostq->execute($f->{flight}, $f->{job}, $hostvar); + my ($host) = $hostq->fetchrow_array(); + push @{ $ri->{Hosts} }, ($host // "-"); + } + my %revisions; add_revisions(\%revisions, $f->{flight}, $f->{job}, ''); @@ -217,6 +242,7 @@ END print H "

$title

\n"; print H ""; print H "\n"; + print H "\n"; foreach my $c (@rev_grid_cols) { print H "\n"; } @@ -236,6 +262,8 @@ END print H "\n"; my $lastrev; + my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} }; + print H "\n"; foreach my $i (0..$#rev_grid_cols) { my $v= $r->{Revisions}[$i]; my $same= -- 1.7.10.4
flightbranchfailure", (join ", ", @hostvarcols), "".encode_entities($c)."". encode_entities($r->{Summary})."".encode_entities($hosts)."