本文整理匯總了Python中tornado.ioloop.IOLoop.configure方法的典型用法代碼示例。如果您正苦於以下問題:Python IOLoop.configure方法的具體用法?Python IOLoop.configure怎麽用?Python IOLoop.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tornado.ioloop.IOLoop
的用法示例。
在下文中一共展示了IOLoop.configure方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def main():
parse_command_line()
if options.ioloop:
IOLoop.configure(options.ioloop)
for i in xrange(options.num_runs):
run()
示例2: test_asyncio
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def test_asyncio(self):
cls = self.run_python(
'IOLoop.configure("tornado.platform.asyncio.AsyncIOLoop")',
"print(classname(IOLoop.current()))",
)
self.assertEqual(cls, "AsyncIOMainLoop")
示例3: configure_ioloop
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def configure_ioloop():
kwargs = {}
if options.ioloop_time_monotonic:
from tornado.platform.auto import monotonic_time
if monotonic_time is None:
raise RuntimeError("monotonic clock not found")
kwargs['time_func'] = monotonic_time
if options.ioloop or kwargs:
IOLoop.configure(options.ioloop, **kwargs)
示例4: test_explicit_select
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def test_explicit_select(self):
# SelectIOLoop can always be configured explicitly.
default_class = self.run_python(
'IOLoop.configure("tornado.platform.select.SelectIOLoop")',
'print(classname(IOLoop.current()))')
self.assertEqual(default_class, 'SelectIOLoop')
示例5: test_asyncio
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def test_asyncio(self):
cls = self.run_python(
'IOLoop.configure("tornado.platform.asyncio.AsyncIOLoop")',
'print(classname(IOLoop.current()))')
self.assertEqual(cls, 'AsyncIOMainLoop')
示例6: instrument_tornado_ioloop
# 需要導入模塊: from tornado.ioloop import IOLoop [as 別名]
# 或者: from tornado.ioloop.IOLoop import configure [as 別名]
def instrument_tornado_ioloop() -> None:
IOLoop.configure(InstrumentedPollIOLoop)
# A hack to keep track of how much time we spend working, versus sleeping in
# the event loop.
#
# Creating a new event loop instance with a custom impl object fails (events
# don't get processed), so instead we modify the ioloop module variable holding
# the default poll implementation. We need to do this before any Tornado code
# runs that might instantiate the default event loop.