Beispiel #1
0
 def list_services(self):
     r = {}
     for e in get_etcd_list():
         for k,v in e.find_services().items():
             if not v:
                 continue
             if not k in r:
                 r[k] = []
             r[k] += v
     return r
Beispiel #2
0
 def get_service_config(self, service):
     for e in get_etcd_list():
         host_list = None
         if QUANT_SERVICED_DEV:
             host_list = [network_utils.get_ip_address()]
         r = e.find_service(service, host_list=host_list)
         if r is not None:
             addr, attr = r
             if attr is None:
                 attr = {}
             dict_utils.set_dict_defaults(attr, type='zerorpc', name=service)
             return addr, attr
Beispiel #3
0
    def run_service(self, service, addr, run_server, attr):
        if attr:
            if not 'name' in attr:
                attr['name'] = service

            if attr.get('module'):
                pc = config_utils.load_config_from_package(attr['module'], 'config/service.yml')
                if pc:
                    d = pc['services'].get(service, {})
                    attr = dict_utils.extend(d, attr)

        for e in get_etcd_list():
            r = run_etcd_service(e, service, addr, run_server, attr)
            return r
Beispiel #4
0
 def remove_service(self, service, addr):
     for e in get_etcd_list():
         e.remove_service(service, addr)
         break
Beispiel #5
0
 def stop_service(self, service):
     for e in get_etcd_list():
         r = e.stop_service(service)
         if r:
             return r
     return False