当前位置: 首页>>代码示例>>Python>>正文


Python app.startApplication函数代码示例

本文整理汇总了Python中twisted.application.app.startApplication函数的典型用法代码示例。如果您正苦于以下问题:Python startApplication函数的具体用法?Python startApplication怎么用?Python startApplication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了startApplication函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: startApplication

    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'])
开发者ID:anrysev,项目名称:twisted,代码行数:26,代码来源:_twistd_unix.py

示例2: siptrackd_twisted_init

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')
开发者ID:sii,项目名称:siptrackd,代码行数:7,代码来源:siptrackd.py

示例3: daemon

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()
开发者ID:UfSoft,项目名称:afm,代码行数:26,代码来源:service.py

示例4: execute

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
开发者ID:huangpanxx,项目名称:POAS,代码行数:7,代码来源:script.py

示例5: handle_noargs

 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()
开发者ID:HoverHell,项目名称:xmppforum,代码行数:8,代码来源:run_xmppserver.py

示例6: runApp

 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()
开发者ID:hellais,项目名称:GLBackend,代码行数:9,代码来源:runner.py

示例7: postApplication

 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.")
开发者ID:Almad,项目名称:twisted,代码行数:9,代码来源:_twistw.py

示例8: execute

def execute():
    try:
        config = _get_config()
    except NotConfigured:
        config = None
    log.startLogging(sys.stderr)
    application = get_application(config)
    app.startApplication(application, False)
    reactor.run()
开发者ID:AllenCHM,项目名称:scrapyd,代码行数:9,代码来源:script.py

示例9: postApplication

 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.")
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:11,代码来源:_twistw.py

示例10: run

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()
开发者ID:richiela,项目名称:Bitcoin-Poker-Room,代码行数:12,代码来源:pokerserver.py

示例11: start

 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()
开发者ID:rcarmo,项目名称:divmod.org,代码行数:13,代码来源:q2qclient.py

示例12: run

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()
开发者ID:arjan,项目名称:sparked,代码行数:13,代码来源:launcher.py

示例13: run

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()
开发者ID:Usr-X,项目名称:poker-network,代码行数:13,代码来源:pokerserver.py

示例14: execute

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()
开发者ID:SmileyJames,项目名称:scrapyrt,代码行数:14,代码来源:cmdline.py

示例15: start_services

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()
开发者ID:pferreir,项目名称:commitbot,代码行数:15,代码来源:app.py


注:本文中的twisted.application.app.startApplication函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。