Esempio n. 1
0
    def test_worker_sqs(self):
        """
        Actually test with sqs as the backend
        """
        if not AWS_ACCESS_KEY_ID:
            return

        conn = SQSConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
        logging.debug("Conn created %s" % conn)
        backend = WorkerBackend()
        queue = Queue(conn, 'pysqes_test', backend=backend)
        queue.enqueue(add_func, 1, 2)

        runner = GeventRunner()
        worker = Worker(queue, runner=runner)
        runner.worker = worker
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(backend.result))
        self.assertEqual(backend.result, '3')
Esempio n. 2
0
    def test_worker_sqs(self):
        """
        Actually test with sqs as the backend
        """
        if not AWS_ACCESS_KEY_ID:
            return

        conn = SQSConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
        logging.debug("Conn created %s" % conn)
        backend = WorkerBackend()
        queue = Queue(conn, 'pysqes_test', backend=backend)
        queue.enqueue(add_func, 1, 2)

        runner = GeventRunner()
        worker = Worker(queue, runner=runner)
        runner.worker = worker
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(backend.result))
        self.assertEqual(backend.result, '3')
Esempio n. 3
0
    def test_worker_process(self):
        self.queue.enqueue(add_func, 1, 2)

        worker = Worker(self.queue)
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(self.backend.result))
        self.assertEqual(self.backend.result, '3')
Esempio n. 4
0
    def test_worker_process(self):
        self.queue.enqueue(add_func, 1, 2)

        worker = Worker(self.queue)
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(self.backend.result))
        self.assertEqual(self.backend.result, '3')
Esempio n. 5
0
    def test_worker(self):
        self.queue.enqueue(add_func, 1, 2)

        try:
            import gevent
            from pysqes.runners.gevent_runner import GeventRunner
        except ImportError:
            return

        runner = GeventRunner()
        worker = Worker(self.queue, runner=runner)
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(self.backend.result))
        self.assertEqual(self.backend.result, '3')
Esempio n. 6
0
    def test_worker(self):
        self.queue.enqueue(add_func, 1, 2)

        try:
            import gevent
            from pysqes.runners.gevent_runner import GeventRunner
        except ImportError:
            return

        runner = GeventRunner()
        worker = Worker(self.queue, runner=runner)
        workThread = WorkerThread()
        workThread.worker = worker
        workThread.start()
        try:
            time.sleep(1)
            worker.shutdown()
        except:
            pass

        logger.info("Verifying result {0}".format(self.backend.result))
        self.assertEqual(self.backend.result, '3')