Exemplo n.º 1
0
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")


Exemplo n.º 2
0
                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"