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


Python Node.get_all_nodes方法代码示例

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


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

示例1: find_orchestrator

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import get_all_nodes [as 别名]
def find_orchestrator():
    in_nodes = Node.get_all_nodes(check_active=True)
    for n in in_nodes:
        if "orchestrator" in n.name:
            global orchestrator
            orchestrator = n
            return
开发者ID:cmantas,项目名称:tiramola_v3,代码行数:9,代码来源:CassandraCluster.py

示例2: resume_cluster

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import get_all_nodes [as 别名]
def resume_cluster():
    """
    Re-loads the cluster representation based on the VMs pre-existing on the IaaS and the 'save_file'
    """
    log.info("Loading info from the IaaS")
    global nodes, seeds, stash
    if not isfile(save_file):
        log.info("No existing created cluster")
        return
    saved_cluster = loads(open(save_file, 'r').read())
    saved_nodes = list(set(saved_cluster['nodes']))
    saved_seeds = list(set(saved_cluster['seeds']))
    saved_stash = list(set(saved_cluster['stash']))
    nodes[:] = []
    seeds[:] = []

    in_nodes = Node.get_all_nodes(check_active=True)
    #check that all saved nodes actually exist
    for n in saved_nodes:
        if n not in [i.name for i in in_nodes]:
            log.error("node %s does actually exist in the cloud, re-create the cluster" % n)
            remove(save_file)
            exit(-1)
    for n in in_nodes:
        if n.name not in saved_nodes+saved_seeds:
            if n.name in saved_stash:
                stash.append(n)
            if "orchestrator" in n.name:
                global orchestrator
                orchestrator = n
            continue
        else:
            if n.type == "seed":
                seeds.append(n)
            elif n.type == "node": nodes.append(n)
    #sort nodes by name
    nodes.sort(key=lambda x: x.name)
    stash.sort(key=lambda x: x.name)
开发者ID:cmantas,项目名称:tiramola_v3,代码行数:40,代码来源:CassandraCluster.py

示例3: resume_cluster

# 需要导入模块: from Node import Node [as 别名]
# 或者: from Node.Node import get_all_nodes [as 别名]
    def resume_cluster(self):
        """
        Re-loads the cluster representation based on the VMs pre-existing on the IaaS and the 'save_file'
        """
        self.log.info("Loading info from the IaaS")
        if not isfile(self.save_file):
            self.log.info("No existing created cluster")
            saved_nodes = []
        else:
            saved_cluster = loads(open(self.save_file, 'r').read())
            saved_nodes = saved_cluster['clients']

        in_nodes = Node.get_all_nodes(check_active=True)
        for n in in_nodes:
            if n.name not in saved_nodes:
                if "orchestrator" in n.name:
                    global orchestrator
                    orchestrator = n
                    self.log.debug('Found orchestrator %s' % n.name)
                continue
            else:
                self.all_nodes.append(n)
        #sort nodes by name
        self.all_nodes.sort(key=lambda x: x.name)
开发者ID:cmantas,项目名称:tiramola_v3,代码行数:26,代码来源:ClientsCluster.py


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