Skip to content

Consolidate duplicated serve command startup functions in CLI #47

@YaMachinu

Description

@YaMachinu

Problem

cli.py has three nearly-identical async startup functions (_run_dev_servers, _run_ui_servers, _run_headless_servers) that differ only in which servers they start. Any bug fix must be applied in three places.

Fix

Replace with one parameterized function:

async def _run_servers(*, api=True, otlp=False, ui=False) -> None:
    tasks = []
    if api:  tasks.append(_start_uvicorn(api_app, host, api_port))
    if otlp: tasks.append(_start_uvicorn(otlp_app, host, otlp_port))
    if ui:   tasks.append(_start_ui_dev_server(host, ui_port))
    await asyncio.gather(*tasks)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions