From: Ian Jackson Subject: [OSSTEST PATCH 7/9] ts-hosts-allocate-Executive: Score for equivalent previous failures Date: Tue, 11 Nov 2014 19:41:48 +0000 Message-ID: <1415734910-4647-8-git-send-email-ian.jackson@eu.citrix.com> References: <1415734910-4647-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 1XoHKG-0005iz-8h for xen-devel@lists.xenproject.org; Tue, 11 Nov 2014 19:42:05 +0000 In-Reply-To: <1415734910-4647-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 Look to see whether the last run on any hosts which are equivalent to the ones we're looking at, failed. This means that when host X is failing and we are considering host Y which is equivalent to X, we give Y a selection bonus. This means that osstest will be less obsessive about sticking to the very same failing host. Signed-off-by: Ian Jackson --- ts-hosts-allocate-Executive | 45 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive index 9562a0a..24f78d3 100755 --- a/ts-hosts-allocate-Executive +++ b/ts-hosts-allocate-Executive @@ -284,6 +284,29 @@ END $findhostsq->execute("blessed-$fi->{intended}"); } + my $equivstatusq= $dbh_tests->prepare(<{restype} eq 'host') { + $equivstatusq->execute($job,$fi->{intended},$fi->{branch}, + $hid->{Ident},$candrow->{resname}); + my $esrow = $equivstatusq->fetchrow_hashref(); + $candrow->{EquivMostRecentStatus} = $esrow->{status}; + print DEBUG "$dbg EQUIV-MOST-RECENT "; + print DEBUG ("$esrow->{flight}.$esrow->{job}". + " $esrow->{val} $esrow->{status}") if $esrow; + print DEBUG ".\n"; + } + foreach my $kcomb (qw(Shared-Max-Wear Shared-Max-Tasks)) { my $kdb= $kcomb; $kdb =~ y/-A-Z/ a-z/; my $khash= $kcomb; $khash =~ y/-//d; @@ -362,6 +396,7 @@ END print DEBUG "$dbg CANDIDATE.\n"; } $findhostsq->finish(); + $equivstatusq->finish(); if (!@candidates) { if (defined $use) { @@ -455,6 +490,7 @@ sub hid_recurse ($$) { my $variation_age= 0; my $duration= undef; my $previously_failed = 0; + my $previously_failed_equiv = 0; foreach my $hid (@hids) { my $cand= $hid->{Selected}; my $recentstarted= $cand->{MostRecentStarted}; @@ -465,6 +501,8 @@ sub hid_recurse ($$) { defined($cand->{Duration}) && $cand->{Duration} >= $duration; $previously_failed++ if ($cand->{MostRecentStatus} // '') eq 'fail'; + $previously_failed_equiv++ if + ($cand->{EquivMostRecentStatus} // '') eq 'fail'; } my $duration_rightaway_adjust= 0; @@ -505,12 +543,15 @@ sub hid_recurse ($$) { my $cost= $start_time + $duration_for_cost - - $previously_failed * 366*86400 + - ($previously_failed ==@hids ? 366*86400 : + $previously_failed_equiv==@hids ? 365*86400 : + 0) + ($previously_failed ? + $variation_age * 10 : - $variation_age / 30) - $share_reuse * 10000; print DEBUG "$dbg FINAL start=$start_time va=$variation_age". - " previously_failed=$previously_failed cost=$cost\n"; + " previously_failed=$previously_failed". + " previously_failed_equiv=$previously_failed_equiv cost=$cost\n"; if (!defined $best || $cost < $best->{Cost}) { print DEBUG "$dbg FINAL BEST: ". -- 1.7.10.4