Signal: Fix signal handlers for uvicorn
Add the ability to override uvicorn's signal handler in addition to using main's signal handler for any SIGINTs before the API server starts. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
parent
95e44c20d6
commit
14d8ec2007
3 changed files with 36 additions and 6 deletions
7
main.py
7
main.py
|
|
@ -4,7 +4,6 @@ import asyncio
|
|||
import os
|
||||
import pathlib
|
||||
import signal
|
||||
import sys
|
||||
from loguru import logger
|
||||
from typing import Optional
|
||||
|
||||
|
|
@ -13,15 +12,11 @@ from common import config, gen_logging, sampling, model
|
|||
from common.args import convert_args_to_dict, init_argparser
|
||||
from common.auth import load_auth_keys
|
||||
from common.logger import setup_logger
|
||||
from common.signals import signal_handler
|
||||
from common.utils import is_port_in_use, unwrap
|
||||
from endpoints.OAI.app import start_api
|
||||
|
||||
|
||||
def signal_handler(*_):
|
||||
logger.warning("Shutdown signal called. Exiting gracefully.")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
async def entrypoint(args: Optional[dict] = None):
|
||||
"""Entry function for program startup"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue