[ARVADOS] updated: ba9ea75ee6d6322f5d2a9da0b1c01c2738c0927d

git at public.curoverse.com git at public.curoverse.com
Mon Nov 16 17:01:14 EST 2015


Summary of changes:
 services/nodemanager/arvnodeman/config.py |  2 +-
 services/nodemanager/arvnodeman/daemon.py | 24 ++++++++++++++----------
 2 files changed, 15 insertions(+), 11 deletions(-)

       via  ba9ea75ee6d6322f5d2a9da0b1c01c2738c0927d (commit)
      from  05c4cc66de22d6c4071af69d902f8864b9f2907d (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 ba9ea75ee6d6322f5d2a9da0b1c01c2738c0927d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Nov 16 17:01:05 2015 -0500

    5353: Fixes from testing with Dummy driver.

diff --git a/services/nodemanager/arvnodeman/config.py b/services/nodemanager/arvnodeman/config.py
index 777e082..af9c8c0 100644
--- a/services/nodemanager/arvnodeman/config.py
+++ b/services/nodemanager/arvnodeman/config.py
@@ -41,7 +41,7 @@ class NodeManagerConfig(ConfigParser.SafeConfigParser):
                        'poll_time': '60',
                        'max_poll_time': '300',
                        'poll_stale_after': '600',
-                       'max_total_price': 0,
+                       'max_total_price': '0',
                        'boot_fail_after': str(sys.maxint),
                        'node_stale_after': str(60 * 60 * 2)},
             'Logging': {'file': '/dev/stderr',
diff --git a/services/nodemanager/arvnodeman/daemon.py b/services/nodemanager/arvnodeman/daemon.py
index cd967a4..884567d 100644
--- a/services/nodemanager/arvnodeman/daemon.py
+++ b/services/nodemanager/arvnodeman/daemon.py
@@ -222,7 +222,7 @@ class NodeManagerDaemonActor(actor_class):
         up += sum(1
                   for i in (self.booted, self.cloud_nodes.nodes)
                   for c in i.itervalues()
-                  if size is None or c.cloud_node.size.id == size.id)
+                  if size is None or (c.cloud_node.size and c.cloud_node.size.id == size.id))
         return up
 
     def _total_price(self):
@@ -230,22 +230,23 @@ class NodeManagerDaemonActor(actor_class):
         cost += sum(c.cloud_size.get().price
                   for c in self.booting.itervalues())
         cost += sum(c.cloud_node.size.price
-                  for i in (self.booted, self.cloud_nodes.nodes)
-                  for c in i.itervalues())
+                    for i in (self.booted, self.cloud_nodes.nodes)
+                    for c in i.itervalues()
+                    if c.cloud_node.size)
         return cost
 
     def _nodes_busy(self, size):
         return sum(1 for busy in
                    pykka.get_all(rec.actor.in_state('busy') for rec in
                                  self.cloud_nodes.nodes.itervalues()
-                                 if rec.cloud_node.size.id == size.id)
+                                 if (rec.cloud_node.size and rec.cloud_node.size.id == size.id))
                    if busy)
 
     def _nodes_missing(self, size):
         return sum(1 for arv_node in
                    pykka.get_all(rec.actor.arvados_node for rec in
                                  self.cloud_nodes.nodes.itervalues()
-                                 if rec.cloud_node.size.id == size.id and rec.actor.cloud_node.get().id not in self.shutdowns)
+                                 if rec.cloud_node.size and rec.cloud_node.size.id == size.id and 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 _size_wishlist(self, size):
@@ -263,17 +264,20 @@ class NodeManagerDaemonActor(actor_class):
 
         if over_max >= 0:
             return -over_max
-        elif self.max_total_price and ((total_price + size.price) > self.max_total_price):
-            self._logger.info("Not booting new %s (price %s) because with current total_price of %s it would exceed max_total_price of %s",
-                              size.name, size.price, total_price, self.max_total_price)
-            return 0
         elif under_min > 0 and size.id == self.min_cloud_size.id:
             return under_min
 
         up_count = self._nodes_up(size) - (self._size_shutdowns(size) +
                                            self._nodes_busy(size) +
                                            self._nodes_missing(size))
-        return self._size_wishlist(size) - up_count
+
+        wanted = self._size_wishlist(size) - up_count
+        if wanted > 0 and self.max_total_price and ((total_price + size.price) > self.max_total_price):
+                self._logger.info("Not booting %s (price %s) because with it would exceed max_total_price of %s (current total_price is %s)",
+                                  size.name, size.price, self.max_total_price, total_price)
+                return 0
+
+        return
 
     def _nodes_excess(self, size):
         up_count = self._nodes_up(size) - self._size_shutdowns(size)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list