diff mbox series

[OSSTEST,11/13] sg-report-host-history: Move job runvars query later

Message ID 20191108185001.3319-12-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up and restore host history | expand

Commit Message

Ian Jackson Nov. 8, 2019, 6:49 p.m. UTC
This query is just used for the power methods.  Put it near there.
Also, indent it in a `do' block.  These changes will make the next
change easier to read.

No functional change.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 sg-report-host-history | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/sg-report-host-history b/sg-report-host-history
index e67c7346..7c2116d3 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -332,11 +332,6 @@  END
 	my $ir = jobquery($infoq, $jr, 'i');
 	my $ar = jobquery($allocdq, $jr, 'a');
 	my $ident = $jr->{name};
-	$jrunvarq->execute($jr->{flight}, $jr->{job}, $ident);
-        my %runvars;
-        while (my ($n, $v) = $jrunvarq->fetchrow_array()) {
-            $runvars{$n} = $v;
-        }
 
 	my $altcolour = report_altcolour($alternate);
 	print H "<tr $altcolour>";
@@ -377,10 +372,18 @@  END
 	print H "<td $ri->{ColourAttr}>$ri->{Content}</td>\n";
 
 	my %powers;
-	foreach my $r (sort keys %runvars) {
-	    next unless $r =~ m{^\Q${ident}\E_power_};
-	    $powers{$'} = $runvars{$r};
-	}
+	do {
+	    $jrunvarq->execute($jr->{flight}, $jr->{job}, $ident);
+	    my %runvars;
+	    while (my ($n, $v) = $jrunvarq->fetchrow_array()) {
+		$runvars{$n} = $v;
+	    }
+
+	    foreach my $r (sort keys %runvars) {
+		next unless $r =~ m{^\Q${ident}\E_power_};
+		$powers{$'} = $runvars{$r};
+	    }
+	};
 	my $skipped = 0;
         my $any_power = 0;
         my $pr_power_colour = sub {