mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-14 15:57:27 +00:00
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:
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"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user