本文整理汇总了Python中models.Node.find方法的典型用法代码示例。如果您正苦于以下问题:Python Node.find方法的具体用法?Python Node.find怎么用?Python Node.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Node
的用法示例。
在下文中一共展示了Node.find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: app_node_container_status
# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import find [as 别名]
def app_node_container_status(host, cid):
try:
node = Node.find(host)
except ValueError:
return Response("{} is not in the cluster".format(node), status=422)
container = Container.find(node, cid)
return json.dumps(container.status())
示例2: app_node_status
# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import find [as 别名]
def app_node_status(host):
try:
node = Node.find(host)
except ValueError:
return Response("{} is not in the cluster".format(node), status=422)
return json.dumps(node.status())
示例3: app_delete_container
# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import find [as 别名]
def app_delete_container(host, cid):
try:
node = Node.find(host)
except ValueError:
return Response("{} is not in the cluster".format(host), status=422)
Container.find(node, cid).delete()
return Response("", status=204)
示例4: app_migrate_container
# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import find [as 别名]
def app_migrate_container(host, cid):
try:
node = Node.find(host)
except ValueError:
return Response("{} is not in the cluster".format(host), status=422)
container = Container.find(node, cid)
nodes = Node.all()
strategy = AllocationStrategy.from_name(current_app.config['strategy'])
selected_node = strategy.select_node(nodes, container.service())
new_container = container.migrate(selected_node)
return Response(json.dumps(
{"Started": new_container,
"Stopped": container}, cls=ContainerJSONEncoder), status=201)
示例5: app_node_containers
# 需要导入模块: from models import Node [as 别名]
# 或者: from models.Node import find [as 别名]
def app_node_containers(host):
try:
node = Node.find(host)
except ValueError:
return Response("{} is not in the cluster".format(node), status=422)
return Response(json.dumps(node.containers(), cls=ContainerJSONEncoder), status=200)