本文整理汇总了Python中tornado.ioloop.PeriodicCallback.is_running方法的典型用法代码示例。如果您正苦于以下问题:Python PeriodicCallback.is_running方法的具体用法?Python PeriodicCallback.is_running怎么用?Python PeriodicCallback.is_running使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tornado.ioloop.PeriodicCallback
的用法示例。
在下文中一共展示了PeriodicCallback.is_running方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_callback
# 需要导入模块: from tornado.ioloop import PeriodicCallback [as 别名]
# 或者: from tornado.ioloop.PeriodicCallback import is_running [as 别名]
def start_callback():
"""
Starts the collection callback
"""
global getDataCallback
if getDataCallback is None:
getDataCallback = PeriodicCallback(process_data, conf.REFRESH_FREQ)
getDataCallback.start()
elif not getDataCallback.is_running():
getDataCallback.start()
示例2: ProcessWatchdog
# 需要导入模块: from tornado.ioloop import PeriodicCallback [as 别名]
# 或者: from tornado.ioloop.PeriodicCallback import is_running [as 别名]
class ProcessWatchdog(object):
def __init__(self, interval=1000):
self.interval = interval
self._process_to_check = {}
self._periodic_callback = PeriodicCallback(self._check_processes, self.interval)
def register_process(self, process, on_dead_callback):
self._process_to_check[process] = on_dead_callback
def start(self):
if not self._periodic_callback.is_running():
self._periodic_callback.start()
def stop(self):
if self._periodic_callback.is_running():
self._periodic_callback.stop()
def _check_processes(self):
for process in self._process_to_check:
if not process.is_running():
self._process_to_check[process](process)