Esempio n. 1
0
    def start(self):
        self.queue_feeder.start()

        for i in range(0, config.classifier_pool_size):
            worker = ClassifierWorker(self.trained_classifier, self.queue, self.stop)
            worker.start()
            self.workers.append(worker)
Esempio n. 2
0
    def start(self):
        self.queue_feeder.start()

        for i in range(0, config.classifier_pool_size):
            worker = ClassifierWorker(self.trained_classifier, self.queue, self.stop)
            worker.start()
            self.workers.append(worker)
    def test_worker(self):
        queue = Queue(100)
        stop = Event()
        stop.clear()
        w = ClassifierWorker(self.cls, queue, stop)
        w.start()

        for d in self.data:
            queue.put(d)

        while not queue.empty():
            time.sleep(0.1)

        time.sleep(0.5)
        stop.set()
        w.join()

        self.assertEqual(ClassifiedStream.objects.count(), 5)
Esempio n. 4
0
    def test_worker(self):
        queue = Queue(100)
        stop = Event()
        stop.clear()
        w = ClassifierWorker(self.cls, queue, stop)
        w.start()

        for d in self.data:
            queue.put(d)

        while not queue.empty():
            time.sleep(0.1)

        time.sleep(0.5)
        stop.set()
        w.join()

        self.assertEqual(ClassifiedStream.objects.count(), 5)