本文整理汇总了Python中junebug.channel.Channel.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.get_all方法的具体用法?Python Channel.get_all怎么用?Python Channel.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类junebug.channel.Channel
的用法示例。
在下文中一共展示了Channel.get_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_all_channels
# 需要导入模块: from junebug.channel import Channel [as 别名]
# 或者: from junebug.channel.Channel import get_all [as 别名]
def test_get_all_channels(self):
channels = yield Channel.get_all(self.redis)
self.assertEqual(channels, set())
channel1 = yield self.create_channel(
self.service, self.redis, TelnetServerTransport)
channels = yield Channel.get_all(self.redis)
self.assertEqual(channels, set([channel1.id]))
channel2 = yield self.create_channel(
self.service, self.redis, TelnetServerTransport)
channels = yield Channel.get_all(self.redis)
self.assertEqual(channels, set([channel1.id, channel2.id]))
示例2: health_status
# 需要导入模块: from junebug.channel import Channel [as 别名]
# 或者: from junebug.channel.Channel import get_all [as 别名]
def health_status(self, request):
if self.config.rabbitmq_management_interface:
def get_queues(channel_ids):
gets = []
for channel_id in channel_ids:
for sub in ['inbound', 'outbound', 'event']:
queue_name = "%s.%s" % (channel_id, sub)
get = self.rabbitmq_management_client.get_queue(
self.amqp_config['vhost'], queue_name)
gets.append(get)
return gets
def return_queue_results(results):
queues = []
stuck = False
for result in results:
queue = result[1]
if ('messages' in queue):
details = {
'name': queue['name'],
'stuck': False,
'messages': queue.get('messages'),
'rate': queue['messages_details']['rate']
}
if (details['messages'] > 0 and details['rate'] == 0):
stuck = True
details['stuck'] = True
queues.append(details)
status = 'queues ok'
code = http.OK
if stuck:
status = "queues stuck"
code = http.INTERNAL_SERVER_ERROR
return response(request, status, queues, code=code)
d = Channel.get_all(self.redis)
d.addCallback(get_queues)
d.addCallback(defer.DeferredList)
d.addCallback(return_queue_results)
return d
else:
return response(request, 'health ok', {})
示例3: get_channel_list
# 需要导入模块: from junebug.channel import Channel [as 别名]
# 或者: from junebug.channel.Channel import get_all [as 别名]
def get_channel_list(self, request):
'''List all channels'''
ids = yield Channel.get_all(self.redis)
returnValue(response(request, 'channels listed', sorted(ids)))