Skip to content

Commit

Permalink
remove sync_compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
zzstoatzz committed Dec 10, 2024
1 parent 612106c commit 28fdf87
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/prefect/runner/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
PREFECT_RUNNER_SERVER_MISSED_POLLS_TOLERANCE,
PREFECT_RUNNER_SERVER_PORT,
)
from prefect.utilities.asyncutils import sync_compatible
from prefect.utilities.asyncutils import run_coro_as_sync
from prefect.utilities.importtools import load_script_as_module

if TYPE_CHECKING:
Expand Down Expand Up @@ -241,7 +241,6 @@ async def _create_flow_run_for_flow_from_fqn(
return _create_flow_run_for_flow_from_fqn


@sync_compatible
async def build_server(runner: "Runner") -> FastAPI:
"""
Build a FastAPI server for a runner.
Expand Down Expand Up @@ -297,16 +296,7 @@ def start_webserver(runner: "Runner", log_level: Optional[str] = None) -> None:
host = PREFECT_RUNNER_SERVER_HOST.value()
port = PREFECT_RUNNER_SERVER_PORT.value()
log_level = log_level or PREFECT_RUNNER_SERVER_LOG_LEVEL.value()
webserver = build_server(runner)
webserver = run_coro_as_sync(build_server(runner))
uvicorn.run(
webserver, host=host, port=port, log_level=log_level.lower()
) # Uvicorn supports only lowercase log_level
# From the Uvicorn config file:
# LOG_LEVELS: dict[str, int] = {
# "critical": logging.CRITICAL,
# "error": logging.ERROR,
# "warning": logging.WARNING,
# "info": logging.INFO,
# "debug": logging.DEBUG,
# "trace": TRACE_LOG_LEVEL,
# }

0 comments on commit 28fdf87

Please sign in to comment.