当前位置: 首页>>代码示例>>Python>>正文


Python Disco.nodeinfo方法代码示例

本文整理汇总了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")


开发者ID:chenhao7512,项目名称:disco,代码行数:29,代码来源:test_kill.py

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


开发者ID:davin,项目名称:disco,代码行数:30,代码来源:test_forcesched.py


注:本文中的disco.core.Disco.nodeinfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。