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


Python consumer.QoS类代码示例

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


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

示例1: test_consumer_decrement_eventually

 def test_consumer_decrement_eventually(self):
     consumer = Mock()
     qos = QoS(consumer, 10, current_app.log.get_default_logger())
     qos.decrement_eventually()
     self.assertEqual(qos.value, 9)
     qos.value = 0
     qos.decrement_eventually()
     self.assertEqual(qos.value, 0)
开发者ID:alessandrod,项目名称:celery,代码行数:8,代码来源:__init__.py

示例2: test_consumer_decrement_eventually

 def test_consumer_decrement_eventually(self):
     consumer = Mock()
     qos = QoS(consumer, 10)
     qos.decrement_eventually()
     self.assertEqual(qos.value, 9)
     qos.value = 0
     qos.decrement_eventually()
     self.assertEqual(qos.value, 0)
开发者ID:AdrianRibao,项目名称:celery,代码行数:8,代码来源:test_worker.py

示例3: test_decrement

 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,代码行数:12,代码来源:test_worker.py

示例4: test_set

 def test_set(self):
     consumer = Mock()
     qos = QoS(consumer, 10)
     qos.set(12)
     self.assertEqual(qos.prev, 12)
     qos.set(qos.prev)
开发者ID:AdrianRibao,项目名称:celery,代码行数:6,代码来源:test_worker.py

示例5: test_consumer_increment_decrement

    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,代码行数:20,代码来源:test_worker.py

示例6: test_exceeds_short

 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,代码行数:12,代码来源:test_worker.py

示例7: __init__

 def __init__(self, value):
     self.value = value
     QoS.__init__(self, None, value)
开发者ID:AdrianRibao,项目名称:celery,代码行数:3,代码来源:test_worker.py

示例8: test_set

 def test_set(self):
     consumer = Mock()
     qos = QoS(consumer, 10, current_app.log.get_default_logger())
     qos.set(12)
     self.assertEqual(qos.prev, 12)
     qos.set(qos.prev)
开发者ID:alessandrod,项目名称:celery,代码行数:6,代码来源:__init__.py

示例9: test_consumer_increment_decrement

    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,代码行数:19,代码来源:__init__.py

示例10: test_exceeds_short

 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:alessandrod,项目名称:celery,代码行数:13,代码来源:__init__.py

示例11: test_consumer_increment_decrement

    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,代码行数:19,代码来源:test_worker.py


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