def is_ready_to_terminate(): if not JBox.cfg['cloud_host']['scale_down']: return False num_containers = JBoxContainer.num_active( ) + JBoxContainer.num_stopped() return (num_containers == 0) and CloudHost.can_terminate( is_proposed_cluster_leader())
def do_housekeeping(): server_delete_timeout = JBox.cfg['expire'] JBoxContainer.maintain(max_timeout=server_delete_timeout, inactive_timeout=JBox.cfg['inactivity_timeout'], protected_names=JBox.cfg['protected_docknames']) if JBox.cfg['scale_down'] and (JBoxContainer.num_active() == 0) and \ (JBoxContainer.num_stopped() == 0) and CloudHelper.should_terminate(): JBox.log_info("terminating to scale down") CloudHelper.terminate_instance()
def do_housekeeping(): JBox.do_update_user_home_image() server_delete_timeout = JBox.cfg['expire'] JBoxContainer.maintain(max_timeout=server_delete_timeout, inactive_timeout=JBox.cfg['inactivity_timeout'], protected_names=JBox.cfg['protected_docknames']) if JBox.cfg['cloud_host']['scale_down'] and (JBoxContainer.num_active() == 0) and \ (JBoxContainer.num_stopped() == 0) and CloudHost.should_terminate(): JBox.log_info("terminating to scale down") try: CloudHost.deregister_instance_dns() except: CloudHost.log_error("Error deregistering instance dns") CloudHost.terminate_instance() elif is_cluster_leader(): CloudHost.log_info("I am the cluster leader") JBox.monitor_registrations() if not JBoxDynConfig.is_stat_collected_within(CloudHost.INSTALL_ID, 7): JBoxContainer.async_collect_stats()
def is_ready_to_terminate(): if not JBox.cfg['cloud_host']['scale_down']: return False num_containers = JBoxContainer.num_active() + JBoxContainer.num_stopped() return (num_containers == 0) and CloudHost.can_terminate(is_proposed_cluster_leader())