Fixes to drone_manager behavior.
Fixed bug where a drone that a user is not allowed to access may get a
job scheduled on it anyways if all drones are over capacity.
Modified capacity computation to handle drones with the same ratio of
running-to-max processes, but different total max processes.
Signed-off-by: James Ren <jamesren@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4345 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/scheduler/drone_manager_unittest.py b/scheduler/drone_manager_unittest.py
index 161b5c5..bd078c1 100755
--- a/scheduler/drone_manager_unittest.py
+++ b/scheduler/drone_manager_unittest.py
@@ -121,6 +121,12 @@
self.assertEquals(drone.name, 1)
+ def test_choose_drone_for_execution_all_full_same_percentage_capacity(self):
+ drone = self._test_choose_drone_for_execution_helper([(5, 3), (10, 6)],
+ 1)
+ self.assertEquals(drone.name, 1)
+
+
def test_user_restrictions(self):
# this drone is restricted to a different user
self.manager._enqueue_drone(MockDrone(1, max_processes=10,
@@ -136,6 +142,22 @@
self.assertEquals(drone.name, 2)
+ def test_user_restrictions_with_full_drone(self):
+ # this drone is restricted to a different user
+ self.manager._enqueue_drone(MockDrone(1, max_processes=10,
+ allowed_users=['fakeuser']))
+ # this drone is allowed but is full
+ self.manager._enqueue_drone(MockDrone(2, active_processes=3,
+ max_processes=2,
+ allowed_users=[self._USERNAME]))
+
+ self.assertEquals(0,
+ self.manager.max_runnable_processes(self._USERNAME))
+ drone = self.manager._choose_drone_for_execution(
+ 1, username=self._USERNAME)
+ self.assertEquals(drone.name, 2)
+
+
def test_initialize(self):
results_hostname = 'results_repo'
results_install_dir = '/results/install'