本文整理汇总了Python中disco.core.Disco.nodeinfo方法的典型用法代码示例。如果您正苦于以下问题:Python Disco.nodeinfo方法的具体用法?Python Disco.nodeinfo怎么用?Python Disco.nodeinfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类disco.core.Disco
的用法示例。
在下文中一共展示了Disco.nodeinfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data_gen
# 需要导入模块: from disco.core import Disco [as 别名]
# 或者: from disco.core.Disco import nodeinfo [as 别名]
import tserver, sys, time
from disco.core import Disco
def data_gen(path):
return "1 2 3\n"
def fun_map(e, params):
import time
time.sleep(100)
return []
disco = Disco(sys.argv[1])
num = sum(x['max_workers'] for x in disco.nodeinfo()['available'])
print >> sys.stderr, num, "slots available"
tserver.run_server(data_gen)
job = disco.new_job(name = "test_kill",
input = tserver.makeurl([""] * num * 2), map = fun_map)
time.sleep(10)
print >> sys.stderr, "Killing", job.name
job.kill()
time.sleep(5)
if job.jobinfo()['active'] == "dead":
print "ok"
job.purge()
else:
raise Exception("Killing failed")
示例2: Disco
# 需要导入模块: from disco.core import Disco [as 别名]
# 或者: from disco.core.Disco import nodeinfo [as 别名]
job.wait()
if mode:
raise "Input at an unknown node should "\
"not work when force_local = True"
else:
job.purge()
except JobError:
if mode:
job.purge()
else:
raise "Input at an unknown node should "\
"work when force_remote = True"
disco = Disco(sys.argv[1])
nodes = dict((n['node'], n['max_workers'])
for n in disco.nodeinfo()['available']
if not n['blacklisted'])
inputs = []
for n, m in nodes.iteritems():
inputs += ["foobar://%s/" % n] * m * 2
check_results(run(True, inputs, "forcelocal"), nodes)
check_results(run(False, inputs, "forceremote"), nodes)
check_fail(run(True, ["disco://nonexistent_node/"], "forcelocal_nonode"), True)
check_fail(run(False, ["disco://nonexistent_node/"], "forceremote_nonode"), False)
print "ok"