def _initialize_task_queue(): global _TASK_QUEUE assert _TASK_QUEUE is None from pulp.server.dispatch.taskqueue import TaskQueue concurrency_threshold = pulp_config.config.getint('tasks', 'concurrency_threshold') dispatch_interval = pulp_config.config.getfloat('tasks', 'dispatch_interval') _TASK_QUEUE = TaskQueue(concurrency_threshold, dispatch_interval) _TASK_QUEUE.start()
class TaskQueueStartStopTests(base.PulpServerTests): def setUp(self): self.queue = TaskQueue(1) def tearDown(self): try: self.queue.stop() except AssertionError: pass self.queue = None def test_start(self): self.assertTrue(self.queue._TaskQueue__dispatcher is None) self.queue.start() self.assertTrue(isinstance(self.queue._TaskQueue__dispatcher, threading.Thread)) def test_stop(self): self.queue.start() self.assertTrue(isinstance(self.queue._TaskQueue__dispatcher, threading.Thread)) self.queue.stop() self.assertTrue(self.queue._TaskQueue__dispatcher is None)
class TaskQueueStartStopTests(base.PulpServerTests): def setUp(self): self.queue = TaskQueue(1) def tearDown(self): try: self.queue.stop() except AssertionError: pass self.queue = None def test_start(self): self.assertTrue(self.queue._TaskQueue__dispatcher is None) self.queue.start() self.assertTrue( isinstance(self.queue._TaskQueue__dispatcher, threading.Thread)) def test_stop(self): self.queue.start() self.assertTrue( isinstance(self.queue._TaskQueue__dispatcher, threading.Thread)) self.queue.stop() self.assertTrue(self.queue._TaskQueue__dispatcher is None)