13822: Don't call list_sizes() in cloud client constructor.
[arvados.git] / services / nodemanager / arvnodeman / daemon.py
index 3147de328a9df1332edaf83e7e5d5cfd14b8caf0..0d6fdfca9a6c057c18ee6d4ea63e4cdade539a9b 100644 (file)
@@ -215,15 +215,13 @@ class NodeManagerDaemonActor(actor_class):
             if hasattr(record.cloud_node, "_nodemanager_recently_booted"):
                 self.cloud_nodes.add(record)
             else:
-                # Node disappeared from the cloud node list.  Stop the monitor
-                # actor if necessary and forget about the node.
+                # Node disappeared from the cloud node list. If it's paired,
+                # remove its idle time counter.
+                if record.arvados_node:
+                    status.tracker.idle_out(record.arvados_node.get('hostname'))
+                # Stop the monitor actor if necessary and forget about the node.
                 if record.actor:
                     try:
-                        # If it's paired and idle, stop its idle time counter
-                        # before removing the monitor actor.
-                        if record.actor.get_state().get() == 'idle':
-                            status.tracker.idle_out(
-                                record.actor.arvados_node.get()['hostname'])
                         record.actor.stop()
                     except pykka.ActorDeadError:
                         pass
@@ -400,14 +398,14 @@ class NodeManagerDaemonActor(actor_class):
             arvados_client=self._new_arvados(),
             arvados_node=arvados_node,
             cloud_client=self._new_cloud(),
-            cloud_size=self.server_calculator.find_size(cloud_size.id)).proxy()
-        self.booting[new_setup.actor_ref.actor_urn] = new_setup
-        self.sizes_booting[new_setup.actor_ref.actor_urn] = cloud_size
+            cloud_size=self.server_calculator.find_size(cloud_size.id))
+        self.booting[new_setup.actor_urn] = new_setup.proxy()
+        self.sizes_booting[new_setup.actor_urn] = cloud_size
 
         if arvados_node is not None:
             self.arvados_nodes[arvados_node['uuid']].assignment_time = (
                 time.time())
-        new_setup.subscribe(self._later.node_setup_finished)
+        new_setup.tell_proxy().subscribe(self._later.node_setup_finished)
         if nodes_wanted > 1:
             self._later.start_node(cloud_size)