예제 #1
0
        def launch_pyro_service():
            "Start the service."

            def interrupt(_unused_signum, _unused_frame):
                sys.exit()

            if self.process_name:
                my_setproctitle.setproctitle(self.process_name)

            Pyro.core.initServer()
            unregister()

            daemon = Pyro.core.Daemon()
            daemon.useNameServer(ns)
            daemon.connect(self.service, self.service_name)
            signal.signal(signal.SIGINT, interrupt)

            try: 
                daemon.requestLoop()
            finally:
                daemon.shutdown(True)
                del daemon
                try: 
                    unregister(self.service_name)
                except Exception:
                    pass
예제 #2
0
        def launch_django():
            "The Django subprocess."

            if self.process_name:
                my_setproctitle.setproctitle(self.process_name)

            sys.path.insert(0, self.settings_dir)
            os.environ["DJANGO_SETTINGS_MODULE"] = self.settings
            from django.core.management.commands import runfcgi
            cmd = runfcgi.Command()

            # XXX We should allow configuration of the options below;
            cmd.handle("host="+self.host,
                       "port="+str(self.port),
                       "method=prefork",
                       "daemonize=False",
                       "maxchildren=2",
                       "maxspare=2")