[ARVADOS] updated: 39af523945d304c72b43bed47129100f7e52f80d

git at public.curoverse.com git at public.curoverse.com
Wed Nov 5 09:03:22 EST 2014


Summary of changes:
 services/nodemanager/arvnodeman/computenode/__init__.py | 11 +++++++----
 services/nodemanager/tests/test_computenode.py          |  4 ++++
 2 files changed, 11 insertions(+), 4 deletions(-)

       via  39af523945d304c72b43bed47129100f7e52f80d (commit)
      from  a487f2c9c1d6202b8049e53f5f70913e266146c1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 39af523945d304c72b43bed47129100f7e52f80d
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Nov 5 09:03:08 2014 -0500

    4357: Restore "no state == no states match" behavior.

diff --git a/services/nodemanager/arvnodeman/computenode/__init__.py b/services/nodemanager/arvnodeman/computenode/__init__.py
index 1df150c..63effe9 100644
--- a/services/nodemanager/arvnodeman/computenode/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/__init__.py
@@ -349,15 +349,18 @@ class ComputeNodeMonitorActor(config.actor_class):
 
     def in_state(self, *states):
         # Return a boolean to say whether or not our Arvados node record is in
-        # one of the given states.  If the Arvados node record is unavailable
-        # or stale, return None.
+        # one of the given states.  If state information is not
+        # available--because this node has no Arvados record, the record is
+        # stale, or the record has no state information--return None.
         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')
+        if not state:
+            return None
         result = state in states
-        if result and state == 'idle':
-            result = not self.arvados_node['job_uuid']
+        if state == 'idle':
+            result = result and not self.arvados_node['job_uuid']
         return result
 
     def _shutdown_eligible(self):
diff --git a/services/nodemanager/tests/test_computenode.py b/services/nodemanager/tests/test_computenode.py
index 921a6c1..5ced5f9 100644
--- a/services/nodemanager/tests/test_computenode.py
+++ b/services/nodemanager/tests/test_computenode.py
@@ -200,6 +200,10 @@ class ComputeNodeMonitorActorTestCase(testutil.ActorTestMixin,
                 job_uuid=None, age=90000))
         self.assertIsNone(self.node_state('idle', 'alloc'))
 
+    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'))
+
     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'))

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list