MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_pool_multi_task

Method test_pool_multi_task

dali/test/python/test_pool.py:141–153  ·  view source on GitHub ↗
(self, start_method)

Source from the content-addressed store, hash-verified

139
140 @params(*start_methods)
141 def test_pool_multi_task(self, start_method):
142 groups = [MockGroup.from_callback(simple_callback)]
143 with create_pool(
144 groups, keep_alive_queue_size=1, num_workers=1, start_method=start_method
145 ) as pool:
146 pids = get_pids(pool)
147 pid = pids[0]
148 tasks = [(SampleInfo(i, i, 0, 0),) for i in range(10)]
149 work_batch = TaskArgs.make_sample(SampleRange(0, 10, 0, 0))
150 pool.schedule_batch(context_i=0, work_batch=work_batch)
151 batch = pool.receive_batch(context_i=0)
152 for task, sample in zip(tasks, batch):
153 np.testing.assert_array_equal(answer(pid, *task), sample)
154
155 # Test that we can safely hold as many results as the keep_alive_queue_size
156 @params(*start_methods)

Callers

nothing calls this directly

Calls 9

SampleInfoClass · 0.90
SampleRangeClass · 0.90
create_poolFunction · 0.85
get_pidsFunction · 0.85
answerFunction · 0.85
from_callbackMethod · 0.80
make_sampleMethod · 0.80
receive_batchMethod · 0.80
schedule_batchMethod · 0.45

Tested by

no test coverage detected