コード例 #1
0
def run():
    global application, stop_application  #pragma: no cover
    app.startApplication(application, None)  #pragma: no cover
    if stop_application:
        stop_application.addCallback(
            lambda x: reactor.stop())  #pragma: no cover
    reactor.run()  #pragma: no cover
コード例 #2
0
ファイル: script.py プロジェクト: huangpanxx/POAS
def execute(config_file):
    global config
    config = _get_config(config_file)
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run() #@UndefinedVariable
コード例 #3
0
ファイル: siptrackd.py プロジェクト: nesanton/siptrackd
def siptrackd_twisted_init(object_store, application):
    log.msg('Loading object store, this might take a while')
    yield object_store.init()
    log.msg('Object store loading complete')
    log.msg('Starting rpc listener')
    app.startApplication(application, False)
    log.msg('Running')
コード例 #4
0
    def startApplication(self, application):
        """
        Configure global process state based on the given application and run
        the application.

        @param application: An object which can be adapted to
            L{service.IProcess} and L{service.IService}.
        """
        process = service.IProcess(application)
        if not self.config['originalname']:
            launchWithName(process.processName)
        self.setupEnvironment(self.config['chroot'], self.config['rundir'],
                              self.config['nodaemon'], self.config['umask'],
                              self.config['pidfile'])

        service.IService(application).privilegedStartService()

        uid, gid = self.config['uid'], self.config['gid']
        if uid is None:
            uid = process.uid
        if gid is None:
            gid = process.gid
        if uid is not None and gid is None:
            gid = pwd.getpwuid(uid).pw_gid

        self.shedPrivileges(self.config['euid'], uid, gid)
        app.startApplication(application, not self.config['no_save'])
コード例 #5
0
ファイル: siptrackd.py プロジェクト: sii/siptrackd
def siptrackd_twisted_init(object_store, application):
    log.msg('Loading object store, this might take a while')
    yield object_store.init()
    log.msg('Object store loading complete')
    log.msg('Starting rpc listener')
    app.startApplication(application, False)
    log.msg('Running')
コード例 #6
0
ファイル: service.py プロジェクト: UfSoft/afm
def daemon():
    from twisted.internet import glib2reactor
    glib2reactor.install()
    from twisted.internet import reactor

    main_app = Application("Audio Failure Monitor") #, uid, gid)

    services = IServiceCollection(main_app)
    options = DaemonOptions()
    options.parseOptions()

    application = options.getService()
    application.infotub.setServiceParent(services)
    application.coretub.setServiceParent(services)

    app.startApplication(main_app, False)

    reactor.addSystemEventTrigger('before', 'shutdown',
                                  logging.getLogger(__name__).info,
                                  'Stopping AFM')

    logging.getLogger(__name__).info("AFM Started")
    try:
        reactor.run()
    except KeyboardInterrupt:
        reactor.stop()
コード例 #7
0
ファイル: _twistd_unix.py プロジェクト: anrysev/twisted
    def startApplication(self, application):
        """
        Configure global process state based on the given application and run
        the application.

        @param application: An object which can be adapted to
            L{service.IProcess} and L{service.IService}.
        """
        process = service.IProcess(application)
        if not self.config['originalname']:
            launchWithName(process.processName)
        self.setupEnvironment(
            self.config['chroot'], self.config['rundir'],
            self.config['nodaemon'], self.config['umask'],
            self.config['pidfile'])

        service.IService(application).privilegedStartService()

        uid, gid = self.config['uid'], self.config['gid']
        if uid is None:
            uid = process.uid
        if gid is None:
            gid = process.gid

        self.shedPrivileges(self.config['euid'], uid, gid)
        app.startApplication(application, not self.config['no_save'])
コード例 #8
0
ファイル: run_xmppserver.py プロジェクト: HoverHell/xmppforum
 def handle_noargs(self, *args, **options):
     ## ! XXX: `from django.utils import autoreload`?  Might put it into
     ## xmppface or xmppwoker
     from xmppface.s2scfg import cfg_override
     from xmppface.s2sbase import setup_twisted_app
     application = setup_twisted_app(cfg_override(settings))
     startApplication(application, False)
     reactor.run()
コード例 #9
0
ファイル: script.py プロジェクト: AllenCHM/scrapyd
def execute():
    try:
        config = _get_config()
    except NotConfigured:
        config = None
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
コード例 #10
0
 def postApplication(self):
     """
     Start the application and run the reactor.
     """
     service.IService(self.application).privilegedStartService()
     app.startApplication(self.application, not self.config['no_save'])
     app.startApplication(internet.TimerService(0.1, lambda:None), 0)
     self.startReactor(None, self.oldstdout, self.oldstderr)
     log.msg("Server Shut Down.")
コード例 #11
0
ファイル: script.py プロジェクト: zanachka/scrapydartx
def execute():
    try:
        config = _get_config()
    except NotConfigured:
        config = None
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
コード例 #12
0
ファイル: runner.py プロジェクト: hellais/GLBackend
 def runApp(res):
     """
     Start the actual service Application.
     """
     log.debug("[D] %s %s " % (__file__, __name__), "Class GLBaseRunner", "preApplication", "runApp")
     service.IService(self.application).privilegedStartService()
     app.startApplication(self.application, not self.config['no_save'])
     app.startApplication(internet.TimerService(0.1, lambda:None), 0)
     startAsynchronous()
コード例 #13
0
    def SvcDoRun(self):
        win32evtlogutil.AddSourceToRegistry(self._svc_name_,
                                            servicemanager.__file__)

        # Write a 'started' event to the event log...
        win32evtlogutil.ReportEvent(
            self._svc_name_,
            servicemanager.PYS_SERVICE_STARTED,
            0,  # category
            servicemanager.EVENTLOG_INFORMATION_TYPE,
            (self._svc_name_, ""),
        )

        try:
            return_code = self.run_connectivity_tool()
            if return_code != 0:
                # raise Exception("Authentication Proxy Configuration has an error.")

                # We're choosing not to prevent auth proxy startup if there are
                # config errors for now, but once the configuration validation
                # proves to be stable we can go back to preventing startup.
                message = ("Your configuration is not valid. Check the output "
                           "at {conn_tool_logs} for errors.".format(
                               conn_tool_logs=self.conn_tool_logs))
                self.log_error_during_startup(message)

            application = duoauthproxy.proxy.create_application()
            app.startApplication(application, 0)
            reactor.run(installSignalHandlers=0)
        except Exception:
            # service did not shut down cleanly
            message = traceback.format_exc()
            win32evtlogutil.ReportEvent(
                self._svc_name_,
                servicemanager.PYS_SERVICE_STOPPED,
                0,  # category
                servicemanager.EVENTLOG_ERROR_TYPE,
                (
                    self._svc_name_,
                    " due to a failure:\n\n%s\n"
                    "We could not start your Authentication Proxy due to an error. Likely this is a configuration error. To view the error output check the logs located at %s \n"
                    "After fixing the errors you can run a test of your configuration using our validator located at %s"
                    % (message, self.conn_tool_logs, self.conn_tool_path),
                ),
            )
        else:
            # service shut down cleanly
            win32evtlogutil.ReportEvent(
                self._svc_name_,
                servicemanager.PYS_SERVICE_STOPPED,
                0,  # category
                servicemanager.EVENTLOG_INFORMATION_TYPE,
                (self._svc_name_, ""),
            )

        win32event.SetEvent(self.hWaitStop)
コード例 #14
0
ファイル: _twistw.py プロジェクト: adde88/python2.7_mana
 def postApplication(self):
     """
     Start the application and run the reactor.
     """
     service.IService(self.application).privilegedStartService()
     app.startApplication(self.application, not self.config['no_save'])
     app.startApplication(internet.TimerService(0.1, lambda: None), 0)
     app.runReactorWithLogging(self.config, self.oldstdout, self.oldstderr)
     app.reportProfile(self.config['report-profile'],
                       service.IProcess(self.application).processName)
     log.msg("Server Shut Down.")
コード例 #15
0
 def postApplication(self):
     """
     Start the application and run the reactor.
     """
     service.IService(self.application).privilegedStartService()
     app.startApplication(self.application, not self.config['no_save'])
     app.startApplication(internet.TimerService(0.1, lambda:None), 0)
     app.runReactorWithLogging(self.config, self.oldstdout, self.oldstderr)
     app.reportProfile(self.config['report-profile'],
                       service.IProcess(self.application).processName)
     log.msg("Server Shut Down.")
コード例 #16
0
ファイル: pokerserver.py プロジェクト: stephica/poker-network
def run():
    if platform.system() != "Windows":
        if not sys.modules.has_key('twisted.internet.reactor'):
            print "installing epoll reactor"
            from twisted.internet import epollreactor
            epollreactor.install()
        else:
            print "reactor already installed"
    from twisted.internet import reactor
    application = makeApplication(sys.argv)
    app.startApplication(application, None)
    reactor.run()
コード例 #17
0
def run():
    if platform.system() != "Windows":
        if not sys.modules.has_key('twisted.internet.reactor'):
                print "installing poll reactor"
                pollreactor.install()
        else:
                print "poll reactor already installed"
    from twisted.internet import reactor
    application = makeApplication(sys.argv)
    app.startApplication(application, None)
    from twisted.internet import pollreactor
    reactor.run()
コード例 #18
0
 def start(self, portno=None):
     import sys
     lfname = self['logfile']
     if lfname == '-':
         lf = sys.stdout
     else:
         lf = file(os.path.expanduser(lfname), 'ab+')
     log.startLogging(lf, setStdout=False)
     srv = self.getService()
     from twisted.application.app import startApplication
     startApplication(srv, False)
     reactor.run()
コード例 #19
0
ファイル: pokerserver.py プロジェクト: Usr-X/poker-network
def run():
    twisted_log.startLogging(sys.stdout)
    if platform.system() != "Windows":
        if 'twisted.internet.reactor' not in sys.modules:
            log.debug("installing epoll reactor")
            from twisted.internet import epollreactor
            epollreactor.install()
        else:
            log.debug("reactor already installed")
    from twisted.internet import reactor
    application = makeApplication(sys.argv)
    app.startApplication(application, None)
    reactor.run()
コード例 #20
0
ファイル: launcher.py プロジェクト: arjan/sparked
def run(appName):
    application = service.Application(appName)

    from sparked import tap
    config = tap.Options()
    config.parseOptions(sys.argv[1:])
    svc = tap.makeService(config)
    svc.setServiceParent(application)

    app.startApplication(application, False)
    log.addObserver(log.FileLogObserver(sys.stdout).emit)

    reactor.run()
コード例 #21
0
ファイル: q2qclient.py プロジェクト: rcarmo/divmod.org
 def start(self, portno=None):
     import sys
     lfname = self['logfile']
     if lfname == '-':
         lf = sys.stdout
     else:
         lf = file(os.path.expanduser(lfname), 'ab+')
     log.startLogging(lf,
                      setStdout=False)
     srv = self.getService()
     from twisted.application.app import startApplication
     startApplication(srv, False)
     reactor.run()
コード例 #22
0
def startApplication(config, application):
    process = service.IProcess(application, None)
    if not config["originalname"]:
        launchWithName(process.processName)
    setupEnvironment(config)
    service.IService(application).privilegedStartService()
    uid, gid = mktap.getid(config["uid"], config["gid"])
    if uid is None:
        uid = process.uid
    if gid is None:
        gid = process.gid
    shedPrivileges(config["euid"], uid, gid)
    app.startApplication(application, not config["no_save"])
コード例 #23
0
ファイル: pokerserver.py プロジェクト: yxjsolid/pokernetwork
def run(argv):
    twisted_log.startLoggingWithObserver(RefloggingObserver())

    if platform.system() != "Windows":
        if 'twisted.internet.reactor' not in sys.modules:
            log.debug("installing epoll reactor")
            from twisted.internet import epollreactor
            epollreactor.install()
        else:
            log.debug("reactor already installed")
    from twisted.internet import reactor
    application = makeApplication(argv)
    app.startApplication(application, None)
    reactor.run()
コード例 #24
0
ファイル: cmdline.py プロジェクト: SmileyJames/scrapyrt
def execute():
    sys.path.insert(0, os.getcwd())
    arguments = parse_arguments()
    if arguments.settings:
        settings.setmodule(arguments.settings)
    if arguments.set:
        for name, value in arguments.set:
            settings.set(name.upper(), value)
    settings.set('PROJECT_SETTINGS', find_scrapy_project(arguments.project))
    settings.freeze()
    setup_logging()
    application = get_application(arguments)
    app.startApplication(application, save=False)
    reactor.run()
コード例 #25
0
def execute():
    sys.path.insert(0, os.getcwd())
    arguments = parse_arguments()
    if arguments.settings:
        settings.setmodule(arguments.settings)
    if arguments.set:
        for name, value in arguments.set:
            settings.set(name.upper(), value)
    settings.set('PROJECT_SETTINGS', find_scrapy_project(arguments.project))
    settings.freeze()
    setup_logging()
    application = get_application(arguments)
    app.startApplication(application, save=False)
    reactor.run()
コード例 #26
0
ファイル: app.py プロジェクト: pferreir/commitbot
def start_services(config):
    client = XMPPClient(jid.internJID(config.credentials['jid']), config.credentials['password'])

    application = service.Application('commitbot')

    bot = CommitBot(config)
    bot.setHandlerParent(client)

    site = server.Site(WebHook(config, bot))
    tcp_server = reactor.listenTCP(8888, site)

    app.startApplication(application, None)
    client.startService()

    reactor.run()
コード例 #27
0
ファイル: twistd.py プロジェクト: hitzjd/Balance-Simulate
def startApplication(config, application):
    process = service.IProcess(application, None)
    if not config['originalname']:
        launchWithName(process.processName)
    setupEnvironment(config)
    service.IService(application).privilegedStartService()

    uid, gid = mktap.getid(config['uid'], config['gid'])
    if uid is None:
        uid = process.uid
    if gid is None:
        gid = process.gid

    shedPrivileges(config['euid'], uid, gid)
    app.startApplication(application, not config['no_save'])
コード例 #28
0
ファイル: _twistw.py プロジェクト: hitzjd/Balance-Simulate
def runApp(config):
    passphrase = app.getPassphrase(config['encrypted'])
    app.installReactor(config['reactor'])
    application = app.getApplication(config, passphrase)
    oldstdout = sys.stdout
    oldstderr = sys.stderr
    startLogging(config['logfile'])
    app.initialLog()
    os.chdir(config['rundir'])
    service.IService(application).privilegedStartService()
    app.startApplication(application, not config['no_save'])
    app.startApplication(internet.TimerService(0.1, lambda: None), 0)
    app.runReactorWithLogging(config, oldstdout, oldstderr)
    app.reportProfile(config['report-profile'],
                      service.IProcess(application).processName)
    log.msg("Server Shut Down.")
コード例 #29
0
def runApp(config):
    passphrase = app.getPassphrase(config['encrypted'])
    app.installReactor(config['reactor'])
    application = app.getApplication(config, passphrase)
    oldstdout = sys.stdout
    oldstderr = sys.stderr
    startLogging(config['logfile'])
    app.initialLog()
    os.chdir(config['rundir'])
    service.IService(application).privilegedStartService()
    app.startApplication(application, not config['no_save'])
    app.startApplication(internet.TimerService(0.1, lambda:None), 0)
    app.runReactorWithLogging(config, oldstdout, oldstderr)
    app.reportProfile(config['report-profile'],
                      service.IProcess(application).processName)
    log.msg("Server Shut Down.")
コード例 #30
0
        def _inner_run():
            # Initialize logging
            log.startLogging(sys.stdout)

            # Setup Twisted application
            application = service.Application('django')
            wsgi_root = wsgi_resource()
            root = Root(wsgi_root)

            main_site = server.Site(root)
            internet.TCPServer(int(self.port), main_site
                    ).setServiceParent(application)

            service.IService(application).startService()
            app.startApplication(application, False)

            reactor.addSystemEventTrigger('before', 'shutdown',
                    service.IService(application).stopService)

            reactor.run()
コード例 #31
0
ファイル: ljsocketService.py プロジェクト: genba/LJSocket
    def SvcDoRun(self):
        import servicemanager
        from LJSocket import SocketServiceFactory, DeviceManager
        import ljsocketServiceTac
        
        self.CheckForQuit()
        
        try:
            f = file("C:\LJSocket.log", 'w')
        except:
            f = file("LJSocket.log", 'w')

        from twisted.python.log import startLogging
        from twisted.application.app import startApplication
        from twisted.internet import reactor        
        startLogging(f)
        startApplication(ljsocketServiceTac.application, 0)
        #reactor.run()

        reactor.run(installSignalHandlers=0)
コード例 #32
0
        def _inner_run():
            # Initialize logging
            log.startLogging(sys.stdout)

            # Setup Twisted application
            application = service.Application('django')
            wsgi_root = wsgi_resource()
            root = Root(wsgi_root)

            main_site = server.Site(root)
            internet.TCPServer(int(self.port), main_site
                    ).setServiceParent(application)

            service.IService(application).startService()
            app.startApplication(application, False)

            reactor.addSystemEventTrigger('before', 'shutdown',
                    service.IService(application).stopService)

            reactor.run()
コード例 #33
0
ファイル: runbebop.py プロジェクト: gilligan/bebop
        def _inner_run():
            # Initialize logging
            log.startLogging(sys.stdout)

            # Setup Twisted application
            application = service.Application('django')
            root = Root(wsgi_resource())

            # Handle static files
            root.putChild('static', StaticFileFinder('/'))
            main_site = server.Site(root)
            internet.TCPServer(int(self.port), main_site).setServiceParent(application)

            service.IService(application).startService()
            app.startApplication(application, False)

            reactor.addSystemEventTrigger('before', 'shutdown',
                    service.IService(application).stopService)
            self._start_bebop(use_repl)

            reactor.run()
コード例 #34
0
def run_landscape_service(configuration_class, service_class, args):
    """Run a Landscape service.

    This function instantiates the specified L{LandscapeService} subclass and
    attaches the resulting service object to a Twisted C{Application}.  After
    that it starts the Twisted L{Application} and calls the
    L{LandscapeReactor.run} method of the L{LandscapeService}'s reactor.

    @param configuration_class: The service-specific subclass of
        L{Configuration} used to parse C{args} and build the C{service_class}
        object.
    @param service_class: The L{LandscapeService} subclass to create and start.
    @param args: Command line arguments used to initialize the configuration.
    """
    # Let's consider adding this:
    # from twisted.python.log import (
    #     startLoggingWithObserver, PythonLoggingObserver)
    # startLoggingWithObserver(PythonLoggingObserver().emit, setStdout=False)

    configuration = configuration_class()
    configuration.load(args)
    init_logging(configuration, service_class.service_name)
    application = Application("landscape-%s" % (service_class.service_name,))
    service = service_class(configuration)
    service.setServiceParent(application)

    if configuration.clones > 0:

        # Increase the timeout of AMP's MethodCalls
        # XXX: we should find a better way to expose this knot, and
        # not set it globally on the class
        from landscape.lib.amp import MethodCallSender
        MethodCallSender.timeout = 300

        # Create clones here because LandscapeReactor.__init__ would otherwise
        # cancel all scheduled delayed calls
        clones = []
        for i in range(configuration.clones):
            clone_config = configuration.clone()
            clone_config.computer_title += " Clone %d" % i
            clone_config.master_data_path = configuration.data_path
            clone_config.data_path += "-clone-%d" % i
            clone_config.log_dir += "-clone-%d" % i
            clone_config.is_clone = True
            clones.append(service_class(clone_config))

        configuration.is_clone = False

        def start_clones():
            # Spawn instances over the given time window
            start_clones_over = float(configuration.start_clones_over)
            delay = start_clones_over / configuration.clones

            for i, clone in enumerate(clones):

                def start(clone):
                    clone.setServiceParent(application)
                    clone.reactor.fire("run")

                service.reactor.call_later(delay * (i + 1), start, clone=clone)

        service.reactor.call_when_running(start_clones)

    startApplication(application, False)
    if configuration.ignore_sigint:
        signal.signal(signal.SIGINT, signal.SIG_IGN)

    service.reactor.run()
コード例 #35
0
    def render_POST(self, request):
        request.setHeader('Access-Control-Allow-Origin', get_allow_origin(request))
        request.setHeader('Access-Control-Allow-Methods', 'POST')
        request.setHeader('Access-Control-Allow-Headers', 'x-prototype-version,x-requested-with,Content-Type')
        request.setHeader('Access-Control-Max-Age', 2520) # 42 hours
        data = simplejson.loads(request.content.getvalue())

        try:
            if isinstance(data, list):
                for datum in data:
                    log_json(datum)
            else:
                log_json(data)
        except Exception as e:
            logger_err.error(e)

        return ''

root = Resource()
root.putChild('send_log', Logger())

# create a resource to serve static files
tmp_service = internet.TCPServer(settings['port'], Site(root))
application = service.Application('User-ALE')

# attach the service to its parent application
tmp_service.setServiceParent(application)
startApplication(application, 0)
reactor.run()
コード例 #36
0
ファイル: app.py プロジェクト: patron-it/opencanary
def run_twisted_app():
    app = initialize_app('opencanaryd', config)
    startApplication(app, 0)

    logMsg('Canary running!!!')
    reactor.run()
コード例 #37
0
                          get_allow_origin(request))
        request.setHeader('Access-Control-Allow-Methods', 'POST')
        request.setHeader('Access-Control-Allow-Headers',
                          'x-prototype-version,x-requested-with,Content-Type')
        request.setHeader('Access-Control-Max-Age', 2520)  # 42 hours
        data = simplejson.loads(request.content.getvalue())

        try:
            if isinstance(data, list):
                for datum in data:
                    log_json(request, datum)
            else:
                log_json(request, data)
        except Exception as e:
            logger_err.error(e)

        return ''


root = Resource()
root.putChild('send_log', Logger())

# create a resource to serve static files
tmp_service = internet.TCPServer(settings['port'], Site(root))
application = service.Application('User-ALE')

# attach the service to its parent application
tmp_service.setServiceParent(application)
startApplication(application, 0)
reactor.run()
コード例 #38
0
def run():
    twisted_log.startLoggingWithObserver(RefloggingObserver())
    application = makeApplication(sys.argv[1:])
    app.startApplication(application, None)
    reactor.run()
コード例 #39
0
from twisted.internet import reactor
from twisted.python import log

from scrapyd import Config
from scrapyd.app import application


def _get_config(args):
    scrapyd_config = Config()
    section = 'scrapyd'
    scrapyd_config.cp.set(section, 'http_port', args.http_port)

    if args.auth is not None:
        username, password = args.auth.split(":")
        scrapyd_config.cp.set(section, 'username', username)
        scrapyd_config.cp.set(section, 'password', password)

    return scrapyd_config


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('http_port', default=6800)
    parser.add_argument('--auth', default=None)
    args = parser.parse_args()
    log.startLogging(sys.stdout)
    conf = _get_config(args)
    application = application(config=conf)
    app.startApplication(application, False)
    reactor.run()
コード例 #40
0
ファイル: s2sbase.py プロジェクト: HoverHell/s2stester
def xt_set_it():
    from twisted.application.app import startApplication
    from twisted.internet import reactor
    startApplication(application, False)
    # reactor.run()
    return reactor
コード例 #41
0
ファイル: test_application.py プロジェクト: Berimor66/mythbox
 def test_startApplication(self):
     appl = service.Application("lala")
     app.startApplication(appl, 0)
     self.assert_(service.IService(appl).running)
コード例 #42
0
ファイル: pokerbot.py プロジェクト: stephica/poker-network
def run():
    app.startApplication(application, None)
    reactor.run()
コード例 #43
0
ファイル: pokerbot.py プロジェクト: stephica/poker-network
def run():
    application = makeApplication(sys.argv[1:])
    app.startApplication(application, None)
    reactor.run()
コード例 #44
0
def execute():
    config = _get_config()
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
コード例 #45
0
ファイル: main.py プロジェクト: keaysma/solinia_depreciated
    def child_highestshaman(self, ctx):
        r = CACHED.get("highestshaman", None)
        if r:
            return r
        r = CACHED["highestshaman"] = self.highestprimaryclass(ctx, "Shaman")
        return r

    def child_highestmonk(self, ctx):
        r = CACHED.get("highestmonk", None)
        if r:
            return r
        r = CACHED["highestmonk"] = self.highestprimaryclass(ctx, "Monk")
        return r

    def child_highestdoomknight(self, ctx):
        r = CACHED.get("highestdoomknight", None)
        if r:
            return r
        r = CACHED["highestdoomknight"] = self.highestprimaryclass(
            ctx, "Doom Knight")
        return r


reactor.callLater(0, GetWorldStats)

application = service.Application("StatSite")
strports.service("8000",
                 appserver.NevowSite(StatSite())).setServiceParent(application)
app.startApplication(application, None)
reactor.run()
コード例 #46
0
ファイル: pokerbot.py プロジェクト: Usr-X/poker-network
def run():
    application = makeApplication(sys.argv[1:])
    app.startApplication(application, None)
    reactor.run()
コード例 #47
0
ファイル: livetrial.py プロジェクト: comfuture/numbler
 def _startApplication(self):
     if not platform.isWinNT():
         twistd.startApplication(self, self.application)
     else:
         service.IService(self.application).privilegedStartService()
         app.startApplication(self.application, False)
コード例 #48
0
 def _startApplication(self):
     if not platform.isWinNT():
         twistd.startApplication(self, self.application)
     else:
         service.IService(self.application).privilegedStartService()
         app.startApplication(self.application, False)
コード例 #49
0
ファイル: pokerbot.py プロジェクト: arem/poker-network
def run():
    app.startApplication(application, None)
    reactor.run()
コード例 #50
0
ファイル: stats.py プロジェクト: arem/poker-network
def run():
    global application, stop_application    #pragma: no cover
    app.startApplication(application, None) #pragma: no cover
    if stop_application: stop_application.addCallback(lambda x: reactor.stop()) #pragma: no cover
    reactor.run()                           #pragma: no cover
コード例 #51
0
        r = CACHED.get("highestthief",None)
        if r:
            return r
        r=CACHED["highestthief"]=self.highestprimaryclass(ctx,"Thief")
        return r
    def child_highestshaman(self, ctx):
        r = CACHED.get("highestshaman",None)
        if r:
            return r
        r=CACHED["highestshaman"]=self.highestprimaryclass(ctx,"Shaman")
        return r
    def child_highestmonk(self, ctx):
        r = CACHED.get("highestmonk",None)
        if r:
            return r
        r=CACHED["highestmonk"]=self.highestprimaryclass(ctx,"Monk")
        return r
    def child_highestdoomknight(self, ctx):
        r = CACHED.get("highestdoomknight",None)
        if r:
            return r
        r=CACHED["highestdoomknight"]=self.highestprimaryclass(ctx,"Doom Knight")
        return r


reactor.callLater(0,GetWorldStats)

application = service.Application("StatSite")
strports.service("8000", appserver.NevowSite(StatSite())).setServiceParent(application)
app.startApplication(application,None)
reactor.run()
コード例 #52
0
 def test_startApplication(self):
     appl = service.Application("lala")
     app.startApplication(appl, 0)
     self.assert_(service.IService(appl).running)
コード例 #53
0
ファイル: cli.py プロジェクト: olix0r/tx-jersey
 def startApplication(self):
     """Start the application and setup shutdown hooks."""
     app.startApplication(self.application, False)