(self, start_method)
| 155 | # Test that we can safely hold as many results as the keep_alive_queue_size |
| 156 | @params(*start_methods) |
| 157 | def test_pool_no_overwrite_batch(self, start_method): |
| 158 | groups = [MockGroup.from_callback(simple_callback, prefetch_queue_depth=0)] |
| 159 | for depth in [1, 2, 4, 8]: |
| 160 | with create_pool( |
| 161 | groups, keep_alive_queue_size=depth, num_workers=1, start_method=start_method |
| 162 | ) as pool: |
| 163 | pids = get_pids(pool) |
| 164 | pid = pids[0] |
| 165 | work_batches = [ |
| 166 | TaskArgs.make_sample(SampleRange(i, i + 1, i, 0)) for i in range(depth) |
| 167 | ] |
| 168 | task_list = [[(SampleInfo(i, 0, i, 0),)] for i in range(depth)] |
| 169 | for i, work_batch in enumerate(work_batches): |
| 170 | pool.schedule_batch(context_i=0, work_batch=work_batch) |
| 171 | assert_scheduled_num(pool.contexts[0], depth) |
| 172 | batches = [] |
| 173 | for i in range(depth): |
| 174 | batches.append(pool.receive_batch(context_i=0)) |
| 175 | assert_scheduled_num(pool.contexts[0], depth - 1 - i) |
| 176 | tasks_batches = zip(task_list, batches) |
| 177 | for tasks, batch in tasks_batches: |
| 178 | for task, sample in zip(tasks, batch): |
| 179 | np.testing.assert_array_equal(answer(pid, *task), sample) |
| 180 | |
| 181 | |
| 182 | # ################################################################################################ # |
nothing calls this directly
no test coverage detected