def create_app(): """Create callable wsgi app.""" # Load and validate the configuration valid, config = load_config('/etc/snolla.conf', configspec='config/snolla.conf.spec') if not valid: print('The supplied configuration is invalid.') sys.exit(1) # Setup logging logging.basicConfig(level=getattr(logging, config['general']['loglevel'])) # Create the queues commit_queue = Queue() bugzilla_task_queue = Queue() # Start a Snolla worker thread tw = SnollaWorker(config, commit_queue, bugzilla_task_queue) tw.setDaemon(True) tw.start() # Start a Bugzilla task handler thread tw = BugzillaWorker(config, bugzilla_task_queue) tw.setDaemon(True) tw.start() # Setup the WSGI frontend return Frontend(commit_queue)