[ARVADOS] updated: be60ff5cedc313f32b2b9ff153f87d848bff1099
git at public.curoverse.com
git at public.curoverse.com
Tue Nov 4 13:51:12 EST 2014
Summary of changes:
services/nodemanager/arvnodeman/computenode/__init__.py | 2 ++
services/nodemanager/arvnodeman/daemon.py | 6 +++---
services/nodemanager/tests/test_daemon.py | 16 ++++++++++++++++
services/nodemanager/tests/testutil.py | 2 +-
4 files changed, 22 insertions(+), 4 deletions(-)
via be60ff5cedc313f32b2b9ff153f87d848bff1099 (commit)
from b0e6de37cd54cabecdca3c8338410d7f8e7b8ae7 (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 be60ff5cedc313f32b2b9ff153f87d848bff1099
Author: Brett Smith <brett at curoverse.com>
Date: Tue Nov 4 13:51:09 2014 -0500
4357: Fixups from code review.
diff --git a/services/nodemanager/arvnodeman/computenode/__init__.py b/services/nodemanager/arvnodeman/computenode/__init__.py
index 6e156cb..2c1ab9b 100644
--- a/services/nodemanager/arvnodeman/computenode/__init__.py
+++ b/services/nodemanager/arvnodeman/computenode/__init__.py
@@ -368,6 +368,8 @@ class ComputeNodeMonitorActor(config.actor_class):
if state == IDLE:
return True
elif state == UNKNOWN:
+ # If this is a new, unpaired node, it's eligible for
+ # shutdown--we figure there was an error during bootstrap.
return ((self.arvados_node is None) and
timestamp_fresh(self.cloud_node_start_time,
self.node_stale_after))
diff --git a/services/nodemanager/arvnodeman/daemon.py b/services/nodemanager/arvnodeman/daemon.py
index 3f42674..4b1bce3 100644
--- a/services/nodemanager/arvnodeman/daemon.py
+++ b/services/nodemanager/arvnodeman/daemon.py
@@ -187,7 +187,7 @@ class NodeManagerDaemonActor(actor_class):
self._pair_nodes(cloud_rec, arv_node)
break
- def _node_count(self):
+ def _nodes_up(self):
up = sum(len(nodelist) for nodelist in
[self.cloud_nodes, self.booted, self.booting])
return up - len(self.shutdowns)
@@ -200,10 +200,10 @@ class NodeManagerDaemonActor(actor_class):
def _nodes_wanted(self):
return min(len(self.last_wishlist) + self._nodes_busy(),
- self.max_nodes) - self._node_count()
+ self.max_nodes) - self._nodes_up()
def _nodes_excess(self):
- return self._node_count() - len(self.last_wishlist)
+ return self._nodes_up() - self._nodes_busy() - len(self.last_wishlist)
def update_server_wishlist(self, wishlist):
self._update_poll_time('server_wishlist')
diff --git a/services/nodemanager/tests/test_daemon.py b/services/nodemanager/tests/test_daemon.py
index 00955c9..5c8a0ae 100644
--- a/services/nodemanager/tests/test_daemon.py
+++ b/services/nodemanager/tests/test_daemon.py
@@ -235,6 +235,22 @@ class NodeManagerDaemonActorTestCase(testutil.ActorTestMixin,
self.stop_proxy(self.daemon)
self.assertTrue(self.node_shutdown.start.called)
+ def test_shutdown_declined_when_idle_and_job_queued(self):
+ cloud_nodes = [testutil.cloud_node_mock(n) for n in [3, 4]]
+ arv_nodes = [testutil.arvados_node_mock(3, job_uuid=True),
+ testutil.arvados_node_mock(4, job_uuid=None)]
+ self.make_daemon(cloud_nodes, arv_nodes, [testutil.MockSize(1)])
+ self.assertEqual(2, self.monitor_count())
+ for mon_ref in self.monitor_list():
+ monitor = mon_ref.proxy()
+ if monitor.cloud_node.get(self.TIMEOUT) is cloud_nodes[-1]:
+ break
+ else:
+ self.fail("monitor for idle node not found")
+ self.daemon.node_can_shutdown(monitor).get(self.TIMEOUT)
+ self.stop_proxy(self.daemon)
+ self.assertFalse(self.node_shutdown.start.called)
+
def test_clean_shutdown_waits_for_node_setup_finish(self):
new_node = self.start_node_boot()
self.daemon.shutdown().get(self.TIMEOUT)
diff --git a/services/nodemanager/tests/testutil.py b/services/nodemanager/tests/testutil.py
index 0c63db3..a1b0658 100644
--- a/services/nodemanager/tests/testutil.py
+++ b/services/nodemanager/tests/testutil.py
@@ -15,7 +15,7 @@ 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'
- node = {'uuid': 'zzzzz-yyyyy-12345abcde67890',
+ 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)),
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list