[Feature] Setting number of apiserver workers automatically (#3790)

Co-authored-by: Jiang-Jia-Jun <jiangjiajun@baidu.com>
This commit is contained in:
Jiang-Jia-Jun
2025-09-02 14:17:48 +08:00
committed by GitHub
parent bf0cf5167a
commit 0e4df5a6f4
3 changed files with 21 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ import sys
import tarfile
import time
from datetime import datetime
from importlib.metadata import PackageNotFoundError, distribution
from logging.handlers import BaseRotatingHandler
from pathlib import Path
from typing import Literal, TypeVar, Union
@@ -668,6 +669,14 @@ def import_from_path(module_name: str, file_path: Union[str, os.PathLike]):
return module
def is_package_installed(package_name):
try:
distribution(package_name)
return True
except PackageNotFoundError:
return False
def version():
"""
Prints the contents of the version.txt file located in the parent directory of this script.