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")
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")
def apps(request): node = Service('node') list_ = yield node.list() yield render(request, 'list.html', { 'apps': list_ })
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)