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


Python QoS.decrement方法代码示例

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


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

示例1: test_decrement

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
 def test_decrement(self):
     consumer = self.MockConsumer()
     qos = QoS(consumer, 10, app_or_default().log.get_default_logger())
     qos.update()
     self.assertEqual(int(qos.value), 10)
     self.assertEqual(consumer.prefetch_count, 10)
     qos.decrement()
     self.assertEqual(int(qos.value), 9)
     self.assertEqual(consumer.prefetch_count, 9)
     qos.decrement_eventually()
     self.assertEqual(int(qos.value), 8)
     self.assertEqual(consumer.prefetch_count, 9)
开发者ID:flaper87,项目名称:celery,代码行数:14,代码来源:test_worker.py

示例2: test_exceeds_short

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
 def test_exceeds_short(self):
     qos = QoS(Mock(), PREFETCH_COUNT_MAX - 1)
     qos.update()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX - 1)
     qos.increment()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX)
     qos.increment()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX + 1)
     qos.decrement()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX)
     qos.decrement()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX - 1)
开发者ID:AdrianRibao,项目名称:celery,代码行数:14,代码来源:test_worker.py

示例3: test_exceeds_short

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
 def test_exceeds_short(self):
     qos = QoS(Mock(), PREFETCH_COUNT_MAX - 1, current_app.log.get_default_logger())
     qos.update()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX - 1)
     qos.increment()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX)
     qos.increment()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX + 1)
     qos.decrement()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX)
     qos.decrement()
     self.assertEqual(qos.value, PREFETCH_COUNT_MAX - 1)
开发者ID:OddBloke,项目名称:celery,代码行数:14,代码来源:test_worker.py

示例4: test_consumer_increment_decrement

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
    def test_consumer_increment_decrement(self):
        consumer = Mock()
        qos = QoS(consumer, 10, current_app.log.get_default_logger())
        qos.update()
        self.assertEqual(qos.value, 10)
        self.assertIn({"prefetch_count": 10}, consumer.qos.call_args)
        qos.decrement()
        self.assertEqual(qos.value, 9)
        self.assertIn({"prefetch_count": 9}, consumer.qos.call_args)
        qos.decrement_eventually()
        self.assertEqual(qos.value, 8)
        self.assertIn({"prefetch_count": 9}, consumer.qos.call_args)

        # Does not decrement 0 value
        qos.value = 0
        qos.decrement()
        self.assertEqual(qos.value, 0)
        qos.increment()
        self.assertEqual(qos.value, 0)
开发者ID:alessandrod,项目名称:celery,代码行数:21,代码来源:__init__.py

示例5: test_consumer_increment_decrement

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
    def test_consumer_increment_decrement(self):
        consumer = self.MockConsumer()
        qos = QoS(consumer, 10, current_app.log.get_default_logger())
        qos.update()
        self.assertEqual(qos.value, 10)
        self.assertEqual(consumer.prefetch_count, 10)
        qos.decrement()
        self.assertEqual(qos.value, 9)
        self.assertEqual(consumer.prefetch_count, 9)
        qos.decrement_eventually()
        self.assertEqual(qos.value, 8)
        self.assertEqual(consumer.prefetch_count, 9)

        # Does not decrement 0 value
        qos.value = 0
        qos.decrement()
        self.assertEqual(qos.value, 0)
        qos.increment()
        self.assertEqual(qos.value, 0)
开发者ID:frac,项目名称:celery,代码行数:21,代码来源:test_worker.py

示例6: test_consumer_increment_decrement

# 需要导入模块: from celery.worker.consumer import QoS [as 别名]
# 或者: from celery.worker.consumer.QoS import decrement [as 别名]
    def test_consumer_increment_decrement(self):
        consumer = Mock()
        qos = QoS(consumer, 10)
        qos.update()
        self.assertEqual(qos.value, 10)
        consumer.qos.assert_called_with(prefetch_count=10)
        qos.decrement()
        self.assertEqual(qos.value, 9)
        consumer.qos.assert_called_with(prefetch_count=9)
        qos.decrement_eventually()
        self.assertEqual(qos.value, 8)
        consumer.qos.assert_called_with(prefetch_count=9)
        self.assertIn({"prefetch_count": 9}, consumer.qos.call_args)

        # Does not decrement 0 value
        qos.value = 0
        qos.decrement()
        self.assertEqual(qos.value, 0)
        qos.increment()
        self.assertEqual(qos.value, 0)
开发者ID:AdrianRibao,项目名称:celery,代码行数:22,代码来源:test_worker.py


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