• Home
  • Raw
  • Download

Lines Matching full:executor

126             self.executor = self.executor_type(
131 self.executor = self.executor_type(
137 self.executor.shutdown(wait=True)
138 self.executor = None
151 # Make sure that the executor is ready to do work before running the
153 futures = [self.executor.submit(time.sleep, 0.1)
234 futures = [self.executor.submit(get_init_status)
262 future = self.executor.submit(get_init_status)
264 # Perhaps the executor is already broken
269 # At some point, the executor should break
271 while not self.executor._broken:
273 self.fail("executor not broken after 5 s.")
277 self.executor.submit(get_init_status)
306 self.executor.shutdown()
308 self.executor.submit,
362 fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)]
363 self.executor.shutdown()
368 executor = self.executor_type(max_workers=3)
369 fs = [executor.submit(time.sleep, .1) for _ in range(50)]
370 executor.shutdown(cancel_futures=True)
421 self.executor.submit(acquire_lock, sem)
422 self.assertEqual(len(self.executor._threads), 3)
425 self.executor.shutdown()
426 for t in self.executor._threads:
431 executor = e
435 for t in executor._threads:
439 executor = futures.ThreadPoolExecutor(max_workers=5)
440 res = executor.map(abs, range(-5, 5))
441 threads = executor._threads
442 del executor
448 # executor got shutdown.
452 # Ensure that the executor cleans up the threads when calling
454 executor = futures.ThreadPoolExecutor(max_workers=5)
455 res = executor.map(abs, range(-5, 5))
456 threads = executor._threads
457 executor.shutdown(wait=False)
462 # executor got shutdown.
467 executor = futures.ThreadPoolExecutor(
469 executor.map(abs, range(-5, 5))
470 threads = executor._threads
471 del executor
479 executor = futures.ThreadPoolExecutor(max_workers=5)
480 executor.map(abs, range(-5, 5))
481 threads = executor._threads
482 del executor
519 self.executor.submit(acquire_lock, sem)
520 self.assertEqual(len(self.executor._processes), 3)
523 processes = self.executor._processes
524 self.executor.shutdown()
539 executor = futures.ProcessPoolExecutor(max_workers=5)
540 res = executor.map(abs, range(-5, 5))
541 executor_manager_thread = executor._executor_manager_thread
542 processes = executor._processes
543 call_queue = executor._call_queue
544 executor_manager_thread = executor._executor_manager_thread
545 del executor
548 # Make sure that all the executor resources were properly cleaned by
556 # executor got shutdown.
560 # Ensure that the executor cleans up the processes when calling
562 executor = futures.ProcessPoolExecutor(max_workers=5)
563 res = executor.map(abs, range(-5, 5))
564 processes = executor._processes
565 call_queue = executor._call_queue
566 executor_manager_thread = executor._executor_manager_thread
567 executor.shutdown(wait=False)
569 # Make sure that all the executor resources were properly cleaned by
576 # Make sure the results were all computed before the executor got
590 future = self.executor.submit(time.sleep, 1.5)
598 future1 = self.executor.submit(mul, 21, 2)
599 future2 = self.executor.submit(time.sleep, 1.5)
609 future1 = self.executor.submit(time.sleep, 1.5)
621 future1 = self.executor.submit(mul, 2, 21)
622 future2 = self.executor.submit(sleep_and_raise, 1.5)
623 future3 = self.executor.submit(time.sleep, 3)
633 future1 = self.executor.submit(divmod, 21, 0)
634 future2 = self.executor.submit(time.sleep, 1.5)
649 future1 = self.executor.submit(time.sleep, 2)
659 future1 = self.executor.submit(divmod, 2, 0)
660 future2 = self.executor.submit(mul, 2, 21)
678 future1 = self.executor.submit(mul, 6, 7)
679 future2 = self.executor.submit(time.sleep, 6)
707 fs = {self.executor.submit(future_func) for i in range(100)}
723 future1 = self.executor.submit(mul, 2, 21)
724 future2 = self.executor.submit(mul, 7, 6)
739 future1 = self.executor.submit(time.sleep, 2)
761 future1 = self.executor.submit(time.sleep, 2)
806 # Executor.shutdown() and context manager usage is tested by
809 future = self.executor.submit(pow, 2, 8)
813 future = self.executor.submit(mul, 2, y=8)
815 future = self.executor.submit(capture, 1, self=2, fn=3)
818 self.executor.submit(fn=capture, arg=1)
820 self.executor.submit(arg=1)
824 list(self.executor.map(pow, range(10), range(10))),
828 list(self.executor.map(pow, range(10), range(10), chunksize=3)),
832 i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5])
840 for i in self.executor.map(time.sleep,
855 self.executor.map(str, [2] * (self.worker_count + 1))
856 self.executor.shutdown()
867 self.executor.submit(my_object.my_method)
884 for obj in self.executor.map(make_dummy_object, range(10)):
898 self.executor.map(record_finished, range(10))
899 self.executor.shutdown(wait=True)
903 executor = self.executor_type()
905 self.assertEqual(executor._max_workers, expected)
908 executor = self.executor_type(4)
913 for i in range(15 * executor._max_workers):
914 executor.submit(acquire_lock, sem)
915 self.assertEqual(len(executor._threads), executor._max_workers)
916 for i in range(15 * executor._max_workers):
918 executor.shutdown(wait=True)
921 executor = self.executor_type()
922 executor.submit(mul, 21, 2).result()
923 executor.submit(mul, 6, 7).result()
924 executor.submit(mul, 3, 14).result()
925 self.assertEqual(len(executor._threads), 1)
926 executor.shutdown(wait=True)
954 futures = [self.executor.submit(time.sleep, 3)]
956 p = next(iter(self.executor._processes.values()))
961 self.assertRaises(BrokenProcessPool, self.executor.submit, pow, 2, 8)
965 list(self.executor.map(pow, range(40), range(40), chunksize=-1))
969 list(self.executor.map(pow, range(40), range(40), chunksize=6)),
972 list(self.executor.map(pow, range(40), range(40), chunksize=50)),
975 list(self.executor.map(pow, range(40), range(40), chunksize=40)),
986 future = self.executor.submit(self._test_traceback)
1011 future = self.executor.submit(id, obj)
1025 executor = self.executor_type(4)
1028 job_count = 15 * executor._max_workers
1031 executor.submit(sem.acquire)
1032 self.assertEqual(len(executor._processes), executor._max_workers)
1036 executor.shutdown()
1039 executor = self.executor_type(4)
1040 executor.submit(mul, 21, 2).result()
1041 executor.submit(mul, 6, 7).result()
1042 executor.submit(mul, 3, 14).result()
1043 self.assertEqual(len(executor._processes), 1)
1044 executor.shutdown()
1047 executor = self.executor_type(4)
1048 executor.submit(mul, 12, 7).result()
1049 executor.submit(mul, 33, 25)
1050 executor.submit(mul, 25, 26).result()
1051 executor.submit(mul, 18, 29)
1052 self.assertLessEqual(len(executor._processes), 2)
1053 executor.shutdown()
1132 def _fail_on_deadlock(self, executor): argument
1134 # executor is in a deadlock state and forcefully clean all its
1142 for p in executor._processes.values():
1144 # This should be safe to call executor.shutdown here as all possible
1146 executor.shutdown(wait=True)
1148 self.fail(f"Executor deadlock:\n\n{tb}")
1153 self.executor.shutdown(wait=True)
1155 executor = self.executor_type(
1157 res = executor.submit(func, *args)
1170 # consider that the executor is in a deadlock state
1171 self._fail_on_deadlock(executor)
1172 executor.shutdown(wait=True)
1233 self.executor.shutdown(wait=True)
1235 mp_context=get_context(self.ctx)) as executor:
1236 self.executor = executor # Allow clean up in fail_on_deadlock
1237 f = executor.submit(_crash, delay=.1)
1238 executor.shutdown(wait=True)
1246 self.executor.shutdown(wait=True)
1248 mp_context=get_context(self.ctx)) as executor:
1249 self.executor = executor # Allow clean up in fail_on_deadlock
1251 # Start the executor and get the executor_manager_thread to collect
1254 executor.submit(id, 42).result()
1255 executor_manager = executor._executor_manager_thread
1257 # Submit a task that fails at pickle and shutdown the executor
1259 f = executor.submit(id, ErrorAtPickle())
1260 executor.shutdown(wait=False)
1264 # Make sure the executor is eventually shutdown and do not leave