diff --git a/src/lfx/src/lfx/cli/_serve_help.py b/src/lfx/src/lfx/cli/_serve_help.py index ddf002681d..1f3b877f7f 100644 --- a/src/lfx/src/lfx/cli/_serve_help.py +++ b/src/lfx/src/lfx/cli/_serve_help.py @@ -45,6 +45,6 @@ RESET_ENVIRON = ( SYNC_WORKERS = ( "Use gunicorn's blocking 'sync' worker (Unix, --workers > 1) so the kernel " "routes each request to an idle worker instead of queueing it behind an " - "in-flight request on a busy async worker. Requires the 'a2wsgi' package. " - "Off by default (async worker)." + "in-flight request on a busy async worker. Uses the 'a2wsgi' bridge bundled " + "with lfx on Unix. Off by default (async worker)." ) diff --git a/src/lfx/src/lfx/cli/commands.py b/src/lfx/src/lfx/cli/commands.py index 0e17e3c837..45dbaa697e 100644 --- a/src/lfx/src/lfx/cli/commands.py +++ b/src/lfx/src/lfx/cli/commands.py @@ -680,12 +680,15 @@ def _launch_workers( from lfx.cli.serve_gunicorn import LFXGunicornApp if sync_workers: - # Fail fast in the parent rather than per-worker on first request. + # Fail fast in the parent rather than per-worker on first request. a2wsgi + # ships with lfx on Linux/macOS, so a missing import means a broken + # environment, not a forgotten optional install. try: import a2wsgi # noqa: F401 except ImportError as exc: typer.echo( - "Error: --use-sync-workers requires the 'a2wsgi' package. Install it with: pip install a2wsgi", + "Error: --use-sync-workers needs 'a2wsgi', which ships with lfx on Linux/macOS; " + "it is missing, so reinstall lfx to restore your environment.", err=True, ) raise typer.Exit(1) from exc diff --git a/src/lfx/src/lfx/cli/serve_preloaded_app.py b/src/lfx/src/lfx/cli/serve_preloaded_app.py index 6c68a5c3ad..2fd683fd29 100644 --- a/src/lfx/src/lfx/cli/serve_preloaded_app.py +++ b/src/lfx/src/lfx/cli/serve_preloaded_app.py @@ -42,7 +42,10 @@ def wsgi_application(environ, start_response): try: from a2wsgi import ASGIMiddleware except ImportError as exc: # pragma: no cover - exercised via --use-sync-workers without the dep - msg = "lfx serve --use-sync-workers requires the 'a2wsgi' package. Install it with: pip install a2wsgi" + msg = ( + "lfx serve --use-sync-workers needs 'a2wsgi', which ships with lfx on Linux/macOS; " + "it is missing, so reinstall lfx to restore your environment." + ) raise RuntimeError(msg) from exc _bridge = ASGIMiddleware(app) return _bridge(environ, start_response)