def task_processor(dbconfig, condition): # Check if there are any poems that need to be written while (True): condition.acquire() incomplete_tasks = tasks.getIncompleteTasks(dbconfig) if not incomplete_tasks: condition.wait() condition.release() else: condition.release() writePoemForTask(dbconfig, incomplete_tasks[0])
def getTasks(): offset = request.args.get('offset', 0, type=int) limit = request.args.get('limit', 0, type=int) incomplete_tasks = tasks.getIncompleteTasks(dbconfig, offset, limit) return jsonify({"tasks":incomplete_tasks})
def getTasks(): offset = request.args.get('offset', 0, type=int) limit = request.args.get('limit', 0, type=int) incomplete_tasks = tasks.getIncompleteTasks(dbconfig, offset, limit) return jsonify({"tasks": incomplete_tasks})