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


Python LoopingCall.withCount方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(self, *args, **kwargs):
     self.dead = False
     self.type = None
     self.secure = False
     self.data = 0
     self.data_checker = LoopingCall(self.checkData)
     self.pinger = LoopingCall.withCount(self.ping)
开发者ID:smillaedler,项目名称:txircd,代码行数:9,代码来源:ircd.py

示例2: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
    def __init__(
        self, reactor, request, request_rate=10,
        sample_size=DEFAULT_SAMPLE_SIZE, timeout=45,
        tolerance_percentage=0.2
    ):
        """
        ``RequestLoadScenario`` constructor.

        :param tolerance_percentage: error percentage in the rate that is
            considered valid. For example, if we request a ``request_rate``
            of 20, and we give a tolerance_percentage of 0.2 (20%), anything
            in [16,20] will be a valid rate.
        """
        self.reactor = reactor
        self.request = request
        self.request_rate = request_rate
        self.timeout = timeout
        self._maintained = Deferred()
        self.rate_measurer = RateMeasurer(sample_size)
        self.max_outstanding = 10 * request_rate
        self.tolerated_errors = 5 * request_rate
        # Send requests per second
        self.loop = LoopingCall.withCount(self._request_and_measure)
        self.loop.clock = self.reactor
        # Monitor the status of the scenario
        self.monitor_loop = LoopingCall(self.check_rate)
        self.monitor_loop.clock = self.reactor
        self.is_started = False
        self.rate_tolerated = (
            float(request_rate) - (request_rate*tolerance_percentage)
        )
开发者ID:ClusterHQ,项目名称:flocker,代码行数:33,代码来源:_request_load.py

示例3: start

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def start(self):
   """
   Start the simulated advancement of time.
   """
   self._call = LoopingCall.withCount(self._update)
   self._call.clock = self.platformClock
   self._call.start(1.0 / self.granularity, now=False)
开发者ID:smoak,项目名称:TPS,代码行数:9,代码来源:environment.py

示例4: start

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def start(self):
     """
     Start the simulated advancement of time.
     """
     self._call = LoopingCall.withCount(self._update)
     self._call.clock = reactor
     self._call.start(1.0 / self.framerate, now=False)
     self._running = True
开发者ID:HampshireCS,项目名称:CS112-Spring2012,代码行数:10,代码来源:clock.py

示例5: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(self, ip):
     self.dead = False
     self.type = None
     self.secure = False
     self.data = 0
     self.data_checker = LoopingCall(self.checkData)
     self.pinger = LoopingCall.withCount(self.ping)
     self.connection_expire = reactor.callLater(15, self.connectionLost, None)
     self.ip = ip
开发者ID:DesertBus,项目名称:txircd,代码行数:11,代码来源:ircd.py

示例6: configure

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def configure(self, config):
     room = self.original
     self._loop = LoopingCall.withCount(self.update)
     self._interval = 0.1
     self.map, self.walk = gen_map()
     self.tick = 0
     self.enemies = []
     self.towers = []
     self.spawned = 0
     self.stats = defaultdict(int)
开发者ID:isnok,项目名称:mpmf,代码行数:12,代码来源:ServerSide.py

示例7: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(
     self, reactor, cluster, request_rate=10,
     sample_size=DEFAULT_SAMPLE_SIZE, timeout=45
 ):
     self._maintained = Deferred()
     self.reactor = reactor
     self.control_service = cluster.get_control_service(reactor)
     self.request_rate = request_rate
     self.timeout = timeout
     self.rate_measurer = RateMeasurer(sample_size)
     self.max_outstanding = 10 * request_rate
     # Send requests per second
     self.loop = LoopingCall.withCount(self._request_and_measure)
     self.loop.clock = self.reactor
     self.monitor_loop = LoopingCall(self.check_rate)
     self.monitor_loop.clock = self.reactor
开发者ID:wangbinxiang,项目名称:flocker,代码行数:18,代码来源:read_request_load.py

示例8: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(
     self, reactor, cluster, request_rate=10,
     sample_size=DEFAULT_SAMPLE_SIZE, timeout=45
 ):
     self._maintained = Deferred()
     self.reactor = reactor
     self.control_service = cluster.get_control_service(reactor)
     self.request_rate = request_rate
     self.timeout = timeout
     self.rate_measurer = RateMeasurer(sample_size)
     self.max_outstanding = 10 * request_rate
     self._dataset_id = ""
     # Send requests per second
     self.loop = LoopingCall.withCount(self._request_and_measure)
     self.loop.clock = self.reactor
     # Once the expected rate is reached, we will start monitoring
     # the scenario inside this loop
     self.monitor_loop = LoopingCall(self.check_rate)
     self.monitor_loop.clock = self.reactor
开发者ID:wangbinxiang,项目名称:flocker,代码行数:21,代码来源:write_request_load.py

示例9: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
    def __init__(
        self, reactor, scenario_setup_instance, request_rate=10,
        sample_size=DEFAULT_SAMPLE_SIZE, timeout=45,
        tolerance_percentage=0.2
    ):
        """
        ``RequestLoadScenario`` constructor.

        :param reactor: Reactor to use.
        :param scenario_setup_instance: provider of the
            ``IRequestScenarioSetup`` interface.
        :param request_rate: target number of request per second.
        :param sample_size: number of samples to collect when measuring
            the rate.
        :param tolerance_percentage: error percentage in the rate that is
            considered valid. For example, if we request a ``request_rate``
            of 20, and we give a tolerance_percentage of 0.2 (20%), anything
            in [16,20] will be a valid rate.
        """
        self.reactor = reactor
        self.scenario_setup = scenario_setup_instance
        self.request_rate = request_rate
        self.timeout = timeout
        self._maintained = Deferred()
        self.rate_measurer = RateMeasurer(sample_size)
        self.max_outstanding = 10 * request_rate
        # Send requests per second
        self.loop = LoopingCall.withCount(self._request_and_measure)
        self.loop.clock = self.reactor
        # Monitor the status of the scenario
        self.monitor_loop = LoopingCall(self.check_rate)
        self.monitor_loop.clock = self.reactor
        self.is_started = False
        self.rate_tolerated = (
            float(request_rate) - (request_rate*tolerance_percentage)
        )
开发者ID:aramase,项目名称:flocker,代码行数:38,代码来源:_request_load.py

示例10: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
    def __init__(self, *args, **kwargs):
        super(Furnace, self).__init__(*args, **kwargs)

        self.inventory = FurnaceStorage()
        self.burning = LoopingCall.withCount(self.burn)
开发者ID:JDShu,项目名称:bravo,代码行数:7,代码来源:entity.py

示例11: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(self, delay=0.01):
     self.delay = delay
     self.loop_call = LoopingCall.withCount(self.watch)
     self.blocked = 0
     self.checks = []
     self.d = None
开发者ID:leapcode,项目名称:soledad,代码行数:8,代码来源:watchdog.py

示例12: __init__

# 需要导入模块: from twisted.internet.task import LoopingCall [as 别名]
# 或者: from twisted.internet.task.LoopingCall import withCount [as 别名]
 def __init__(self, tile, coords):
     self.tile = tile
     self.coords = coords
     self.running = False
     self.burning = LoopingCall.withCount(self.burn)
开发者ID:Krenair,项目名称:bravo,代码行数:7,代码来源:furnace.py


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