本文整理匯總了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"