Commits

Dannon Baker committed 5aca811

Toggle master exec host only when the instance has been removed. Termination happens in a separate thread, which was preventing this from originally working. Also add logging to main console output so users know when master_exec_host is toggled and can act on this.

  • Participants
  • Parent commits f3358d9

Comments (0)

Files changed (1)

File cm/util/master.py

         else:
             log.warning(
                 "SGE not running thus cannot toggle master as exec host")
+        if self.master_exec_host:
+            log.info("The master instance has been set to execute jobs.  To manually change this, use the cloudman admin panel.")
+        else:
+            log.info("The master instance has been set to *not* execute jobs.  To manually change this, use the cloudman admin panel.")
         return self.master_exec_host
 
     def get_worker_instances(self):
                      % num_terminated)
         else:
             log.info("Did not terminate any instances.")
-        # If no more workers, add master back as execution host.
-        if len(self.worker_instances) == 0 and not self.master_exec_host:
-            self.toggle_master_as_exec_host()
 
     def remove_instance(self, instance_id=''):
         """
                 self.app.manager.worker_instances.remove(self)
                 log.info(
                     "Instance '%s' removed from the internal instance list." % self.id)
+                # If this was the last worker removed, add master back as execution host.
+                if len(self.app.manager.worker_instances) == 0 and not self.app.manager.master_exec_host:
+                    self.app.manager.toggle_master_as_exec_host()
         except ValueError, e:
             log.warning("Instance '%s' no longer in instance list, the global monitor probably "
                 "picked it up and deleted it already: %s" % (self.id, e))