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


Python Pod.get方法代码示例

本文整理汇总了Python中eru.models.Pod.get方法的典型用法代码示例。如果您正苦于以下问题:Python Pod.get方法的具体用法?Python Pod.get怎么用?Python Pod.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eru.models.Pod的用法示例。


在下文中一共展示了Pod.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_pod

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def get_pod(id_or_name):
    if id_or_name.isdigit():
        pod = Pod.get(int(id_or_name))
    else:
        pod = Pod.get_by_name(id_or_name)
    if not pod:
        raise EruAbortException(consts.HTTP_NOT_FOUND, 'Pod %s not found' % id_or_name)
    return pod
开发者ID:linzhonghong,项目名称:eru-core,代码行数:10,代码来源:pod.py

示例2: _get_pod

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def _get_pod(id_or_name):
    if id_or_name.isdigit():
        pod = Pod.get(int(id_or_name))
    else:
        pod = Pod.get_by_name(id_or_name)
    if not pod:
        abort(404, 'Pod %s not found' % id_or_name)
    return pod
开发者ID:CMGS,项目名称:eru-core,代码行数:10,代码来源:pod.py

示例3: list_pod_hosts

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def list_pod_hosts(id_or_name):
    if id_or_name.isdigit():
        pod = Pod.get(int(id_or_name))
    else:
        pod = Pod.get_by_name(id_or_name)
    if not pod:
        raise EruAbortException(consts.HTTP_NOT_FOUND, 'Pod %s not found' % id_or_name)
    show_all = request.args.get('all', type=bool, default=False)
    return pod.list_hosts(g.start, g.limit, show_all=show_all)
开发者ID:linzhonghong,项目名称:eru-core,代码行数:11,代码来源:pod.py

示例4: get_pod_resource

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def get_pod_resource(pod_id):
    pod = Pod.get(pod_id)
    if not pod:
        raise EruAbortException(code.HTTP_NOT_FOUND, 'Pod %s not found' % pod_id)
    core_count = sum(len(h.cores.all()) for h in pod.hosts.all())
    free_cores = [c for h in pod.hosts.all() for c in h.get_free_cores()]
    return {
        'core_count': core_count,
        'free_cores': [c.label for c in free_cores],
    }
开发者ID:mackjoner,项目名称:eru-core,代码行数:12,代码来源:resource.py

示例5: get_pod_resource

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def get_pod_resource(pod_id):
    pod = Pod.get(pod_id)
    if not pod:
        abort(404, 'Pod %s not found' % pod_id)

    core_count = sum(len(h.cores) for h in pod.hosts.all())
    free_excluded_cores = [c for h in pod.hosts.all() for c in h.get_free_cores()[0]]
    free_shared_cores = [c for h in pod.hosts.all() for c in h.get_free_cores()[1]]
    return {
        'core_count': core_count,
        'free_excluded_cores': [c.label for c in free_excluded_cores],
        'free_shared_cores': [c.label for c in free_shared_cores],
    }
开发者ID:CMGS,项目名称:eru-core,代码行数:15,代码来源:resource.py

示例6: _get_pod

# 需要导入模块: from eru.models import Pod [as 别名]
# 或者: from eru.models.Pod import get [as 别名]
def _get_pod(id_or_name):
    pod = Pod.get(id_or_name) or Pod.get_by_name(id_or_name)
    if not pod:
        abort(404, 'Pod %s not found' % id_or_name)
    return pod
开发者ID:timfeirg,项目名称:eru-core,代码行数:7,代码来源:pod.py


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