本文整理汇总了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
示例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
示例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)