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


Python PeriodicCallback.is_running方法代码示例

本文整理汇总了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()
开发者ID:Alternhuman,项目名称:deployer,代码行数:13,代码来源:receiver.py

示例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)
开发者ID:OpenBoxProject,项目名称:obsi,代码行数:23,代码来源:watchdog.py


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