h2o-py/h2o/backend/cluster.py
def show_status(self, detailed=False):
        """
        Print current cluster status information.

        :param detailed: if True, then also print detailed information about each node.
        """
        if self._retrieved_at + self.REFRESH_INTERVAL < time.time():
            # Info is stale, need to refresh
            new_info = h2o.api("GET /3/Cloud")
            self._fill_from_h2ocluster(new_info)
        ncpus = sum(node["num_cpus"] for node in self.nodes)
        allowed_cpus = sum(node["cpus_allowed"] for node in self.nodes)
        free_mem = sum(node["free_mem"] for node in self.nodes)
        unhealthy_nodes = sum(not node["healthy"] for node in self.nodes)
        status = "locked" if self.locked else "accepting new members"
        if unhealthy_nodes == 0:
            status += ", healthy"
        else:
            status += ", %d nodes are not healthy" % unhealthy_nodes
        api_extensions = self.list_api_extensions()
        H2ODisplay([
            ["H2O cluster uptime:",        get_human_readable_time(self.cloud_uptime_millis)],
            ["H2O cluster timezone:",      self.cloud_internal_timezone],
            ["H2O data parsing timezone:", self.datafile_parser_timezone],
            ["H2O cluster version:",       self.version],
            ["H2O cluster version age:",   "{} {}".format(self.build_age, ("!!!" if self.build_too_old else ""))],
            ["H2O cluster name:",          self.cloud_name],
            ["H2O cluster total nodes:",   self.cloud_size],
            ["H2O cluster free memory:",   get_human_readable_bytes(free_mem)],
            ["H2O cluster total cores:",   str(ncpus)],
            ["H2O cluster allowed cores:", str(allowed_cpus)],
            ["H2O cluster status:",        status],
            ["H2O connection url:",        h2o.connection().base_url],
            ["H2O connection proxy:",      h2o.connection().proxy],
            ["H2O internal security:",     self.internal_security_enabled],
            ["H2O API Extensions:",        ', '.join(api_extensions)],
            ["Python version:",            "%d.%d.%d %s" % tuple(sys.version_info[:4])],
        ])

        if detailed:
            keys = ["h2o", "healthy", "last_ping", "num_cpus", "sys_load", "mem_value_size", "free_mem", "pojo_mem",
                    "swap_mem", "free_disk", "max_disk", "pid", "num_keys", "tcps_active", "open_fds", "rpcs_active"]
            header = ["Nodes info:"] + ["Node %d" % (i + 1) for i in range(len(self.nodes))]
            table = [[k] for k in keys]
            for node in self.nodes:
                for i, k in enumerate(keys):
                    table[i].append(node[k])
            H2ODisplay(table=table, header=header)
def show_status(self, detailed=False):
        """
        Print current cluster status information.

        :param detailed: if True, then also print detailed information about each node.
        """
        if self._retrieved_at + self.REFRESH_INTERVAL < time.time():
            # Info is stale, need to refresh
            new_info = h2o.api("GET /3/Cloud")
            self._fill_from_h2ocluster(new_info)
        ncpus = sum(node["num_cpus"] for node in self.nodes)
        allowed_cpus = sum(node["cpus_allowed"] for node in self.nodes)
        free_mem = sum(node["free_mem"] for node in self.nodes)
        unhealthy_nodes = sum(not node["healthy"] for node in self.nodes)
        status = "locked" if self.locked else "accepting new members"
        if unhealthy_nodes == 0:
            status += ", healthy"
        else:
            status += ", %d nodes are not healthy" % unhealthy_nodes
        api_extensions = self.list_api_extensions()
        H2ODisplay([
            ["H2O cluster uptime:",        get_human_readable_time(self.cloud_uptime_millis)],
            ["H2O cluster timezone:",      self.cloud_internal_timezone],
            ["H2O data parsing timezone:", self.datafile_parser_timezone],
            ["H2O cluster version:",       self.version],
            ["H2O cluster version age:",   "{} {}".format(self.build_age, ("!!!" if self.build_too_old else ""))],
            ["H2O cluster name:",          self.cloud_name],
            ["H2O cluster total nodes:",   self.cloud_size],
            ["H2O cluster free memory:",   get_human_readable_bytes(free_mem)],
            ["H2O cluster total cores:",   str(ncpus)],
            ["H2O cluster allowed cores:", str(allowed_cpus)],
            ["H2O cluster status:",        status],
            ["H2O connection url:",        h2o.connection().base_url],
            ["H2O connection proxy:",      h2o.connection().proxy],
            ["H2O internal security:",     self.internal_security_enabled],
            ["H2O API Extensions:",        ', '.join(api_extensions)],
            ["Python version:",            "%d.%d.%d %s" % tuple(sys.version_info[:4])],
        ])

        if detailed:
            keys = ["h2o", "healthy", "last_ping", "num_cpus", "sys_load", "mem_value_size", "free_mem", "pojo_mem",
                    "swap_mem", "free_disk", "max_disk", "pid", "num_keys", "tcps_active", "open_fds", "rpcs_active"]
            header = ["Nodes info:"] + ["Node %d" % (i + 1) for i in range(len(self.nodes))]
            table = [[k] for k in keys]
            for node in self.nodes:
                for i, k in enumerate(keys):
                    table[i].append(node[k])
            H2ODisplay(table=table, header=header)
def show_status ( self , detailed = False ) : if self . _retrieved_at + self . REFRESH_INTERVAL < time . time ( ) : # Info is stale, need to refresh new_info = h2o . api ( "GET /3/Cloud" ) self . _fill_from_h2ocluster ( new_info ) ncpus = sum ( node [ "num_cpus" ] for node in self . nodes ) allowed_cpus = sum ( node [ "cpus_allowed" ] for node in self . nodes ) free_mem = sum ( node [ "free_mem" ] for node in self . nodes ) unhealthy_nodes = sum ( not node [ "healthy" ] for node in self . nodes ) status = "locked" if self . locked else "accepting new members" if unhealthy_nodes == 0 : status += ", healthy" else : status += ", %d nodes are not healthy" % unhealthy_nodes api_extensions = self . list_api_extensions ( ) H2ODisplay ( [ [ "H2O cluster uptime:" , get_human_readable_time ( self . cloud_uptime_millis ) ] , [ "H2O cluster timezone:" , self . cloud_internal_timezone ] , [ "H2O data parsing timezone:" , self . datafile_parser_timezone ] , [ "H2O cluster version:" , self . version ] , [ "H2O cluster version age:" , "{} {}" . format ( self . build_age , ( "!!!" if self . build_too_old else "" ) ) ] , [ "H2O cluster name:" , self . cloud_name ] , [ "H2O cluster total nodes:" , self . cloud_size ] , [ "H2O cluster free memory:" , get_human_readable_bytes ( free_mem ) ] , [ "H2O cluster total cores:" , str ( ncpus ) ] , [ "H2O cluster allowed cores:" , str ( allowed_cpus ) ] , [ "H2O cluster status:" , status ] , [ "H2O connection url:" , h2o . connection ( ) . base_url ] , [ "H2O connection proxy:" , h2o . connection ( ) . proxy ] , [ "H2O internal security:" , self . internal_security_enabled ] , [ "H2O API Extensions:" , ', ' . join ( api_extensions ) ] , [ "Python version:" , "%d.%d.%d %s" % tuple ( sys . version_info [ : 4 ] ) ] , ] ) if detailed : keys = [ "h2o" , "healthy" , "last_ping" , "num_cpus" , "sys_load" , "mem_value_size" , "free_mem" , "pojo_mem" , "swap_mem" , "free_disk" , "max_disk" , "pid" , "num_keys" , "tcps_active" , "open_fds" , "rpcs_active" ] header = [ "Nodes info:" ] + [ "Node %d" % ( i + 1 ) for i in range ( len ( self . nodes ) ) ] table = [ [ k ] for k in keys ] for node in self . nodes : for i , k in enumerate ( keys ) : table [ i ] . append ( node [ k ] ) H2ODisplay ( table = table , header = header )
Print current cluster status information.

        :param detailed: if True, then also print detailed information about each node.
Print current cluster status information .