Lines Matching full:executor
114 self.executor = self.executor_type(
119 self.executor = self.executor_type(
125 self.executor.shutdown(wait=True)
126 self.executor = None
139 # Make sure that the executor is ready to do work before running the
141 futures = [self.executor.submit(time.sleep, 0.1)
207 futures = [self.executor.submit(get_init_status)
235 future = self.executor.submit(get_init_status)
237 # Perhaps the executor is already broken
242 # At some point, the executor should break
244 while not self.executor._broken:
246 self.fail("executor not broken after 5 s.")
250 self.executor.submit(get_init_status)
279 self.executor.shutdown()
281 self.executor.submit,
335 fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)]
336 self.executor.shutdown()
346 self.executor.submit(mul, 21, 2)
347 self.executor.submit(mul, 6, 7)
348 self.executor.submit(mul, 3, 14)
349 self.assertEqual(len(self.executor._threads), 3)
350 self.executor.shutdown()
351 for t in self.executor._threads:
356 executor = e
360 for t in executor._threads:
364 executor = futures.ThreadPoolExecutor(max_workers=5)
365 executor.map(abs, range(-5, 5))
366 threads = executor._threads
367 del executor
373 executor = futures.ThreadPoolExecutor(
375 executor.map(abs, range(-5, 5))
376 threads = executor._threads
377 del executor
384 executor = futures.ThreadPoolExecutor(max_workers=5)
385 executor.map(abs, range(-5, 5))
386 threads = executor._threads
387 del executor
401 self.executor.submit(mul, 21, 2)
402 self.executor.submit(mul, 6, 7)
403 self.executor.submit(mul, 3, 14)
404 self.assertEqual(len(self.executor._processes), 5)
405 processes = self.executor._processes
406 self.executor.shutdown()
421 executor = futures.ProcessPoolExecutor(max_workers=5)
422 list(executor.map(abs, range(-5, 5)))
423 queue_management_thread = executor._queue_management_thread
424 processes = executor._processes
425 call_queue = executor._call_queue
426 queue_management_thread = executor._queue_management_thread
427 del executor
429 # Make sure that all the executor resources were properly cleaned by
446 future1 = self.executor.submit(mul, 21, 2)
447 future2 = self.executor.submit(time.sleep, 1.5)
457 future1 = self.executor.submit(time.sleep, 1.5)
469 future1 = self.executor.submit(mul, 2, 21)
470 future2 = self.executor.submit(sleep_and_raise, 1.5)
471 future3 = self.executor.submit(time.sleep, 3)
481 future1 = self.executor.submit(divmod, 21, 0)
482 future2 = self.executor.submit(time.sleep, 1.5)
497 future1 = self.executor.submit(time.sleep, 2)
507 future1 = self.executor.submit(divmod, 2, 0)
508 future2 = self.executor.submit(mul, 2, 21)
526 future1 = self.executor.submit(mul, 6, 7)
527 future2 = self.executor.submit(time.sleep, 6)
555 fs = {self.executor.submit(future_func) for i in range(100)}
571 future1 = self.executor.submit(mul, 2, 21)
572 future2 = self.executor.submit(mul, 7, 6)
587 future1 = self.executor.submit(time.sleep, 2)
609 future1 = self.executor.submit(time.sleep, 2)
652 # Executor.shutdown() and context manager usage is tested by
655 future = self.executor.submit(pow, 2, 8)
659 future = self.executor.submit(mul, 2, y=8)
664 list(self.executor.map(pow, range(10), range(10))),
668 list(self.executor.map(pow, range(10), range(10), chunksize=3)),
672 i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5])
680 for i in self.executor.map(time.sleep,
695 self.executor.map(str, [2] * (self.worker_count + 1))
696 self.executor.shutdown()
707 self.executor.submit(my_object.my_method)
724 for obj in self.executor.map(make_dummy_object, range(10)):
737 self.executor.map(record_finished, range(10))
738 self.executor.shutdown(wait=True)
742 executor = self.executor_type()
743 self.assertEqual(executor._max_workers,
751 futures = [self.executor.submit(time.sleep, 3)]
753 p = next(iter(self.executor._processes.values()))
758 self.assertRaises(BrokenProcessPool, self.executor.submit, pow, 2, 8)
762 list(self.executor.map(pow, range(40), range(40), chunksize=-1))
766 list(self.executor.map(pow, range(40), range(40), chunksize=6)),
769 list(self.executor.map(pow, range(40), range(40), chunksize=50)),
772 list(self.executor.map(pow, range(40), range(40), chunksize=40)),
783 future = self.executor.submit(self._test_traceback)
806 future = self.executor.submit(id, obj)
894 def _fail_on_deadlock(self, executor): argument
896 # executor is in a deadlock state and forcefully clean all its
904 for p in executor._processes.values():
906 # This should be safe to call executor.shutdown here as all possible
908 executor.shutdown(wait=True)
910 self.fail(f"Executor deadlock:\n\n{tb}")
915 self.executor.shutdown(wait=True)
953 executor = self.executor_type(
955 res = executor.submit(func, *args)
961 # consider that the executor is in a deadlock state
962 self._fail_on_deadlock(executor)
963 executor.shutdown(wait=True)
968 self.executor.shutdown(wait=True)
970 mp_context=get_context(self.ctx)) as executor:
971 self.executor = executor # Allow clean up in fail_on_deadlock
972 f = executor.submit(_crash, delay=.1)
973 executor.shutdown(wait=True)