Fix off-by-one error in Node Manager server calculations.
authorBrett Smith <brett@curoverse.com>
Tue, 28 Oct 2014 17:32:05 +0000 (13:32 -0400)
committerBrett Smith <brett@curoverse.com>
Tue, 28 Oct 2014 17:32:05 +0000 (13:32 -0400)
This bug prevented Node Manager from starting nodes for a job that
requested a number of nodes equal to the daemon's max_nodes setting.
No issue #.

services/nodemanager/arvnodeman/jobqueue.py
services/nodemanager/tests/test_jobqueue.py

index 0eb5b79e78b7dccbafc109c0ee3d5cc6cd2643ec..59659fec0e18d360a0c7143ce89172a1922a4255 100644 (file)
@@ -75,7 +75,7 @@ class ServerCalculator(object):
                 if job['uuid'] not in self.logged_jobs:
                     self.logged_jobs.add(job['uuid'])
                     self.logger.debug("job %s not satisfiable", job['uuid'])
-            elif (want_count < self.max_nodes):
+            elif (want_count <= self.max_nodes):
                 servers.extend([cloud_size.real] * max(1, want_count))
         self.logged_jobs.intersection_update(seen_jobs)
         return servers
index 0a4d136d402cbfa7e022a25ad98bc300a5c640ce..158a3fd08b3da1456bf050bbe7b2bbe3299f88b7 100644 (file)
@@ -48,6 +48,11 @@ class ServerCalculatorTestCase(unittest.TestCase):
                                   {'min_scratch_mb_per_node': 200})
         self.assertEqual(6, len(servlist))
 
+    def test_job_requesting_max_nodes_accepted(self):
+        servcalc = self.make_calculator([1], max_nodes=4)
+        servlist = self.calculate(servcalc, {'min_nodes': 4})
+        self.assertEqual(4, len(servlist))
+
 
 class JobQueueMonitorActorTestCase(testutil.RemotePollLoopActorTestMixin,
                                    unittest.TestCase):