예제 #1
0
파일: interface.py 프로젝트: knoboo/knoboo
class KernelClientManager(object):

    def __init__(self, config, procman):
        self.config = config
        self.procman = procman

    def start(self):
        self.control = KernelProcessControl(self.config)
        self.control.buildProcess()
        #self.control.start()
        self.procman.addProcess(self.control)
예제 #2
0
파일: service.py 프로젝트: knoboo/knoboo
    def makeService(self, options):
        """
        Return a service collection of two services.
        The web resource tree contains the wsgi interface to django and 
        the async notebook web resources.

        The process manager service will start the kernel server. 
        The kernel server process is another twistd plugin, and needs a 
        few options passed to it.  
        """
        desktop_service = service.MultiService()

        nbSessionManager = SessionManager(options)
        web_resource = webResourceFactory(nbSessionManager)
        web_resource_factory = server.Site(web_resource)

        tcp_server = internet.TCPServer(options['port'],
                                    web_resource_factory,
                                    interface='localhost')
        tcp_server.setServiceParent(desktop_service)


        ##########################
        #XXX Hack Time. Fix This!!
        #
        class Config(object):
            kernel = {}
            database = {}
            server = {}

        kernel_config = Config()
        kernel_config.kernel["kernel_path"] = os.path.abspath(".")
        kernel_config.kernel["kernel_host"] = "localhost"
        kernel_config.kernel["kernel_port"] = 8337

        kernel_process_control = KernelProcessControl(kernel_config)
        kernel_process_control.buildProcess()
        #
        ##########################

        procman = ProcessManager()
        procman.addProcess(kernel_process_control)
        procman.setServiceParent(desktop_service)

        return desktop_service
예제 #3
0
파일: interface.py 프로젝트: knoboo/knoboo
 def start(self):
     self.control = KernelProcessControl(self.config)
     self.control.buildProcess()
     #self.control.start()
     self.procman.addProcess(self.control)