7709: Suppress Ruby warnings while loading gems.
[arvados.git] / services / nodemanager / arvnodeman / nodelist.py
index 5b02fde0ceffa9f9a42118ac148474e34e7f4657..6bf1a8b4de0ff9b03215d3c739d98dea888f32f7 100644 (file)
@@ -30,7 +30,10 @@ class ArvadosNodeListMonitorActor(clientactor.RemotePollLoopActor):
         nodestates = {}
         for out in sinfo_out.splitlines():
             nodename, state = out.split(" ", 2)
-            if state in ('alloc', 'comp'):
+            if state in ('alloc', 'alloc*',
+                         'comp',  'comp*',
+                         'mix',   'mix*',
+                         'drng',  'drng*'):
                 nodestates[nodename] = 'busy'
             elif state == 'idle':
                 nodestates[nodename] = 'idle'
@@ -52,6 +55,11 @@ class CloudNodeListMonitorActor(clientactor.RemotePollLoopActor):
     nodes, and sends it to subscribers.
     """
 
+    def __init__(self, client, timer_actor, server_calc, *args, **kwargs):
+        super(CloudNodeListMonitorActor, self).__init__(
+            client, timer_actor, *args, **kwargs)
+        self._calculator = server_calc
+
     def is_common_error(self, exception):
         return self._client.is_cloud_exception(exception)
 
@@ -59,5 +67,10 @@ class CloudNodeListMonitorActor(clientactor.RemotePollLoopActor):
         return node.id
 
     def _send_request(self):
-        n = self._client.list_nodes()
-        return n
+        nodes = self._client.list_nodes()
+        for n in nodes:
+            # Replace with libcloud NodeSize object with compatible
+            # CloudSizeWrapper object which merges the size info reported from
+            # the cloud with size information from the configuration file.
+            n.size = self._calculator.find_size(n.size.id)
+        return nodes