本文整理汇总了Python中twisted.application.internet.TimerService.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python TimerService.__init__方法的具体用法?Python TimerService.__init__怎么用?Python TimerService.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.application.internet.TimerService
的用法示例。
在下文中一共展示了TimerService.__init__方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, poller=None, step=300):
"""
"""
if poller is None:
raise RuntimeError('poller cannot be None')
if not issubclass(type(poller), IPoll):
raise TypeError('poller privided is not a subclass of IPoll')
self._poller = poller
TimerService.__init__(self, step=step, callable=self._poller.poll)
示例2: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, poller=None, step=60*5):
""" The magic here is calling the TimerService constructor (old
style class) to set the polling interval and specify the polling
function.
"""
if poller is None:
raise RuntimeError('poller cannot be None')
if not issubclass(type(poller), IPoll):
raise TypeError('poller provided is not a subclass of IPoll');
self._poller = poller
TimerService.__init__(self, step=step, callable=self._poller.poll)
示例3: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, all_stations, base_config, base_dir, poll_length, file_pattern,
send_command, command_helper, complete_command, failed_command):
TimerService.__init__(self, poll_length, self.run_poll)
self.log = log
self.all_stations = all_stations
self.base_config = dict(base_config)
self.base_folder = base_dir
self.file_pattern = file_pattern
self.send_command = send_command
self.complete_command = complete_command
self.failed_command = failed_command
self.command_helper = command_helper
示例4: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, reactor, interval, k8s, namespace, router):
TimerService.__init__(
self,
interval,
divert_errors_to_log(self._check_once, u"router-update"),
k8s,
namespace,
)
# This attribute controls the the reactor used by TimerService to set
# up the LoopingCall.
self.clock = reactor
self._router = router
示例5: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, batchsize, interval, slv_client, clock=None):
"""
Initializes the scheduler service with batch size and interval
:param int batchsize: number of events to fetch on each iteration
:param int interval: time between each iteration
:param slv_client: a :class:`silverberg.client.CQLClient` or
:class:`silverberg.cluster.RoundRobinCassandraCluster` instance used to get lock
:param clock: An instance of IReactorTime provider that defaults to reactor if not provided
"""
from otter.models.cass import LOCK_TABLE_NAME
self.lock = BasicLock(slv_client, LOCK_TABLE_NAME, 'schedule', max_retry=0)
TimerService.__init__(self, interval, self.check_for_events, batchsize)
self.clock = clock
self.log = otter_log.bind(system='otter.scheduler')
示例6: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, batchsize, interval, store, kz_client,
zk_partition_path, time_boundary, buckets, clock=None, threshold=60):
"""
Initialize the scheduler service
:param int batchsize: number of events to fetch on each iteration
:param int interval: time between each iteration
:param kz_client: `TxKazooClient` instance
:param buckets: an iterable containing the buckets which contains scheduled events
:param zk_partition_path: Partiton path used by kz_client to partition the buckets
:param time_boundary: Time to wait for partition to become stable
:param clock: An instance of IReactorTime provider that defaults to reactor if not provided
"""
TimerService.__init__(self, interval, self.check_events, batchsize)
self.store = store
self.clock = clock
self.kz_client = kz_client
self.buckets = buckets
self.zk_partition_path = zk_partition_path
self.time_boundary = time_boundary
self.kz_partition = None
self.threshold = threshold
self.log = otter_log.bind(system='otter.scheduler')
示例7: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__( self, metricProvider ):
TimerService.__init__( self, metricProvider.getInterval( ), self.processMetrics )
self.metricProvider = metricProvider
示例8: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self):
TimerService.__init__(self, 60 * 60, self._report)
示例9: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, step, db, cmd):
TimerService.__init__(self, step, self.ping)
self.db = db
self.cmd = cmd
示例10: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, interval, api):
TimerService.__init__(self, interval, api.run_scripts)
示例11: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, launcher, interval=5):
self.launcher = launcher
TimerService.__init__(self, interval, self.heartbeat)
self.sent_hello = False
self.netlink = netlink.RoutingNetlink()
示例12: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, announce_protocol):
self.protocol = announce_protocol
TimerService.__init__(self, MULTICAST_ANNOUNCE_INTVL, self.announceAndPrune)
示例13: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, dispatcher):
TimerService.__init__(self, 5, self.checkWorkers)
self.dispatcher = dispatcher
示例14: __init__
# 需要导入模块: from twisted.application.internet import TimerService [as 别名]
# 或者: from twisted.application.internet.TimerService import __init__ [as 别名]
def __init__(self, log_path, interval=1):
self.log_file = None
self.log_path = log_path
TimerService.__init__(self, interval, self.do_watch)