[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 53/60] sg-report-job-history (nfc): Refactor osstestrevs code


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2020 18:21:58 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 17:26:36 +0000
  • Ironport-sdr: 9eVFVQUT5Pv2GmxWznXw+ifds/t8RZyy80dwV4K1o/3cana6JGZQ6ZDmLhzc5EHuNORqjCyLUq lrY5Uv11696lDlw0+R5cZPnVLcQAcihCIWYpjcz3A1EUrmWEAnLfaJMRBDbm6+2aeD3mJLDhOU 0bxwCDAHdYHCGs9Iu78tDG0a8MKU1WPQhLgVC7Zx5sfw+1X3iiu3iDn1Iv9d27/g7f3xWRFUDd FNUAEDNbDE9ZjoGewFTAVIJDh4N4LGNdsu3v5gpBOYovvgfapq7jhDxP0nrdi5PMffduAYfVME NlQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Split this into (1) get the data from the db (2) process it into the
form we want.

This will make it easy to cache (1).

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 sg-report-job-history | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sg-report-job-history b/sg-report-job-history
index 39ebe024..d5e37bcd 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -260,14 +260,17 @@ END
        my $hosts = join ", ", map { $r->{Hosts}{$_} // "-" } @hostvarcols;
        my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts);
        print H "<td $hosts_colour>".encode_entities($hosts)."</td>\n";
+       my %osstestrevs;
        $osstestverq->execute($r->{Flight}{flight});
+       while (my ($harness) = $osstestverq->fetchrow_array()) {
+           $osstestrevs{$harness}++;
+       }
        my $osstestrevs = join ' ',
             map {
-               $_ = $_->{harness};
                s/^([0-9a-f]{12})[0-9a-f]+\b/$1/;
                "<kbd>".encode_entities($_)."</kbd>";
             }
-            @{ $osstestverq->fetchall_arrayref({}) };
+            sort keys %osstestrevs;
        my $osstest_colour = report_altchangecolour(\$alt_osstest, 
$osstestrevs);
        print H "<td $osstest_colour>$osstestrevs</td>\n";
        foreach my $i (0..$#rev_grid_cols) {
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.