Exemplo n.º 1
0
 def setUpClass(cls):
     from restaurants import create_app
     app = create_app()
     cls.client = app.test_client()
     from tests.models.test_restaurant import TestRestaurant
     cls.test_restaurant = TestRestaurant
     from restaurants.dao import restaurant_manager
     cls.restaurant_manager = restaurant_manager.RestaurantManager
     from tests.models.test_table import TestTable
     cls.test_table = TestTable
     from restaurants.dao import table_manager
     cls.table_manager = table_manager.TableManager
     from tests.models.test_restaurant_availability import TestRestaurantAvailability
     cls.test_restaurant_ava = TestRestaurantAvailability
     from restaurants.dao import restaurant_availability_manager
     cls.restaurant_ava_manager = restaurant_availability_manager.RestaurantAvailabilityManager
Exemplo n.º 2
0
 def setUp(self):
     from restaurants import create_app
     self.app = create_app()
Exemplo n.º 3
0
 def setUpClass(cls):
     from restaurants import create_app
     create_app()
Exemplo n.º 4
0
"""
Go Out Safe
Web Server Gateway Interface

This file is the entry point for
gooutsafe-users-ms microservice.
"""
from restaurants import create_app

# application instance
app = create_app()

if __name__ == '__main__':
    app.run()
Exemplo n.º 5
0
"""
Background tasks entrypoint.
"""
from restaurants import create_app
from kombu import Connection
import threading
import logging

# First initialize application, disabling the rabbit producer
app = create_app(rabbit_producer_enabled=False)


def start_workers():
    """This function basically retrieves all workers from comm.workers package
    and starts a new daemon thread.
    """
    # retrieve all workers
    from restaurants.comm.workers import worker_list

    for worker in worker_list:
        with Connection(app.config['RABMQ_RABBITMQ_URL'], heartbeat=4) as conn:
            worker = worker(conn, logging)
            thread = threading.Thread(target=worker.run)
            thread.start()
            logging.info("Started new worker thread %s" % worker)


if __name__ == '__main__':
    _format = "%(asctime)s: %(message)s"
    logging.basicConfig(format=_format, level=logging.INFO, datefmt="%H:%M:%S")
    start_workers()