From: Ian Jackson Subject: Re: [OSSTEST PATCH 7/9] ts-hosts-allocate-Executive: Score for equivalent previous failures Date: Fri, 14 Nov 2014 17:10:57 +0000 Message-ID: <21606.14241.299779.475425@mariner.uk.xensource.com> References: <1415734910-4647-1-git-send-email-ian.jackson@eu.citrix.com> <1415734910-4647-8-git-send-email-ian.jackson@eu.citrix.com> <1415984388.7113.28.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XpKTY-0006lJ-GX for xen-devel@lists.xenproject.org; Fri, 14 Nov 2014 17:16:00 +0000 In-Reply-To: <1415984388.7113.28.camel@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: Ian Campbell Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [OSSTEST PATCH 7/9] ts-hosts-allocate-Executive: Score for equivalent previous failures"): > On Tue, 2014-11-11 at 19:41 +0000, Ian Jackson wrote: > > + if ($candrow->{restype} eq 'host') { > > + $equivstatusq->execute($job,$fi->{intended},$fi->{branch}, > > + $hid->{Ident},$candrow->{resname}); > > + my $esrow = $equivstatusq->fetchrow_hashref(); > > For the first flight on a new branch (or perhaps a new blessing), this > will return an undef, because there is no previous flight to match, > won't it? Yes. > http://search.cpan.org/~timb/DBI-1.632/DBI.pm#fetchrow_hashref says if > you get an undef you should check $equivstatusq->err to see if that was > due to an error vs. empty result set. Not sure if you'll care given this > is all heuristics though. We turn on the automatic error trapping during db setup, so errors helpfully turn into die. > > + $candrow->{EquivMostRecentStatus} = $esrow->{status}; > > Meaning this will fail, or perhaps just produce a warning. $ perl -MData::Dumper -we 'use strict; my $y; print Dumper($y->{foo});' $VAR1 = undef; $ > > + print DEBUG "$dbg EQUIV-MOST-RECENT "; > > + print DEBUG ("$esrow->{flight}.$esrow->{job}". > > + " $esrow->{val} $esrow->{status}") if $esrow; > > + print DEBUG ".\n"; > > And so will these? if $esrow; > > @@ -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) > > You've dropped the behaviour of multiplying 366*86400 by > $previously_failed, was that intentional? Yes. $previously_failed was the number of candidate hosts which had previous failures. Making the offset proportional to the number of hosts in the test is daft. > I think you've also gone to giving a bonus at all only if all @hids > previously failed, instead of just at least one of them. Yes. Should I write this better in the commit message ? Ian.