コード例 #1
0
ファイル: d6cage.py プロジェクト: aaronorosen/congress
    def __init__(self):

        # cfgObj = ConfigObj("d6cage.ini")
        # self.config = cfgObj.dict()
        self.config = {}
        self.config['modules'] = {}
        self.config['services'] = {}
        # Dictionary mapping service name to a dict of arguments.
        # Those arguments are only passed to d6service by createservice if they
        #   are not alreay present in the ARGS argument given to createservice.
        self.default_service_args = {}

        # cageKeys = self.config["d6cage"]['keys']
        cageKeys = ['python.d6cage']
        # cageDesc = self.config["d6cage"]['description']
        cageDesc = 'deepsix python cage'
        name = "d6cage"

        deepSix.__init__(self, name, cageKeys)

        self.inbox = Queue()
        self.dataPath = Queue()

        self.table = amqprouter.routeTable()
        self.table.add("local.router", self.inbox)
        self.table.add(self.name, self.inbox)
        self.table.add("router", self.inbox)
        localname = "local." + self.name
        self.table.add(localname, self.inbox)

        self.modules = {}
        self.services = {}

        self.unloadingServices = {}
        self.reloadingServices = set()

        self.services[self.name] = {}
        self.services[self.name]['service'] = self
        self.services[self.name]['name'] = self.name
        self.services[self.name]['description'] = cageDesc
        self.services[self.name]['inbox'] = self.inbox
        self.services[self.name]['keys'] = self.keys

        self.subscribe(
            "local.d6cage",
            "routeKeys",
            callback=self.updateRoutes,
            interval=5)

        self.load_modules_from_config()
        self.load_services_from_config()
        # set of service names that we deem special
        self.system_service_names = set([self.name])
コード例 #2
0
ファイル: d6cage.py プロジェクト: ElVinto/congress
    def __init__(self):
        self.config = {}
        self.config['modules'] = {}
        self.config['services'] = {}

        # Dictionary mapping service name to a dict of arguments.
        # Those arguments are only passed to d6service by createservice if they
        #   are not alreay present in the ARGS argument given to createservice.
        self.default_service_args = {}

        cageKeys = ['python.d6cage']
        cageDesc = 'deepsix python cage'
        name = "d6cage"

        deepsix.deepSix.__init__(self, name, cageKeys)

        self.inbox = eventlet.Queue()
        self.dataPath = eventlet.Queue()

        self.table = amqprouter.routeTable()
        self.table.add("local.router", self.inbox)
        self.table.add(self.name, self.inbox)
        self.table.add("router", self.inbox)

        localname = "local." + self.name
        self.table.add(localname, self.inbox)

        self.modules = {}
        self.services = {}

        self.greenThreads = []

        self.unloadingServices = {}
        self.reloadingServices = set()

        self.services[self.name] = {}
        self.services[self.name]['service'] = self
        self.services[self.name]['name'] = self.name
        self.services[self.name]['description'] = cageDesc
        self.services[self.name]['inbox'] = self.inbox
        self.services[self.name]['keys'] = self.keys
        self.services[self.name]['type'] = None
        self.services[self.name]['id'] = None

        self.subscribe(
            "local.d6cage",
            "routeKeys",
            callback=self.updateRoutes,
            interval=5)

        self.router_greenthread = eventlet.spawn(self.router_loop)
コード例 #3
0
ファイル: d6cage.py プロジェクト: radekpospisil/congress
    def __init__(self):
        self.config = {}
        self.config['modules'] = {}
        self.config['services'] = {}

        # Dictionary mapping service name to a dict of arguments.
        # Those arguments are only passed to d6service by createservice if they
        #   are not alreay present in the ARGS argument given to createservice.
        self.default_service_args = {}

        cageKeys = ['python.d6cage']
        cageDesc = 'deepsix python cage'
        name = "d6cage"

        deepsix.deepSix.__init__(self, name, cageKeys)

        self.inbox = eventlet.Queue()
        self.dataPath = eventlet.Queue()

        self.table = amqprouter.routeTable()
        self.table.add("local.router", self.inbox)
        self.table.add(self.name, self.inbox)
        self.table.add("router", self.inbox)

        localname = "local." + self.name
        self.table.add(localname, self.inbox)

        self.modules = {}
        self.services = {}

        self.greenThreadPool = eventlet.GreenPool()
        self.greenThreads = []

        self.unloadingServices = {}
        self.reloadingServices = set()

        self.services[self.name] = {}
        self.services[self.name]['service'] = self
        self.services[self.name]['name'] = self.name
        self.services[self.name]['description'] = cageDesc
        self.services[self.name]['inbox'] = self.inbox
        self.services[self.name]['keys'] = self.keys
        self.services[self.name]['type'] = None
        self.services[self.name]['id'] = None

        self.subscribe(
            "local.d6cage",
            "routeKeys",
            callback=self.updateRoutes,
            interval=5)