Exemplo n.º 1
0
def render_arcus_graph(zoo, param):
	ts_start = time.time()

	position = 20 # yaxis
	pool = graph_pool(position)

	node_zk = pool.get_node(zoo.address)
	node_zk.weight = 300
	node_zk.color = '0000FF'

	for code, cache in zoo.arcus_cache_map.items():
		node_cache = pool.get_node(code)
		node_cache.weight = 200
		node_cache.color = '00FF00'
		node_cache.link(node_zk)
		
	for code, cache in zoo.arcus_cache_map.items():
		node_cache = pool.get_node(code)

		for node in cache.active_node:
			try:
				hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
				ret = hostname.split('.')
				if len(ret) > 2:
					hostname = '%s.%s' % (ret[0], ret[1])
					
			except socket.herror:
				hostname = node.ip

			node_node = pool.get_node(hostname)
			node_node.weight = 100
			node_node.color = '00FFFF'

			if node.noport:
				node_node.link(node_cache, node.port, 'FF0000')
			else:
				node_node.link(node_cache, node.port, '00FF00')

		for node in cache.dead_node:
			try:
				hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
				ret = hostname.split('.')
				if len(ret) > 2:
					hostname = '%s.%s' % (ret[0], ret[1])
			except socket.herror:
				hostname = node.ip

			node_node = pool.get_node(hostname)
			node_node.weight = 100
			node_node.color = '303030'

			node_node.link(node_cache, node.port, 'EEEEEE')

	# set meta info
	pool.description = set_description(zoo, param)
	result = pool.render()

	ts_end = time.time()
	print('## %s elapsed: %f' % (zoo.address, ts_end - ts_start))
	return result
Exemplo n.º 2
0
def render_arcus_graph(zoo, param):
    ts_start = time.time()

    position = 20  # yaxis
    pool = graph_pool(position)

    node_zk = pool.get_node(zoo.address)
    node_zk.weight = 300
    node_zk.color = '0000FF'

    for code, cache in zoo.arcus_cache_map.items():
        node_cache = pool.get_node(code)
        node_cache.weight = 200
        node_cache.color = '00FF00'
        node_cache.link(node_zk)

    for code, cache in zoo.arcus_cache_map.items():
        node_cache = pool.get_node(code)

        for node in cache.active_node:
            try:
                hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
                ret = hostname.split('.')
                if len(ret) > 2:
                    hostname = '%s.%s' % (ret[0], ret[1])

            except socket.herror:
                hostname = node.ip

            node_node = pool.get_node(hostname)
            node_node.weight = 100
            node_node.color = '00FFFF'

            if node.noport:
                node_node.link(node_cache, node.port, 'FF0000')
            else:
                node_node.link(node_cache, node.port, '00FF00')

        for node in cache.dead_node:
            try:
                hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
                ret = hostname.split('.')
                if len(ret) > 2:
                    hostname = '%s.%s' % (ret[0], ret[1])
            except socket.herror:
                hostname = node.ip

            node_node = pool.get_node(hostname)
            node_node.weight = 100
            node_node.color = '303030'

            node_node.link(node_cache, node.port, 'EEEEEE')

    # set meta info
    pool.description = set_description(zoo, param)
    result = pool.render()

    ts_end = time.time()
    print('## %s elapsed: %f' % (zoo.address, ts_end - ts_start))
    return result
Exemplo n.º 3
0
def render_arc_graph(addr, cm_map):
    ts_start = time.time()

    position = 20  # yaxis
    pool = graph_pool(position)

    node_cm = pool.get_node(addr)
    node_cm.weight = 300
    node_cm.color = '0000FF'

    for cluster, pgs in cm_map.items():
        node_cluster = pool.get_node(cluster)
        node_cluster.weight = 200
        node_cluster.color = '00FF00'
        node_cluster.link(node_cm)

    for cluster, pgs in cm_map.items():
        node_cluster = pool.get_node(cluster)

        for pg in pgs:
            pgid, addr = pg.split('-')
            host, port = addr.split('/')

            node_pg = pool.get_node(host)
            node_pg.weight = 100
            node_pg.color = '00FFFF'
            node_pg.link(node_cluster, port, '00FF00')

    result = pool.render()

    ts_end = time.time()
    print('## %s elapsed: %f' % (addr, ts_end - ts_start))
    return result
Exemplo n.º 4
0
def render_arc_graph(addr, cm_map):
	ts_start = time.time()

	position = 20 # yaxis
	pool = graph_pool(position)

	node_cm = pool.get_node(addr)
	node_cm.weight = 300
	node_cm.color = '0000FF'

	for cluster, pgs in cm_map.items():
		node_cluster = pool.get_node(cluster)
		node_cluster.weight = 200
		node_cluster.color = '00FF00'
		node_cluster.link(node_cm)
		
	for cluster, pgs in cm_map.items():
		node_cluster = pool.get_node(cluster)

		for pg in pgs:
			pgid, addr = pg.split('-')
			host, port = addr.split('/')
					
			node_pg = pool.get_node(host)
			node_pg.weight = 100
			node_pg.color = '00FFFF'
			node_pg.link(node_cluster, port, '00FF00')

	result = pool.render()

	ts_end = time.time()
	print('## %s elapsed: %f' % (addr, ts_end - ts_start))
	return result
Exemplo n.º 5
0
def get_graph_data(param):
    print(param)
    name = param['graph_name']

    position = 20  # yaxis
    pool = graph_pool(position)

    root = pool.get_node('root')

    for i in range(0, 10):
        nleaf = pool.get_node('nleaf %d' % i)
        nleaf.link(root)

        for j in range(0, 5):
            leaf = pool.get_node('leaf %d/%d' % (j, i))
            leaf.link(nleaf)

    graph_data = pool.render()
    return graph_data
Exemplo n.º 6
0
def get_graph_data(param):
    print(param)
    name = param["graph_name"]

    position = 20  # yaxis
    pool = graph_pool(position)

    root = pool.get_node("root")

    for i in range(0, 10):
        nleaf = pool.get_node("nleaf %d" % i)
        nleaf.link(root)

        for j in range(0, 5):
            leaf = pool.get_node("leaf %d/%d" % (j, i))
            leaf.link(nleaf)

    graph_data = pool.render()
    return graph_data
Exemplo n.º 7
0
def arcus_graph(addr, position, results, param):
	global graph_cache

	ts_start = time.time()

	pool = graph_pool(position)

	# load zookeeper and set meta info
	zoo = common.core.get_zk_load_all(addr)

	node_zk = pool.get_node(addr)
	node_zk.weight = 300
	node_zk.color = '0000FF'

	for code, cache in zoo.arcus_cache_map.items():
		node_cache = pool.get_node(code)
		node_cache.weight = 200
		node_cache.color = '00FF00'
		node_cache.link(node_zk)
		
	for code, cache in zoo.arcus_cache_map.items():
		node_cache = pool.get_node(code)

		for node in cache.active_node:
			try:
				hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
				ret = hostname.split('.')
				if len(ret) > 2:
					hostname = '%s.%s' % (ret[0], ret[1])
					
			except socket.herror:
				hostname = node.ip

			node_node = pool.get_node(hostname)
			node_node.weight = 100
			node_node.color = '00FFFF'

			if node.noport:
				node_node.link(node_cache, node.port, 'FF0000')
			else:
				node_node.link(node_cache, node.port, '00FF00')

		for node in cache.dead_node:
			try:
				hostname, aliaslist, ipaddr = socket.gethostbyaddr(node.ip)
				ret = hostname.split('.')
				if len(ret) > 2:
					hostname = '%s.%s' % (ret[0], ret[1])
			except socket.herror:
				hostname = node.ip

			node_node = pool.get_node(hostname)
			node_node.weight = 100
			node_node.color = '303030'

			node_node.link(node_cache, node.port, 'EEEEEE')

	# set meta info
	pool.description = set_description(zoo, param)
	results[position] = pool.render()

	ts_end = time.time()
	print('## %s elapsed: %f' % (addr, ts_end - ts_start))