def _register_processer(self, service_name, mux_processor):
        """
        Registers processor
        """

        if service_name == "Host":
            _processor = Host.Processor(self._hostHandler)

        if service_name == "RootScheduler":
            _processor = RootScheduler.Processor(self._rootSchedulerHandler)

        if service_name == "AgentControl":
            _processor = AgentControl.Processor(AgentControlHandler())

        if service_name == "Scheduler":
            _processor = Scheduler.Processor(self._leafSchedulerHandler)

        mux_processor.registerProcessor(service_name, _processor)
Beispiel #2
0
    def _initialize_thrift_service(self):
        """
        Initialize agents' thrif servers.
        """

        for host_handler in self._hosts_handlers:
            pseudo_config = host_handler.pseudo_config

            mux_processor = TMultiplexedProcessor()
            processor = Host.Processor(host_handler)

            mux_processor.registerProcessor("Host", processor,
                                            pseudo_config.host_service_threads,
                                            0)

            transport = TSocket.TServerSocket(pseudo_config.hostname,
                                              pseudo_config.host_port)

            protocol_factory = TCompactProtocol.TCompactProtocolFactory()

            server = TNonblockingServer(mux_processor, transport,
                                        protocol_factory, protocol_factory)

            self._servers.append(server)