Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
"""
import uvicorn

from .app import app
from . import endpoints, env
from .logger import logger
from uvicorn.config import LOGGING_CONFIG
from assessment_module_manager.app import app
from assessment_module_manager import endpoints, env
from assessment_module_manager.logger import logger


def main():
"""
Start the assessment module manager using uvicorn.
"""
LOGGING_CONFIG["formatters"]["default"]["fmt"] = "%(asctime)s %(levelname)s --- [%(name)s] : %(message)s"
LOGGING_CONFIG["formatters"]["access"]["fmt"] = "%(asctime)s %(levelname)s --- [%(name)s] : %(message)s"
logger.info("Starting assessment module manager")

if env.PRODUCTION:
Expand Down
2 changes: 1 addition & 1 deletion assessment_module_manager/assessment_module_manager/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse

from .logger import logger
from assessment_module_manager.logger import logger

description = """
This is the Athena API. You are interacting with the Assessment Module Manager,
Expand Down
2 changes: 1 addition & 1 deletion assessment_module_manager/assessment_module_manager/env.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Common place for environment variables with sensible defaults for local development."""
import os

from .module.list_modules import list_modules
from assessment_module_manager.module.list_modules import list_modules

PRODUCTION = os.environ.get("PRODUCTION", "0") == "1"
SECRET = os.getenv("SECRET")
Expand Down
4 changes: 2 additions & 2 deletions assessment_module_manager/assessment_module_manager/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
logger.setLevel(DEBUG)
handler = StreamHandler(sys.stdout)
handler.setLevel(DEBUG)
formatter = Formatter('[%(levelname)s] %(message)s')
formatter = Formatter('%(asctime)s %(levelname)s --- [assessment_module_manager] : %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
logger.addHandler(handler)
3 changes: 3 additions & 0 deletions athena/athena/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
The only exception is the `start` method, which is used to start the module.
"""
import uvicorn
from uvicorn.config import LOGGING_CONFIG
from fastapi import FastAPI, Request
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
Expand Down Expand Up @@ -31,6 +32,8 @@ def __init__(self, *args, **kwargs):

def start(self) -> None:
"""Start Athena. You have to ensure to have `app` in your module main scope so that it can be imported."""
LOGGING_CONFIG["formatters"]["default"]["fmt"] = "%(asctime)s %(levelname)s --- [%(name)s] : %(message)s"
LOGGING_CONFIG["formatters"]["access"]["fmt"] = "%(asctime)s %(levelname)s --- [%(name)s] : %(message)s"
logger.info("Starting athena module")

conf = get_module_config()
Expand Down
2 changes: 1 addition & 1 deletion athena/athena/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
logger.setLevel(DEBUG)
handler = StreamHandler(sys.stdout)
handler.setLevel(DEBUG)
formatter = Formatter('[%(levelname)s] %(message)s')
formatter = Formatter('%(asctime)s %(levelname)s --- [athena] : %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from athena.storage import store_feedback
from athena.storage.feedback_storage import store_feedback_suggestions

from .extract_methods import get_feedback_method
from .feedback_suggestions import create_feedback_suggestions, filter_overlapping_suggestions, filter_suspicious
from module_programming_themisml.extract_methods import get_feedback_method
from module_programming_themisml.feedback_suggestions import create_feedback_suggestions, filter_overlapping_suggestions, filter_suspicious


@submissions_consumer
Expand Down