Add macOS compatibility check for DOCLING with multi-worker Gunicorn
This commit is contained in:
parent
c246eff725
commit
2f2f35b883
1 changed files with 30 additions and 0 deletions
|
|
@ -5,6 +5,7 @@ Start LightRAG server with Gunicorn
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import platform
|
||||||
import pipmaster as pm
|
import pipmaster as pm
|
||||||
from lightrag.api.utils_api import display_splash_screen, check_env_file
|
from lightrag.api.utils_api import display_splash_screen, check_env_file
|
||||||
from lightrag.api.config import global_args
|
from lightrag.api.config import global_args
|
||||||
|
|
@ -46,6 +47,35 @@ def main():
|
||||||
if not check_env_file():
|
if not check_env_file():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Check DOCLING compatibility with Gunicorn multi-worker mode on macOS
|
||||||
|
if (
|
||||||
|
platform.system() == "Darwin"
|
||||||
|
and global_args.document_loading_engine == "DOCLING"
|
||||||
|
and global_args.workers > 1
|
||||||
|
):
|
||||||
|
print("\n" + "=" * 80)
|
||||||
|
print("❌ ERROR: Incompatible configuration detected!")
|
||||||
|
print("=" * 80)
|
||||||
|
print(
|
||||||
|
"\nDOCLING engine with Gunicorn multi-worker mode is not supported on macOS"
|
||||||
|
)
|
||||||
|
print("\nReason:")
|
||||||
|
print(" PyTorch (required by DOCLING) has known compatibility issues with")
|
||||||
|
print(" fork-based multiprocessing on macOS, which can cause crashes or")
|
||||||
|
print(" unexpected behavior when using Gunicorn with multiple workers.")
|
||||||
|
print("\nCurrent configuration:")
|
||||||
|
print(" - Operating System: macOS (Darwin)")
|
||||||
|
print(f" - Document Engine: {global_args.document_loading_engine}")
|
||||||
|
print(f" - Workers: {global_args.workers}")
|
||||||
|
print("\nPossible solutions:")
|
||||||
|
print(" 1. Use single worker mode:")
|
||||||
|
print(" --workers 1")
|
||||||
|
print("\n 2. Change document loading engine in .env:")
|
||||||
|
print(" DOCUMENT_LOADING_ENGINE=DEFAULT")
|
||||||
|
print("\n 3. Deploy on Linux where multi-worker mode is fully supported")
|
||||||
|
print("=" * 80 + "\n")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Check and install dependencies
|
# Check and install dependencies
|
||||||
check_and_install_dependencies()
|
check_and_install_dependencies()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue