def onJoin(self, details): """ Called when worker process has joined the node's management realm. """ yield NativeWorkerSession.onJoin(self, details, publish_ready=False) ## Jinja2 templates for Web (like WS status page et al) ## templates_dir = os.path.abspath( pkg_resources.resource_filename("crossbar", "web/templates")) if self.debug: log.msg("Using Web templates from {}".format(templates_dir)) self._templates = jinja2.Environment( loader=jinja2.FileSystemLoader(templates_dir)) ## factory for producing (per-realm) routers self.factory = CrossbarRouterFactory() ## factory for producing router sessions self.session_factory = CrossbarRouterSessionFactory(self.factory) ## map: realm ID -> RouterRealm self.realms = {} ## map: transport ID -> RouterTransport self.transports = {} ## map: link ID -> RouterLink self.links = {} ## map: component ID -> RouterComponent self.components = {} ## the procedures registered procs = [ 'get_router_realms', 'start_router_realm', 'stop_router_realm', 'get_router_components', 'start_router_component', 'stop_router_component', 'get_router_transports', 'start_router_transport', 'stop_router_transport', 'get_router_links', 'start_router_link', 'stop_router_link' ] dl = [] for proc in procs: uri = '{}.{}'.format(self._uri_prefix, proc) if self.debug: log.msg("Registering procedure '{}'".format(uri)) dl.append( self.register(getattr(self, proc), uri, options=RegisterOptions(details_arg='details', discloseCaller=True))) regs = yield DeferredList(dl) if self.debug: log.msg("RouterWorker registered {} procedures".format(len(regs))) ## NativeWorkerSession.publish_ready() yield self.publish_ready()
def onJoin(self, details): """ Called when worker process has joined the node's management realm. """ yield NativeWorkerSession.onJoin(self, details, publish_ready=False) # map: component ID -> ContainerComponent self.components = {} # the procedures registered procs = [ 'get_container_components', 'start_container_component', 'stop_container_component', 'restart_container_component' ] dl = [] for proc in procs: uri = '{}.{}'.format(self._uri_prefix, proc) if self.debug: log.msg("Registering procedure '{}'".format(uri)) dl.append(self.register(getattr(self, proc), uri, options=RegisterOptions(details_arg='details'))) regs = yield DeferredList(dl) if self.debug: log.msg("ContainerWorker registered {} procedures".format(len(regs))) # NativeWorkerSession.publish_ready() yield self.publish_ready()
def onJoin(self, details): """ Called when worker process has joined the node's management realm. """ yield NativeWorkerSession.onJoin(self, details, publish_ready=False) # map: component ID -> ContainerComponent self.components = {} # the procedures registered procs = [ 'get_container_components', 'start_container_component', 'stop_container_component', 'restart_container_component' ] dl = [] for proc in procs: uri = '{}.{}'.format(self._uri_prefix, proc) if self.debug: log.msg("Registering procedure '{}'".format(uri)) dl.append( self.register(getattr(self, proc), uri, options=RegisterOptions(details_arg='details'))) regs = yield DeferredList(dl) if self.debug: log.msg("ContainerWorker registered {} procedures".format( len(regs))) # NativeWorkerSession.publish_ready() yield self.publish_ready()
def onJoin(self, details): """ Called when worker process has joined the node's management realm. """ yield NativeWorkerSession.onJoin(self, details, publish_ready=False) # Jinja2 templates for Web (like WS status page et al) # templates_dir = os.path.abspath(pkg_resources.resource_filename("crossbar", "web/templates")) if self.debug: log.msg("Using Web templates from {}".format(templates_dir)) self._templates = jinja2.Environment(loader=jinja2.FileSystemLoader(templates_dir)) # factory for producing (per-realm) routers self.factory = CrossbarRouterFactory() # factory for producing router sessions self.session_factory = CrossbarRouterSessionFactory(self.factory) # map: realm ID -> RouterRealm self.realms = {} # map: realm URI -> realm ID self.realm_to_id = {} # map: transport ID -> RouterTransport self.transports = {} # map: link ID -> RouterLink self.links = {} # map: component ID -> RouterComponent self.components = {} # the procedures registered procs = [ 'get_router_realms', 'start_router_realm', 'stop_router_realm', 'get_router_realm_roles', 'start_router_realm_role', 'stop_router_realm_role', 'get_router_components', 'start_router_component', 'stop_router_component', 'get_router_transports', 'start_router_transport', 'stop_router_transport', 'get_router_links', 'start_router_link', 'stop_router_link' ] dl = [] for proc in procs: uri = '{}.{}'.format(self._uri_prefix, proc) if self.debug: log.msg("Registering procedure '{}'".format(uri)) dl.append(self.register(getattr(self, proc), uri, options=RegisterOptions(details_arg='details'))) regs = yield DeferredList(dl) if self.debug: log.msg("RouterWorker registered {} procedures".format(len(regs))) # NativeWorkerSession.publish_ready() yield self.publish_ready()