Example #1
0
	def reload_all(self):
		from upscale.utils.common import get_hosts 
		for host in get_hosts():
			print ("Reloading host {0}.".format(host.private_dns_name))
			with Tasks("tcp://{0}:10000/".format(host.private_dns_name)) as h:
				# should run async and wait for all results to finish
				h.reload()
Example #2
0
 def reload_all(self):
     from upscale.utils.common import get_hosts
     for host in get_hosts():
         print("Reloading host {0}.".format(host.private_dns_name))
         with Tasks("tcp://{0}:10000/".format(host.private_dns_name)) as h:
             # should run async and wait for all results to finish
             h.reload()
Example #3
0
def get_applications():
    session = Session()

    hosts = []

    for host in get_hosts():
        hosts.append({
            'id': host.id + '_' + host.instance_type,
            'ipaddr': host.private_ip_address
        })

    applications = {}
    namespaces = session.query(Namespace).all()
    for namespace in namespaces:
        for project in namespace.projects:
            application = {}
            application['id'] = ''.join(
                filter(lambda c: c.islower() or c.isdigit(
                ) or c == '-', namespace.name)) + '_' + ''.join(
                    filter(lambda c: c.islower() or c.isdigit() or c == '-',
                           project.name))
            application['domains'] = [
                {
                    'name':
                    config['domain'].format(project.name, namespace.name),
                    'id':
                    ''.join(
                        filter(
                            lambda c: c.islower() or c.isdigit() or c == '-',
                            config['domain'].format(project.name,
                                                    namespace.name)))
                },
            ]
            for domain in project.domains:
                application['domains'].append({
                    'name':
                    domain.name,
                    'id':
                    ''.join(
                        filter(
                            lambda c: c.islower() or c.isdigit() or c == '-',
                            domain.name))
                })
            application['containers'] = []
            application['hosts'] = hosts
            applications[application['id']] = application
    return (applications)
Example #4
0
def get_containers():
    hosts = {}
    containers = {}

    for host in get_hosts():
        p = []
        try:
            hosts[host.id] = host.private_dns_name
            print("tcp://{0}:10000/".format(host.private_dns_name))
            with Worker("tcp://{0}:10000/".format(host.private_dns_name)) as h:
                #p.append(h.get_containers())
                #containers[host.id] = h.get_containers().get(timeout=5)
                containers[host.id] = h.get_containers()

            #gevent.joinall(p)
            #containers[host.id] = h.get_containers().get(timeout=5)
        except Exception, e:
            print e
Example #5
0
def get_containers():
	hosts = {} 
	containers = {}

	for host in get_hosts():
		p = []
		try:
			hosts[host.id]=host.private_dns_name
			print ("tcp://{0}:10000/".format(host.private_dns_name))
			with Worker("tcp://{0}:10000/".format(host.private_dns_name)) as h:
				#p.append(h.get_containers())
				#containers[host.id] = h.get_containers().get(timeout=5)
				containers[host.id] = h.get_containers()

			#gevent.joinall(p)
			#containers[host.id] = h.get_containers().get(timeout=5)
		except Exception, e:
			print e
Example #6
0
def get_applications():
	session = Session()

	hosts = []
	
	for host in get_hosts():
		hosts.append({'id': host.id + '_' + host.instance_type, 'ipaddr': host.private_ip_address})

	
	applications={}
	namespaces = session.query(Namespace).all()
	for namespace in namespaces:
		for project in namespace.projects:
			application={}
			application['id'] = ''.join(filter(lambda c: c.islower() or c.isdigit() or c=='-', namespace.name)) + '_' + ''.join(filter(lambda c: c.islower() or c.isdigit() or c=='-', project.name))
			application['domains']=[{'name':config['domain'].format(project.name, namespace.name), 'id': ''.join(filter(lambda c: c.islower() or c.isdigit() or c=='-', config['domain'].format(project.name, namespace.name)))},]
			for domain in project.domains:
				application['domains'].append ({'name':domain.name, 'id': ''.join(filter(lambda c: c.islower() or c.isdigit() or c=='-', domain.name))})
			application['containers']=[]
			application['hosts']=hosts
			applications[application['id']]=application
	return (applications)