예제 #1
0
class TestProcessWorkManager(CommonParallelTests, CommonWorkManagerTests):
    def setUp(self):
        self.work_manager = ProcessWorkManager()
        self.work_manager.startup()

    def tearDown(self):
        self.work_manager.shutdown()
예제 #2
0
 def test_hang_shutdown_ignoring_sigint(self):
     work_manager = ProcessWorkManager()
     work_manager.shutdown_timeout = 0.1
     work_manager.startup()
     for i in range(5):
         work_manager.submit(will_busyhang_uninterruptible)
     work_manager.shutdown()
     for worker in work_manager.workers:
         assert not worker.is_alive()
예제 #3
0
    def test_sigint_shutdown(self):
        work_manager = ProcessWorkManager()
        work_manager.install_sigint_handler()
        work_manager.shutdown_timeout = 0.1
        work_manager.startup()
        for i in range(5):
            work_manager.submit(will_busyhang)

        try:
            os.kill(os.getpid(), signal.SIGINT)
        except KeyboardInterrupt:
            for worker in work_manager.workers:
                assert not worker.is_alive()
            raise
예제 #4
0
 def test_shutdown(self):
     work_manager = ProcessWorkManager()
     work_manager.startup()
     work_manager.shutdown()
     for worker in work_manager.workers:
         assert not worker.is_alive()