Beispiel #1
0
def shutdown(poolclass, n):
	e = Executor(poolclass, map(lambda x: x*x), poolsize=2)
	e.submit(*range(n))
	e.shutdown()
	print e.result >> list
	assert e.inputfeeder_thread.is_alive() == False
	assert e.resulttracker_thread.is_alive() == False
	assert e.failuretracker_thread.is_alive() == False
Beispiel #2
0
def cancel(poolclass, n):
	e = Executor(poolclass, map(lambda x: x*x), poolsize=2)
	t1 = threading.Thread(target=lambda: e.submit(*range(n//2)))
	t2 = threading.Thread(target=lambda: e.submit(*range(n//2)))
	t1.start()
	t2.start()
	cancelled = e.cancel(*range(0, n, 2))
	t1.join()
	t2.join()
	e.close()
	completed = len(e.result >> list)
	print completed, cancelled
	assert completed + cancelled == n
Beispiel #3
0
def shutdown(poolclass, n):
    e = Executor(poolclass, map(lambda x: x * x), poolsize=2)
    e.submit(*range(n))
    e.shutdown()
    print e.result >> list
    assert e.inputfeeder_thread.is_alive() == False
    assert e.resulttracker_thread.is_alive() == False
    assert e.failuretracker_thread.is_alive() == False
Beispiel #4
0
def cancel(poolclass, n):
    e = Executor(poolclass, map(lambda x: x * x), poolsize=2)
    t1 = threading.Thread(target=lambda: e.submit(*range(n // 2)))
    t2 = threading.Thread(target=lambda: e.submit(*range(n // 2)))
    t1.start()
    t2.start()
    cancelled = e.cancel(*range(0, n, 2))
    t1.join()
    t2.join()
    e.close()
    completed = len(e.result >> list)
    print completed, cancelled
    assert completed + cancelled == n
Beispiel #5
0
def submit(poolclass, n):
	e = Executor(poolclass, map(lambda x: x*x), poolsize=3)
	e.submit(*range(n))
	e.close()
	assert sum(e.result) == result[n]
Beispiel #6
0
def submit(poolclass, n):
    e = Executor(poolclass, map(lambda x: x * x), poolsize=3)
    e.submit(*range(n))
    e.close()
    assert sum(e.result) == result[n]