From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [OSSTEST PATCH 8/9] ts-hosts-allocate-Executive: Redo variation_bonus scoring Date: Fri, 14 Nov 2014 17:07:00 +0000 Message-ID: <1415984820.7113.30.camel@citrix.com> References: <1415734910-4647-1-git-send-email-ian.jackson@eu.citrix.com> <1415734910-4647-9-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 1XpKRX-0006WH-Sj for xen-devel@lists.xenproject.org; Fri, 14 Nov 2014 17:13:56 +0000 In-Reply-To: <1415734910-4647-9-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: Ian Jackson Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Tue, 2014-11-11 at 19:41 +0000, Ian Jackson wrote: > Use a logarithmic scale. Cap the bonus at 12h rather than 5d/30 = 4h. > When we have previously failed, make sure we apply a reverse bonus, > rather than a penalty. > > Signed-off-by: Ian Jackson > --- > ts-hosts-allocate-Executive | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive > index 24f78d3..590fe98 100755 > --- a/ts-hosts-allocate-Executive > +++ b/ts-hosts-allocate-Executive > @@ -537,19 +537,25 @@ sub hid_recurse ($$) { > if ($jobinfo->{recipe} =~ m/build/) { > $variation_age= 0; > $duration_for_cost= $duration + $duration_rightaway_adjust; > - } elsif ($variation_age > 5*86400) { > - $variation_age= 5*86400; > } > > + my $log_variation_age = log(1+$variation_age/86400); > + my $variation_bonus = $log_variation_age * 3600*2; > + my $max_variation_bonus = 12*86400; Isn't that 12 days, rather than the 12 hours in the commit log? Or are the units here something other than seconds? (in which case I'm v. confused by what time() returns...) > + $variation_bonus=$max_variation_bonus > + if $variation_bonus>$max_variation_bonus; > + > my $cost= $start_time > + $duration_for_cost > - ($previously_failed ==@hids ? 366*86400 : > $previously_failed_equiv==@hids ? 365*86400 : > 0) > - + ($previously_failed ? + $variation_age * 10 : - $variation_age / 30) > + + ($previously_failed || $previously_failed_equiv > + ? (-$max_variation_bonus+$variation_bonus) : -$variation_bonus) > - $share_reuse * 10000; > > print DEBUG "$dbg FINAL start=$start_time va=$variation_age". > + " variation_bonus=$variation_bonus". > " previously_failed=$previously_failed". > " previously_failed_equiv=$previously_failed_equiv cost=$cost\n"; >