Merge branch 'main' into embedding-limit
This commit is contained in:
commit
b5589ce4d5
2 changed files with 35 additions and 2 deletions
|
|
@ -53,8 +53,8 @@ def xml_to_json(xml_file):
|
||||||
"description": edge.find("./data[@key='d6']", namespace).text
|
"description": edge.find("./data[@key='d6']", namespace).text
|
||||||
if edge.find("./data[@key='d6']", namespace) is not None
|
if edge.find("./data[@key='d6']", namespace) is not None
|
||||||
else "",
|
else "",
|
||||||
"keywords": edge.find("./data[@key='d7']", namespace).text
|
"keywords": edge.find("./data[@key='d9']", namespace).text
|
||||||
if edge.find("./data[@key='d7']", namespace) is not None
|
if edge.find("./data[@key='d9']", namespace) is not None
|
||||||
else "",
|
else "",
|
||||||
"source_id": edge.find("./data[@key='d8']", namespace).text
|
"source_id": edge.find("./data[@key='d8']", namespace).text
|
||||||
if edge.find("./data[@key='d8']", namespace) is not None
|
if edge.find("./data[@key='d8']", namespace) is not None
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,39 @@ def main():
|
||||||
print("=" * 80 + "\n")
|
print("=" * 80 + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Check macOS fork safety environment variable for multi-worker mode
|
||||||
|
if (
|
||||||
|
platform.system() == "Darwin"
|
||||||
|
and global_args.workers > 1
|
||||||
|
and os.environ.get("OBJC_DISABLE_INITIALIZE_FORK_SAFETY") != "YES"
|
||||||
|
):
|
||||||
|
print("\n" + "=" * 80)
|
||||||
|
print("❌ ERROR: Missing required environment variable on macOS!")
|
||||||
|
print("=" * 80)
|
||||||
|
print("\nmacOS with Gunicorn multi-worker mode requires:")
|
||||||
|
print(" OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES")
|
||||||
|
print("\nReason:")
|
||||||
|
print(" NumPy uses macOS's Accelerate framework (Objective-C based) for")
|
||||||
|
print(" vector computations. The Objective-C runtime has fork safety checks")
|
||||||
|
print(" that will crash worker processes when embedding functions are called.")
|
||||||
|
print("\nCurrent configuration:")
|
||||||
|
print(" - Operating System: macOS (Darwin)")
|
||||||
|
print(f" - Workers: {global_args.workers}")
|
||||||
|
print(
|
||||||
|
f" - Environment Variable: {os.environ.get('OBJC_DISABLE_INITIALIZE_FORK_SAFETY', 'NOT SET')}"
|
||||||
|
)
|
||||||
|
print("\nHow to fix:")
|
||||||
|
print(" Option 1 - Set environment variable before starting (recommended):")
|
||||||
|
print(" export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES")
|
||||||
|
print(" lightrag-server")
|
||||||
|
print("\n Option 2 - Add to your shell profile (~/.zshrc or ~/.bash_profile):")
|
||||||
|
print(" echo 'export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES' >> ~/.zshrc")
|
||||||
|
print(" source ~/.zshrc")
|
||||||
|
print("\n Option 3 - Use single worker mode (no multiprocessing):")
|
||||||
|
print(" lightrag-server --workers 1")
|
||||||
|
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