diff mbox series

[OSSTEST,2/3] host allocation: Check "job class" too

Message ID 20210607151614.14132-2-iwj@xenproject.org (mailing list archive)
State New
Headers show
Series [OSSTEST,1/3] host allocation: Prepare for further starvation check | expand

Commit Message

Ian Jackson June 7, 2021, 3:16 p.m. UTC
That is all jobs which start with the same \w* as this job.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 ts-hosts-allocate-Executive | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/ts-hosts-allocate-Executive b/ts-hosts-allocate-Executive
index 9722ce12..849bc97b 100755
--- a/ts-hosts-allocate-Executive
+++ b/ts-hosts-allocate-Executive
@@ -937,12 +937,20 @@  sub attempt_allocation {
 	    }
 	} elsif (%$starvation_p) {
 	    my $est_abs = most_optimistic($best, $now, $starvation_p->{I});
-	    my ($starving, $m) = starving($est_abs, $now, 0);
+	    my $all_starving = 1;
+	    foreach my $thisclass (qw(1 0)) {
+		my $tcdesc = $thisclass ? 'class' : 'flight';
+		my ($starving, $m) = starving($est_abs, $now, $thisclass);
+		if (!$starving) {
+		    print DEBUG "not starving ($tcdesc): $m\n";
+		    $all_starving = 0;
+		    last;
+		} else {
+		    logm "starving ($tcdesc) ($m)";
+		}
+	    }
 	    $starvation_q->finish();
-	    if (!$starving) {
-		print DEBUG "not starving: $m\n";
-	    } else {
-		logm "starving ($m)";
+	    if ($all_starving) {
 		return $alloc_starved_r;
 	    }
 	}