From: Ian Jackson Date: Tue, 11 Nov 2014 19:34:07 +0000 (+0000) Subject: ts-hosts-allocate-Executive: Redo variation_bonus scoring X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8747189ade7dd260a55dad8a4b5576f1dd73955b;p=osstest.git ts-hosts-allocate-Executive: Redo variation_bonus scoring 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 --- v2: Fix cap to really be 12h not 12d. --- diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive index 24f78d3..7ffbc8c 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*3600; + $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";