本文整理汇总了Python中twisted.application.app.startApplication函数的典型用法代码示例。如果您正苦于以下问题:Python startApplication函数的具体用法?Python startApplication怎么用?Python startApplication使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startApplication函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: _inner_run
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()
开发者ID:andresriancho,项目名称:trunserver,代码行数:20,代码来源:trunserver.py
示例17: SvcDoRun
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)
开发者ID:genba,项目名称:LJSocket,代码行数:20,代码来源:ljsocketService.py
示例18: _inner_run
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()
开发者ID:gilligan,项目名称:bebop,代码行数:21,代码来源:runbebop.py
示例19: run
def run():
application = makeApplication(sys.argv[1:])
app.startApplication(application, None)
reactor.run()
开发者ID:Usr-X,项目名称:poker-network,代码行数:4,代码来源:pokerbot.py
示例20: test_startApplication
def test_startApplication(self):
appl = service.Application("lala")
app.startApplication(appl, 0)
self.assert_(service.IService(appl).running)
开发者ID:Berimor66,项目名称:mythbox,代码行数:4,代码来源:test_application.py
注:本文中的twisted.application.app.startApplication函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论