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


Python Service.list方法代码示例

本文整理汇总了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")
开发者ID:borislitv,项目名称:cocaine-script,代码行数:28,代码来源:cocaine-check-depth.py

示例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")
开发者ID:gabrielferreira,项目名称:cocaine-framework-python,代码行数:9,代码来源:test_main.py

示例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_
    })
开发者ID:mwf,项目名称:cocaine-framework-python,代码行数:8,代码来源:views.py

示例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)
开发者ID:mwf,项目名称:cocaine-framework-python,代码行数:8,代码来源:test_main.py


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