def nodes_manage_page_eru_nodes(request, page): node_details = file_ipc.read_details()['nodes'] nodes = [] for n in models.node.list_eru_nodes(page * 20, 20): n.detail = node_details.get('%s:%d' % (n.host, n.port)) nodes.append(n) return request.render('node/manage_eru_nodes.html', page=page, nodes=nodes)
def cluster_panel(request, cluster_id): c = models.cluster.get_by_id(cluster_id) if c is None: return base.not_found() return request.render('cluster/panel.html', cluster=c, node_details=file_ipc.read_details()['nodes'])
def node_panel(request, host, port): node = models.node.get_by_host_port(host, port) if node is None: return base.not_found() detail = {} try: detail = file_ipc.read_details()['nodes']['%s:%d' % (node.host, node.port)] except (IOError, ValueError, KeyError): pass return request.render('node/panel.html', node=node, detail=detail)
def node_panel(request, host, port): node = models.node.get_by_host_port(host, port) if node is None: return base.not_found() detail = {} try: detail = file_ipc.read_details()['nodes'][ '%s:%d' % (node.host, node.port)] except (IOError, ValueError, KeyError): pass return request.render('node/panel.html', node=node, detail=detail)
def masters_detail(host, port): node_details = file_ipc.read_details()['nodes'] result = [] masters, myself = redistrib.command.list_masters(host, port) for n in masters: r = {'host': n.host, 'port': n.port} try: r['slots_count'] = len(node_details[ '%s:%d' % (n.host, n.port)]['slots']) except KeyError: pass result.append(r) return result, myself
def node_panel(request, host, port): node = models.node.get_by_host_port(host, port) if node is None: return base.not_found() detail = {} try: detail = file_ipc.read_details()['nodes'][ '%s:%d' % (node.host, node.port)] except (IOError, ValueError, KeyError): pass return request.render( 'node/panel.html', node=node, detail=detail, max_mem_limit=NODE_MAX_MEM, stats_enabled=stats.client is not None)
def node_panel(request, host, port): node = models.node.get_by_host_port(host, port) if node is None: return base.not_found() detail = {} try: detail = file_ipc.read_details()['nodes']['%s:%d' % (node.host, node.port)] except (IOError, ValueError, KeyError): pass return request.render('node/panel.html', node=node, detail=detail, max_mem_limit=config.NODE_MAX_MEM, stats_enabled=stats.client is not None)
def cluster_panel(request, cluster_id): c = models.cluster.get_by_id(cluster_id) if c is None or len(c.nodes) == 0: return base.not_found() all_details = file_ipc.read_details() node_details = all_details['nodes'] nodes = [] for n in c.nodes: detail = node_details.get('%s:%d' % (n.host, n.port)) if detail is None: nodes.append({'host': n.host, 'port': n.port, 'stat': False}) else: nodes.append(detail) proxy_details = all_details['proxies'] for p in c.proxies: p.details = proxy_details.get('%s:%d' % (p.host, p.port), {}) return request.render('cluster/panel.html', cluster=c, nodes=nodes, eru_client=eru_utils.eru_client, plan_max_slaves=3, stats_enabled=stats.client is not None)
def index(request): nodes = nm.list_all_nodes() clusters = cl.list_all() poll_result = file_ipc.read_details() node_details = poll_result['nodes'] proxy_details = poll_result['proxies'] proxies = [] for c in clusters: for p in c.proxies: p.detail = proxy_details.get('%s:%d' % (p.host, p.port), {}) p.stat = p.detail.get('stat', True) proxies.extend(c.proxies) for n in nodes: detail = node_details.get('%s:%d' % (n.host, n.port), {}) n.node_id = detail.get('node_id') n.detail = detail n.stat = detail.get('stat', True) return request.render( 'index.html', nodes=nodes, clusters=clusters, stats_enabled=stats.client is not None)
def index(request): nodes = nm.list_all_nodes() clusters = cl.list_all() poll_result = file_ipc.read_details() node_details = poll_result['nodes'] proxy_details = poll_result['proxies'] proxies = [] for c in clusters: for p in c.proxies: p.detail = proxy_details.get('%s:%d' % (p.host, p.port), {}) p.stat = p.detail.get('stat', True) proxies.extend(c.proxies) for n in nodes: detail = node_details.get('%s:%d' % (n.host, n.port), {}) n.node_id = detail.get('node_id') n.detail = detail n.stat = detail.get('stat', True) return request.render('index.html', nodes=nodes, clusters=clusters, stats_enabled=stats.client is not None)
def polling_result(self): return file_ipc.read_details()