當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。