本文整理汇总了Python中disco.core.Disco.request方法的典型用法代码示例。如果您正苦于以下问题:Python Disco.request方法的具体用法?Python Disco.request怎么用?Python Disco.request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类disco.core.Disco
的用法示例。
在下文中一共展示了Disco.request方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: submit
# 需要导入模块: from disco.core import Disco [as 别名]
# 或者: from disco.core.Disco import request [as 别名]
def submit(master, jobpack):
from disco.settings import DiscoSettings
from disco.core import Disco
settings = DiscoSettings()
dmaster = Disco(master)
print "Submitting job to ", master
status, response = json.loads(dmaster.request('/disco/job/new', jobpack))
if status != 'ok':
errmsg('Failed to start job. Server replied: %s' % response)
print response
示例2: test
# 需要导入模块: from disco.core import Disco [as 别名]
# 或者: from disco.core.Disco import request [as 别名]
def test():
num = sum(x['max_workers'] for x in disco.nodeinfo()['available'])
inputs = range(num * 2)
job = disco.new_job(
name = "test_missingnode",
map = fun_map,
input = tserver.makeurl(inputs))
results = job.wait()
s = sum(int(k) for k, v in result_iterator(results))
correct = sum(range(num * 2))
if s != correct:
raise Exception("Invalid result. Got %d, expected %d" %\
(s, correct))
job.purge()
disco = Disco(sys.argv[1])
tserver.run_server(data_gen)
orig_config = add_node()
try:
test()
except:
raise
finally:
disco.request("/disco/ctrl/save_config_table",
json.dumps(orig_config))
print "ok"