當前位置: 首頁>>代碼示例>>Python>>正文


Python Disco.request方法代碼示例

本文整理匯總了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
開發者ID:pombredanne,項目名稱:odisco,代碼行數:12,代碼來源:discojob.py

示例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"

開發者ID:chenhao7512,項目名稱:disco,代碼行數:31,代碼來源:test_missingnode.py


注:本文中的disco.core.Disco.request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。