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