mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 00:55:14 -07:00
Add granular import logging and increase timeout to 120s
This commit is contained in:
+7
-2
@@ -25,14 +25,19 @@ logger.info(f"Arguments: {sys.argv}")
|
|||||||
logger.info("=" * 60)
|
logger.info("=" * 60)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
logger.info("Importing argparse...")
|
||||||
import argparse
|
import argparse
|
||||||
|
logger.info("Importing uvicorn...")
|
||||||
import uvicorn
|
import uvicorn
|
||||||
logger.info("Standard library imports successful")
|
logger.info("Standard library imports successful")
|
||||||
|
|
||||||
# Import the FastAPI app from the backend package
|
# Import the FastAPI app from the backend package
|
||||||
logger.info("Importing backend modules...")
|
logger.info("Importing backend.config...")
|
||||||
|
from backend import config
|
||||||
|
logger.info("Importing backend.database...")
|
||||||
|
from backend import database
|
||||||
|
logger.info("Importing backend.main (this may take a while due to torch/transformers)...")
|
||||||
from backend.main import app
|
from backend.main import app
|
||||||
from backend import config, database
|
|
||||||
logger.info("Backend imports successful")
|
logger.info("Backend imports successful")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to import required modules: {e}", exc_info=True)
|
logger.error(f"Failed to import required modules: {e}", exc_info=True)
|
||||||
|
|||||||
@@ -79,13 +79,14 @@ async fn start_server(
|
|||||||
*state.child.lock().unwrap() = Some(child);
|
*state.child.lock().unwrap() = Some(child);
|
||||||
|
|
||||||
// Wait for server to be ready by listening for startup log
|
// Wait for server to be ready by listening for startup log
|
||||||
let timeout = tokio::time::Duration::from_secs(30);
|
// PyInstaller bundles can be slow on first import, especially torch/transformers
|
||||||
|
let timeout = tokio::time::Duration::from_secs(120);
|
||||||
let start_time = tokio::time::Instant::now();
|
let start_time = tokio::time::Instant::now();
|
||||||
let mut error_output = Vec::new();
|
let mut error_output = Vec::new();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if start_time.elapsed() > timeout {
|
if start_time.elapsed() > timeout {
|
||||||
eprintln!("Server startup timeout after 30 seconds");
|
eprintln!("Server startup timeout after 120 seconds");
|
||||||
if !error_output.is_empty() {
|
if !error_output.is_empty() {
|
||||||
eprintln!("Collected error output:");
|
eprintln!("Collected error output:");
|
||||||
for line in &error_output {
|
for line in &error_output {
|
||||||
|
|||||||
Reference in New Issue
Block a user