• Home
  • Raw
  • Download

Lines Matching full:executor

120             self.executor = self.executor_type(
125 self.executor = self.executor_type(
131 self.executor.shutdown(wait=True)
132 self.executor = None
145 # Make sure that the executor is ready to do work before running the
147 futures = [self.executor.submit(time.sleep, 0.1)
228 futures = [self.executor.submit(get_init_status)
256 future = self.executor.submit(get_init_status)
258 # Perhaps the executor is already broken
263 # At some point, the executor should break
265 while not self.executor._broken:
267 self.fail("executor not broken after 5 s.")
271 self.executor.submit(get_init_status)
300 self.executor.shutdown()
302 self.executor.submit,
356 fs = [self.executor.submit(time.sleep, 0.1) for _ in range(50)]
357 self.executor.shutdown()
362 executor = self.executor_type(max_workers=3)
363 fs = [executor.submit(time.sleep, .1) for _ in range(50)]
364 executor.shutdown(cancel_futures=True)
415 self.executor.submit(acquire_lock, sem)
416 self.assertEqual(len(self.executor._threads), 3)
419 self.executor.shutdown()
420 for t in self.executor._threads:
425 executor = e
429 for t in executor._threads:
433 executor = futures.ThreadPoolExecutor(max_workers=5)
434 res = executor.map(abs, range(-5, 5))
435 threads = executor._threads
436 del executor
442 # executor got shutdown.
446 # Ensure that the executor cleans up the threads when calling
448 executor = futures.ThreadPoolExecutor(max_workers=5)
449 res = executor.map(abs, range(-5, 5))
450 threads = executor._threads
451 executor.shutdown(wait=False)
456 # executor got shutdown.
461 executor = futures.ThreadPoolExecutor(
463 executor.map(abs, range(-5, 5))
464 threads = executor._threads
465 del executor
473 executor = futures.ThreadPoolExecutor(max_workers=5)
474 executor.map(abs, range(-5, 5))
475 threads = executor._threads
476 del executor
513 self.executor.submit(acquire_lock, sem)
514 self.assertEqual(len(self.executor._processes), 3)
517 processes = self.executor._processes
518 self.executor.shutdown()
533 executor = futures.ProcessPoolExecutor(max_workers=5)
534 res = executor.map(abs, range(-5, 5))
535 executor_manager_thread = executor._executor_manager_thread
536 processes = executor._processes
537 call_queue = executor._call_queue
538 executor_manager_thread = executor._executor_manager_thread
539 del executor
542 # Make sure that all the executor resources were properly cleaned by
550 # executor got shutdown.
554 # Ensure that the executor cleans up the processes when calling
556 executor = futures.ProcessPoolExecutor(max_workers=5)
557 res = executor.map(abs, range(-5, 5))
558 processes = executor._processes
559 call_queue = executor._call_queue
560 executor_manager_thread = executor._executor_manager_thread
561 executor.shutdown(wait=False)
563 # Make sure that all the executor resources were properly cleaned by
570 # Make sure the results were all computed before the executor got
584 future = self.executor.submit(time.sleep, 1.5)
592 future1 = self.executor.submit(mul, 21, 2)
593 future2 = self.executor.submit(time.sleep, 1.5)
603 future1 = self.executor.submit(time.sleep, 1.5)
615 future1 = self.executor.submit(mul, 2, 21)
616 future2 = self.executor.submit(sleep_and_raise, 1.5)
617 future3 = self.executor.submit(time.sleep, 3)
627 future1 = self.executor.submit(divmod, 21, 0)
628 future2 = self.executor.submit(time.sleep, 1.5)
643 future1 = self.executor.submit(time.sleep, 2)
653 future1 = self.executor.submit(divmod, 2, 0)
654 future2 = self.executor.submit(mul, 2, 21)
672 future1 = self.executor.submit(mul, 6, 7)
673 future2 = self.executor.submit(time.sleep, 6)
701 fs = {self.executor.submit(future_func) for i in range(100)}
717 future1 = self.executor.submit(mul, 2, 21)
718 future2 = self.executor.submit(mul, 7, 6)
733 future1 = self.executor.submit(time.sleep, 2)
755 future1 = self.executor.submit(time.sleep, 2)
800 # Executor.shutdown() and context manager usage is tested by
803 future = self.executor.submit(pow, 2, 8)
807 future = self.executor.submit(mul, 2, y=8)
809 future = self.executor.submit(capture, 1, self=2, fn=3)
812 self.executor.submit(fn=capture, arg=1)
814 self.executor.submit(arg=1)
818 list(self.executor.map(pow, range(10), range(10))),
822 list(self.executor.map(pow, range(10), range(10), chunksize=3)),
826 i = self.executor.map(divmod, [1, 1, 1, 1], [2, 3, 0, 5])
834 for i in self.executor.map(time.sleep,
849 self.executor.map(str, [2] * (self.worker_count + 1))
850 self.executor.shutdown()
861 self.executor.submit(my_object.my_method)
878 for obj in self.executor.map(make_dummy_object, range(10)):
892 self.executor.map(record_finished, range(10))
893 self.executor.shutdown(wait=True)
897 executor = self.executor_type()
899 self.assertEqual(executor._max_workers, expected)
902 executor = self.executor_type(4)
907 for i in range(15 * executor._max_workers):
908 executor.submit(acquire_lock, sem)
909 self.assertEqual(len(executor._threads), executor._max_workers)
910 for i in range(15 * executor._max_workers):
912 executor.shutdown(wait=True)
915 executor = self.executor_type()
916 executor.submit(mul, 21, 2).result()
917 executor.submit(mul, 6, 7).result()
918 executor.submit(mul, 3, 14).result()
919 self.assertEqual(len(executor._threads), 1)
920 executor.shutdown(wait=True)
948 futures = [self.executor.submit(time.sleep, 3)]
950 p = next(iter(self.executor._processes.values()))
955 self.assertRaises(BrokenProcessPool, self.executor.submit, pow, 2, 8)
959 list(self.executor.map(pow, range(40), range(40), chunksize=-1))
963 list(self.executor.map(pow, range(40), range(40), chunksize=6)),
966 list(self.executor.map(pow, range(40), range(40), chunksize=50)),
969 list(self.executor.map(pow, range(40), range(40), chunksize=40)),
980 future = self.executor.submit(self._test_traceback)
1005 future = self.executor.submit(id, obj)
1019 executor = self.executor_type(4)
1022 job_count = 15 * executor._max_workers
1025 executor.submit(sem.acquire)
1026 self.assertEqual(len(executor._processes), executor._max_workers)
1030 executor.shutdown()
1033 executor = self.executor_type(4)
1034 executor.submit(mul, 21, 2).result()
1035 executor.submit(mul, 6, 7).result()
1036 executor.submit(mul, 3, 14).result()
1037 self.assertEqual(len(executor._processes), 1)
1038 executor.shutdown()
1041 executor = self.executor_type(4)
1042 executor.submit(mul, 12, 7).result()
1043 executor.submit(mul, 33, 25)
1044 executor.submit(mul, 25, 26).result()
1045 executor.submit(mul, 18, 29)
1046 self.assertLessEqual(len(executor._processes), 2)
1047 executor.shutdown()
1126 def _fail_on_deadlock(self, executor): argument
1128 # executor is in a deadlock state and forcefully clean all its
1136 for p in executor._processes.values():
1138 # This should be safe to call executor.shutdown here as all possible
1140 executor.shutdown(wait=True)
1142 self.fail(f"Executor deadlock:\n\n{tb}")
1147 self.executor.shutdown(wait=True)
1149 executor = self.executor_type(
1151 res = executor.submit(func, *args)
1164 # consider that the executor is in a deadlock state
1165 self._fail_on_deadlock(executor)
1166 executor.shutdown(wait=True)
1227 self.executor.shutdown(wait=True)
1229 mp_context=get_context(self.ctx)) as executor:
1230 self.executor = executor # Allow clean up in fail_on_deadlock
1231 f = executor.submit(_crash, delay=.1)
1232 executor.shutdown(wait=True)
1240 self.executor.shutdown(wait=True)
1242 mp_context=get_context(self.ctx)) as executor:
1243 self.executor = executor # Allow clean up in fail_on_deadlock
1245 # Start the executor and get the executor_manager_thread to collect
1248 executor.submit(id, 42).result()
1249 executor_manager = executor._executor_manager_thread
1251 # Submit a task that fails at pickle and shutdown the executor
1253 f = executor.submit(id, ErrorAtPickle())
1254 executor.shutdown(wait=False)
1258 # Make sure the executor is eventually shutdown and do not leave