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

[OSSTEST PATCH 1/3] host allocation: Prepare for further starvation check



* Add a new job pattern parameter to $starvation_q
* Add a new $thisclass parameter to starving
* Pass 0 for now.

Signed-off-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 ts-hosts-allocate-Executive | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 459b9215..9722ce12 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -162,6 +162,7 @@ END
      LEFT JOIN steps
          USING (flight,job)
          WHERE flight= ?
+           AND job LIKE ?
       GROUP BY job, jobs.status
 END
 
@@ -822,11 +823,12 @@ sub most_optimistic ($$$) {
     return $optimist->{Got};
 }
 
-sub starving ($$) {
-    my ($best_start_abs, $now) = @_;
+sub starving ($$$) {
+    my ($best_start_abs, $now, $thisclass) = @_;
     return (0, 'runvar says never give up') unless %$starvation_p;
     return (0, 'no estimate') unless defined $best_start_abs;
-    $starvation_q->execute($flight);
+    my $joblike = $thisclass ? ($job =~ s/(?:(-)|\W).*/$1\%/r) : '%';
+    $starvation_q->execute($flight, $joblike);
     my $d=0;
     my $w=0;
     my $maxfin=0;
@@ -935,7 +937,7 @@ sub attempt_allocation {
            }
        } elsif (%$starvation_p) {
            my $est_abs = most_optimistic($best, $now, $starvation_p->{I});
-           my ($starving, $m) = starving($est_abs, $now);
+           my ($starving, $m) = starving($est_abs, $now, 0);
            $starvation_q->finish();
            if (!$starving) {
                print DEBUG "not starving: $m\n";
-- 
2.20.1




 


Rackspace

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