[ARVADOS] updated: 2e919859109fe27d552b81b13d47aed61e80eca6
git at public.curoverse.com
git at public.curoverse.com
Thu Oct 1 09:05:12 EDT 2015
Summary of changes:
services/nodemanager/arvnodeman/computenode/__init__.py | 5 ++++-
services/nodemanager/arvnodeman/daemon.py | 3 ++-
services/nodemanager/tests/test_daemon.py | 17 +++++++++++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
via 2e919859109fe27d552b81b13d47aed61e80eca6 (commit)
from be81c03a3c26f365eba35b91e4f0827244a02ef7 (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 2e919859109fe27d552b81b13d47aed61e80eca6
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Sep 30 17:16:09 2015 -0400
7286: Fix double count of missing nodes in shutdown
diff --git a/services/nodemanager/arvnodeman/computenode/__init__.py b/services/nodemanager/arvnodeman/computenode/__init__.py
index b47866d..e7bd7bf 100644
--- a/services/nodemanager/arvnodeman/computenode/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/__init__.py
@@ -31,7 +31,10 @@ def timestamp_fresh(timestamp, fresh_time):
return (time.time() - timestamp) < fresh_time
def arvados_node_missing(arvados_node, fresh_time):
- return not timestamp_fresh(arvados_timestamp(arvados_node["last_ping_at"]), fresh_time)
+ if arvados_node["last_ping_at"] is None:
+ return None
+ else:
+ return not timestamp_fresh(arvados_timestamp(arvados_node["last_ping_at"]), fresh_time)
class ShutdownTimer(object):
"""Keep track of a cloud node's shutdown windows.
diff --git a/services/nodemanager/arvnodeman/daemon.py b/services/nodemanager/arvnodeman/daemon.py
index 6f33a3b..ddddd41 100644
--- a/services/nodemanager/arvnodeman/daemon.py
+++ b/services/nodemanager/arvnodeman/daemon.py
@@ -212,7 +212,8 @@ class NodeManagerDaemonActor(actor_class):
def _nodes_missing(self):
return sum(1 for arv_node in
pykka.get_all(rec.actor.arvados_node for rec in
- self.cloud_nodes.nodes.itervalues())
+ self.cloud_nodes.nodes.itervalues()
+ if rec.actor.cloud_node.get().id not in self.shutdowns)
if arv_node and cnode.arvados_node_missing(arv_node, self.node_stale_after))
def _nodes_wanted(self):
diff --git a/services/nodemanager/tests/test_daemon.py b/services/nodemanager/tests/test_daemon.py
index 57ea46c..0206f4c 100644
--- a/services/nodemanager/tests/test_daemon.py
+++ b/services/nodemanager/tests/test_daemon.py
@@ -148,8 +148,8 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin,
def test_excess_counts_missing(self):
size = testutil.MockSize(1)
- self.make_daemon(cloud_nodes=[testutil.cloud_node_mock(1),
- testutil.cloud_node_mock(2)],
+ cloud_nodes = [testutil.cloud_node_mock(1), testutil.cloud_node_mock(2)]
+ self.make_daemon(cloud_nodes=cloud_nodes,
arvados_nodes=[testutil.arvados_node_mock(1),
testutil.arvados_node_mock(2, last_ping_at='1970-01-01T01:02:03.04050607Z')],
want_sizes=[size])
@@ -158,6 +158,19 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin,
self.daemon.node_can_shutdown(mon_ref.proxy()).get(self.TIMEOUT)
self.assertEqual(1, self.node_shutdown.start.call_count)
+ def test_missing_shutdown_not_excess(self):
+ size = testutil.MockSize(1)
+ cloud_nodes = [testutil.cloud_node_mock(1), testutil.cloud_node_mock(2)]
+ self.make_daemon(cloud_nodes=cloud_nodes,
+ arvados_nodes=[testutil.arvados_node_mock(1),
+ testutil.arvados_node_mock(2, last_ping_at='1970-01-01T01:02:03.04050607Z')],
+ want_sizes=[size])
+ self.daemon.shutdowns.get()[cloud_nodes[1].id] = True
+ self.assertEqual(2, self.alive_monitor_count())
+ for mon_ref in self.monitor_list():
+ self.daemon.node_can_shutdown(mon_ref.proxy()).get(self.TIMEOUT)
+ self.assertEqual(0, self.node_shutdown.start.call_count)
+
def test_booting_nodes_counted(self):
cloud_node = testutil.cloud_node_mock(1)
arv_node = testutil.arvados_node_mock(1)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list