MCPcopy Index your code
hub / github.com/dask/dask / test_threaded_within_thread

Function test_threaded_within_thread

dask/tests/test_threaded.py:83–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81
82
83def test_threaded_within_thread():
84 L = []
85
86 def f(i):
87 result = get({"x": (lambda: i,)}, "x", num_workers=2)
88 L.append(result)
89
90 before = threading.active_count()
91
92 for _ in range(20):
93 t = threading.Thread(target=f, args=(1,))
94 t.daemon = True
95 t.start()
96 t.join()
97 assert L == [1]
98 del L[:]
99
100 start = time() # wait for most threads to join
101 while threading.active_count() > before + 10:
102 sleep(0.01)
103 assert time() < start + 5
104
105
106def test_dont_spawn_too_many_threads():

Callers

nothing calls this directly

Calls 2

startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…