[ARVADOS] created: 61fd9276456c112a4e22273227b0feafed35530f

git at public.curoverse.com git at public.curoverse.com
Thu Feb 12 13:34:36 EST 2015


        at  61fd9276456c112a4e22273227b0feafed35530f (commit)


commit 61fd9276456c112a4e22273227b0feafed35530f
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 12 13:35:35 2015 -0500

    4839: Use node[crunch_worker_state], not node[info][slurm_state], to make shutdown decisions.

diff --git a/services/nodemanager/arvnodeman/computenode/dispatch/__init__.py b/services/nodemanager/arvnodeman/computenode/dispatch/__init__.py
index 48e8dcf..1608b52 100644
--- a/services/nodemanager/arvnodeman/computenode/dispatch/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/dispatch/__init__.py
@@ -288,7 +288,7 @@ class ComputeNodeMonitorActor(config.actor_class):
         if (self.arvados_node is None) or not timestamp_fresh(
               arvados_node_mtime(self.arvados_node), self.node_stale_after):
             return None
-        state = self.arvados_node['info'].get('slurm_state')
+        state = self.arvados_node['crunch_worker_state']
         if not state:
             return None
         result = state in states
diff --git a/services/nodemanager/tests/test_computenode_dispatch.py b/services/nodemanager/tests/test_computenode_dispatch.py
index a1dfde3..4a72f47 100644
--- a/services/nodemanager/tests/test_computenode_dispatch.py
+++ b/services/nodemanager/tests/test_computenode_dispatch.py
@@ -227,28 +227,29 @@ class ComputeNodeMonitorActorTestCase(testutil.ActorTestMixin,
 
     def test_in_state_when_unpaired(self):
         self.make_actor()
-        self.assertIsNone(self.node_state('idle', 'alloc'))
+        self.assertIsNone(self.node_state('idle', 'busy'))
 
     def test_in_state_when_pairing_stale(self):
         self.make_actor(arv_node=testutil.arvados_node_mock(
                 job_uuid=None, age=90000))
-        self.assertIsNone(self.node_state('idle', 'alloc'))
+        self.assertIsNone(self.node_state('idle', 'busy'))
 
     def test_in_state_when_no_state_available(self):
-        self.make_actor(arv_node=testutil.arvados_node_mock(info={}))
-        self.assertIsNone(self.node_state('idle', 'alloc'))
+        self.make_actor(arv_node=testutil.arvados_node_mock(
+                crunch_worker_state=None))
+        self.assertIsNone(self.node_state('idle', 'busy'))
 
     def test_in_idle_state(self):
         self.make_actor(2, arv_node=testutil.arvados_node_mock(job_uuid=None))
         self.assertTrue(self.node_state('idle'))
-        self.assertFalse(self.node_state('alloc'))
-        self.assertTrue(self.node_state('idle', 'alloc'))
+        self.assertFalse(self.node_state('busy'))
+        self.assertTrue(self.node_state('idle', 'busy'))
 
-    def test_in_alloc_state(self):
+    def test_in_busy_state(self):
         self.make_actor(3, arv_node=testutil.arvados_node_mock(job_uuid=True))
         self.assertFalse(self.node_state('idle'))
-        self.assertTrue(self.node_state('alloc'))
-        self.assertTrue(self.node_state('idle', 'alloc'))
+        self.assertTrue(self.node_state('busy'))
+        self.assertTrue(self.node_state('idle', 'busy'))
 
     def test_init_shutdown_scheduling(self):
         self.make_actor()
@@ -293,7 +294,8 @@ class ComputeNodeMonitorActorTestCase(testutil.ActorTestMixin,
         self.assertFalse(self.node_actor.shutdown_eligible().get(self.TIMEOUT))
 
     def test_no_shutdown_when_node_state_unknown(self):
-        self.make_actor(5, testutil.arvados_node_mock(5, info={}))
+        self.make_actor(5, testutil.arvados_node_mock(
+            5, crunch_worker_state=None))
         self.shutdowns._set_state(True, 600)
         self.assertFalse(self.node_actor.shutdown_eligible().get(self.TIMEOUT))
 
diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py
index 30808ac..f254e72 100644
--- a/services/nodemanager/tests/testutil.py
+++ b/services/nodemanager/tests/testutil.py
@@ -15,16 +15,18 @@ no_sleep = mock.patch('time.sleep', lambda n: None)
 def arvados_node_mock(node_num=99, job_uuid=None, age=0, **kwargs):
     if job_uuid is True:
         job_uuid = 'zzzzz-jjjjj-jobjobjobjobjob'
-    slurm_state = 'idle' if (job_uuid is None) else 'alloc'
+    crunch_worker_state = 'idle' if (job_uuid is None) else 'busy'
     node = {'uuid': 'zzzzz-yyyyy-{:015x}'.format(node_num),
             'created_at': '2014-01-01T01:02:03Z',
             'modified_at': time.strftime('%Y-%m-%dT%H:%M:%SZ',
                                          time.gmtime(time.time() - age)),
+            'slot_number': node_num,
             'hostname': 'compute{}'.format(node_num),
             'domain': 'zzzzz.arvadosapi.com',
             'ip_address': ip_address_mock(node_num),
             'job_uuid': job_uuid,
-            'info': {'slurm_state': slurm_state}}
+            'crunch_worker_state': crunch_worker_state,
+            'info': {}}
     node.update(kwargs)
     return node
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list