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

[OSSTEST PATCH 5/7] host allocation: Memoise duration estimates


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Wed, 19 Aug 2020 17:01:41 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Aug 2020 16:02:08 +0000
  • Ironport-sdr: TjgKA2w+4zWZHVB7/rNGYO/TzivonIAnv1AH57q/2LClQrAdc2pkpqxumKLkQNCb4swea5A+Ab jqoDR+eyXj2Lc9tq5knQpCLcFPgSg+owIDrUlqXCTH10aQcvM+eoVoL7iHxG1Mk6PQ0RHuFSs/ syNgDq5OKuXr42LXXGrANQxeok91EShJeEckz/5AiIalx0lUHJ5Vq2lHh7OmfOtbyf61XvEqJk r+Hm3yD/3NAMy9NQPJjDFweT7qnwhkQ6MeOb/4zxj6c6md0deninG2mISZOzPnzMR/jixKeDYF dxU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

We look at our own branch to estimate durations.  If somehow we are
one of multiple concurrent flights on this branch with the appropriate
blessing, we don't mind not noticing the doing of our peer flights so
that if our estimates are a bit out of date.

So it is fine to use an estimate no older than our own runtime.

Right now we generate a new duration estimator during each queueing
round, because it contains a statement handle and we must disconnect
from the db while waiting.  So the internal memo table gets thrown
away each time and is useless.

To actually memoise, pass our own hash which lives as long as we do.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 Osstest/Executive.pm        | 2 +-
 ts-hosts-allocate-Executive | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm
index 50c84cc3..61a99bc3 100644
--- a/Osstest/Executive.pm
+++ b/Osstest/Executive.pm
@@ -1274,7 +1274,7 @@ END
     return sub {
         my ($job, $hostidname, $onhost, $uptoincl_testid) = @_;
 
-       my $memokey = "$job $hostidname $onhost $uptoincl_testid";
+       my $memokey = "$job $hostidname $onhost ".($uptoincl_testid//"");
        my $memo = $our_memo->{$memokey};
        return @$memo if $memo;
 
diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 4140b65c..39c66346 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -145,8 +145,10 @@ END
                      AND hostflag LIKE 'equiv-%'
 END
 
+    our %duration_memo;
     $duration_estimator= duration_estimator($fi->{branch}, $blessing,
-                                            sub { print DEBUG "@_\n"; });
+                                            sub { print DEBUG "@_\n"; },
+                                           0, \%duration_memo);
 
     $resprop_q= $dbh_tests->prepare(<<END);
             SELECT * FROM resource_properties
-- 
2.11.0




 


Rackspace

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