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


Python NodeSet.updaten方法代码示例

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


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

示例1: update

# 需要导入模块: from ClusterShell.CLI.Utils import NodeSet [as 别名]
# 或者: from ClusterShell.CLI.Utils.NodeSet import updaten [as 别名]
    def update(self):
        """Update runtime progress info"""
        wrbwinfo = ''
        if self.bytes_written > 0:
            bandwidth = self.bytes_written/(time.time() - self.start_time)
            wrbwinfo = " write: %s/s" % human_bi_bytes_unit(bandwidth)

        gws = self.task.gateways.keys()
        if gws:
            # tree mode
            act_targets = NodeSet()
            for gw, (chan, metaworkers) in self.task.gateways.iteritems():
                act_targets.updaten(mw.gwtargets[gw] for mw in metaworkers)
            cnt = len(act_targets) + len(self.task._engine.clients()) - len(gws)
            gwinfo = ' gw %d' % len(gws)
        else:
            cnt = len(self.task._engine.clients())
            gwinfo = ''
        if self.bytes_written > 0 or cnt != self.cnt_last:
            self.cnt_last = cnt
            # display completed/total clients
            towrite = 'clush: %*d/%*d%s%s\r' % (self.tslen, self.total - cnt,
                                                self.tslen, self.total, gwinfo,
                                                wrbwinfo)
            self.wholelen = len(towrite)
            sys.stderr.write(towrite)
            self.started = True
开发者ID:thiell,项目名称:clustershell,代码行数:29,代码来源:Clush.py

示例2: update

# 需要导入模块: from ClusterShell.CLI.Utils import NodeSet [as 别名]
# 或者: from ClusterShell.CLI.Utils.NodeSet import updaten [as 别名]
 def update(self):
     gws = self.task.gateways.keys()
     if gws:
         # tree mode
         act_targets = NodeSet()
         for gw, (chan, metaworkers) in self.task.gateways.iteritems():
             act_targets.updaten(mw.gwtargets[gw] for mw in metaworkers)
         cnt = len(act_targets) + len(self.task._engine.clients()) - len(gws)
         gwinfo = " gw %d" % len(gws)
     else:
         cnt = len(self.task._engine.clients())
         gwinfo = ""
     if cnt != self.cnt_last:
         self.cnt_last = cnt
         # display completed/total clients
         towrite = "clush: %*d/%*d%s\r" % (self.tslen, self.total - cnt, self.tslen, self.total, gwinfo)
         self.wholelen = len(towrite)
         sys.stderr.write(towrite)
         self.started = True
开发者ID:jasonshih,项目名称:clustershell,代码行数:21,代码来源:Clush.py

示例3: len

# 需要导入模块: from ClusterShell.CLI.Utils import NodeSet [as 别名]
# 或者: from ClusterShell.CLI.Utils.NodeSet import updaten [as 别名]
        xnodelist = [NodeSet(nodes) for nodes in options.exclude]

    for (opt, nodelist) in (('w', wnodelist), ('x', xnodelist)):
        for nodes in nodelist:
            if len(nodes) == 1 and exists(str(nodes)):
                display.vprint_err(VERB_STD, "Warning: using '-%s %s' and "
                                   "local path '%s' exists, was it expanded "
                                   "by the shell?" % (opt, nodes, nodes))

    # --hostfile support (#235)
    for opt_hostfile in options.hostfile:
        try:
            fnodeset = NodeSet()
            hostfile = open(opt_hostfile)
            for line in hostfile.read().splitlines():
                fnodeset.updaten(nodes for nodes in line.split())
            hostfile.close()
            display.vprint_err(VERB_DEBUG,
                               "Using nodeset %s from hostfile %s"
                               % (fnodeset, opt_hostfile))
            wnodelist.append(fnodeset)
        except IOError, exc:
            # re-raise as OSError to be properly handled
            errno, strerror = exc.args
            raise OSError(errno, strerror, exc.filename)

    # Instantiate target nodeset from command line and hostfile
    nodeset_base = NodeSet.fromlist(wnodelist)
    # Instantiate filter nodeset (command line only)
    nodeset_exclude = NodeSet.fromlist(xnodelist)
开发者ID:thiell,项目名称:clustershell,代码行数:32,代码来源:Clush.py


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