Merge branch 'feature-NEWDWH2021-1209' of nds-tyo.git.backlog.com:/NEWDWH2021/newsdwh2021 into feature-NEWDWH2021-1209
This commit is contained in:
commit
83152fd1ec
@ -16,4 +16,4 @@ RUN \
|
||||
|
||||
COPY src ./src
|
||||
|
||||
CMD ["gunicorn", "src.main:app", "-w", "1", "-k" ,"uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:80", "--timeout", "300"]
|
||||
CMD ["gunicorn", "src.main:app", "-w", "2", "-k" ,"uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:80", "--timeout", "300"]
|
||||
|
||||
@ -27,7 +27,7 @@ def get_logger(log_name: str) -> logging.Logger:
|
||||
logger.addHandler(handler)
|
||||
|
||||
formatter = logging.Formatter(
|
||||
'%(name)s[%(process)d][%(thread)d]\t[%(levelname)s]\t%(asctime)s\t%(message)s',
|
||||
'%(name)s\t[%(levelname)s]\t%(asctime)s\t%(message)s',
|
||||
'%Y-%m-%d %H:%M:%S'
|
||||
)
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import os.path as path
|
||||
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from starlette import status
|
||||
|
||||
@ -8,11 +8,8 @@ import src.static as static
|
||||
from src.controller import (bio, bio_download, healthcheck, login, logout,
|
||||
master_mainte, menu, root, ultmarc)
|
||||
from src.core import task
|
||||
from src.depends.services import get_service
|
||||
from src.error.exception_handler import http_exception_handler
|
||||
from src.error.exceptions import UnexpectedException
|
||||
from src.logging.get_logger import get_logger
|
||||
from src.services.batch_status_service import BatchStatusService
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@ -47,18 +44,3 @@ app.add_exception_handler(UnexpectedException, http_exception_handler)
|
||||
|
||||
# サーバー起動時のイベント
|
||||
app.add_event_handler('startup', task.create_start_app_handler)
|
||||
|
||||
|
||||
# logger = get_logger(__name__)
|
||||
|
||||
|
||||
# @app.get('/sample/')
|
||||
# def sample(service: BatchStatusService = Depends(get_service(BatchStatusService))):
|
||||
# # import os
|
||||
# # import threading
|
||||
# logger.info('START')
|
||||
# res = service.hdke_table_record
|
||||
# logger.info(res)
|
||||
# logger.info('END')
|
||||
# return res
|
||||
# # return f'{os.getpid()}, {threading.get_ident()}'
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import base64
|
||||
import datetime
|
||||
import json
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ from fastapi.exceptions import HTTPException
|
||||
from fastapi.routing import APIRoute
|
||||
from starlette import status
|
||||
|
||||
# from src.db.database import Database
|
||||
from src.depends.auth import (check_session_expired, get_current_session,
|
||||
verify_session)
|
||||
from src.error.exceptions import DBException, UnexpectedException
|
||||
@ -78,18 +77,6 @@ class MeDaCaRoute(APIRoute):
|
||||
return response
|
||||
|
||||
|
||||
# class PrepareDatabaseRoute(MeDaCaRoute):
|
||||
# """事前処理として、データベースのエンジンを作成するルートハンドラー
|
||||
# Args:
|
||||
# MeDaCaRoute (MeDaCaRoute): 共通ルートハンドラー
|
||||
# """
|
||||
# async def pre_process_route(self, request: Request):
|
||||
# request = await super().pre_process_route(request)
|
||||
# # DBエンジンを構築して状態にセット
|
||||
# request.app.state._db = Database.get_instance()
|
||||
# return request
|
||||
|
||||
|
||||
class BeforeCheckSessionRoute(MeDaCaRoute):
|
||||
"""事前処理として、セッションチェックを行うルートハンドラー
|
||||
|
||||
@ -112,7 +99,7 @@ class BeforeCheckSessionRoute(MeDaCaRoute):
|
||||
return session_request
|
||||
|
||||
|
||||
class AfterSetCookieSessionRoute(MeDaCaRoute): # (PrepareDatabaseRoute):
|
||||
class AfterSetCookieSessionRoute(MeDaCaRoute):
|
||||
"""事後処理として、セッションキーをcookieに設定するカスタムルートハンドラー"""
|
||||
async def post_process_route(self, request: Request, response: Response):
|
||||
response = await super().post_process_route(request, response)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user