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


Python TimerService.clock方法代码示例

本文整理汇总了Python中twisted.application.internet.TimerService.clock方法的典型用法代码示例。如果您正苦于以下问题:Python TimerService.clock方法的具体用法?Python TimerService.clock怎么用?Python TimerService.clock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.application.internet.TimerService的用法示例。


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

示例1: __init__

# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import clock [as 别名]
 def __init__(self, kz_client, interval, partitioner_path, buckets,
              time_boundary, log, got_buckets,
              clock=None):
     """
     :param log: a bound log
     :param kz_client: txKazoo client
     :param partitioner_path: ZooKeeper path, used for partitioning
     :param buckets: iterable of buckets to distribute between
         nodes. Ideally there should be at least as many elements as nodes
         taking part in this partitioner. This should be a sequence of str.
     :param time_boundary: time to wait for partitioning to stabilize.
     :param got_buckets: Callable which will be called with a list of
         buckets when buckets have been allocated to this node.
     :param clock: clock to use for checking the buckets on an interval.
     """
     MultiService.__init__(self)
     self.kz_client = kz_client
     self.partitioner_path = partitioner_path
     self.buckets = buckets
     self.log = log
     self.got_buckets = got_buckets
     self.time_boundary = time_boundary
     ts = TimerService(interval, self.check_partition)
     ts.setServiceParent(self)
     ts.clock = clock
     self._old_buckets = []
开发者ID:rackerlabs,项目名称:otter,代码行数:28,代码来源:zkpartitioner.py

示例2: setup_selfheal_service

# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import clock [as 别名]
def setup_selfheal_service(clock, config, dispatcher, health_checker, log):
    """
    Setup selfheal timer service and return it.

    :param clock: :obj:`IReactorTime` provider
    :param dict config: Configuration dict containing selfheal info
    :param dispatcher: Effect dispatcher
    :param health_checker: ``HealthChecker`` object where SelfHeal's health
        check will be added
    :param log: :obj:`BoundLog` logger used by service

    :return: selfheal service or None if relevant config is not found
    :rtype: :obj:`IService`
    """
    if "selfheal" not in config:
        return None
    interval = get_in(["selfheal", "interval"], config, no_default=True)
    selfheal = SelfHeal(clock, dispatcher, config_value, interval, log)
    func, lock = zk.locked_logged_func(
        dispatcher, "/selfheallock", log, "selfheal-lock-acquired",
        selfheal.setup)
    health_checker.checks["selfheal"] = zk.create_health_check(lock)
    sh_timer = TimerService(interval, func)
    sh_timer.clock = clock
    return sh_timer
开发者ID:rackerlabs,项目名称:otter,代码行数:27,代码来源:api.py

示例3: __init__

# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import clock [as 别名]
 def __init__(self, reactor):
     MultiService.__init__(self)
     self._deployment_state = DeploymentState()
     timer = TimerService(1, self._wipe_expired)
     timer.clock = reactor
     timer.setServiceParent(self)
     self._information_wipers = pmap()
     self._clock = reactor
开发者ID:332054781,项目名称:flocker,代码行数:10,代码来源:_clusterstate.py

示例4: _convergence_service

# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import clock [as 别名]
def _convergence_service(reactor, interval, config, subscription_client, k8s, aws):
    def monitorable_converge(*a, **kw):
        d = converge(*a, **kw)
        def finished(passthrough):
            _CONVERGE_COMPLETE.set(reactor.seconds())
            return passthrough
        d.addCallback(finished)
        return d

    safe_converge = divert_errors_to_log(
        monitorable_converge, u"subscription_converger",
    )

    service = TimerService(
        interval,
        safe_converge,
        config,
        subscription_client,
        k8s,
        aws,
    )
    service.clock = reactor
    return service
开发者ID:LeastAuthority,项目名称:leastauthority.com,代码行数:25,代码来源:subscription_converger.py

示例5: _timer_service

# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import clock [as 别名]
def _timer_service(reactor, *a, **kw):
    service = TimerService(*a, **kw)
    service.clock = reactor
    return service
开发者ID:LeastAuthority,项目名称:leastauthority.com,代码行数:6,代码来源:_monitor_tahoe.py


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