本文整理汇总了Python中cocaine.services.Service.list方法的典型用法代码示例。如果您正苦于以下问题:Python Service.list方法的具体用法?Python Service.list怎么用?Python Service.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cocaine.services.Service
的用法示例。
在下文中一共展示了Service.list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import list [as 别名]
def main():
warning = "1; app status broken: "
error = "2; depth is full: "
node = Service("node")
try:
chan = yield node.list()
except:
print "1; error while connect to service node"
exit(0)
app_list = yield chan.rx.get()
for name in app_list:
app = Service(name)
try:
chan = yield app.info()
info = yield chan.rx.get()
if info["queue"]["depth"] == info["queue"]["capacity"]:
if name != "v012-karma":
error = error + name + ","
except:
warning = warning + name + ","
if error != "2; depth is full: ":
print (error)
elif warning != "1; app status broken: ":
print (warning)
else:
print ("0;Ok")
示例2: f
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import list [as 别名]
def f():
io = IOLoop.current()
node = Service("node", endpoints=[["localhost", 10053]], io_loop=io)
channel = yield node.list()
app_list = yield channel.rx.get()
assert isinstance(app_list, list)
raise gen.Return("OK")
示例3: apps
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import list [as 别名]
def apps(request):
node = Service('node')
list_ = yield node.list()
yield render(request, 'list.html', {
'apps': list_
})
示例4: test_node_service
# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import list [as 别名]
def test_node_service():
io = CocaineIO.instance()
node = Service("node", host="localhost", port=10053, loop=io)
channel = node.list().wait(1)
app_list = channel.rx.get().wait(1)
assert isinstance(app_list, list), "invalid app_list type `%s` %s " % (type(app_list), app_list)