def _try_start_monitor_streamlit()

in project/nanoeval/nanoeval/_executor_worker.py [0:0]


def _try_start_monitor_streamlit() -> Generator[None, None, None]:
    """
    Try starting the Streamlit monitor and ignore errors, but kill the process on exit.
    """
    process = subprocess.Popen(
        [
            "streamlit",
            "run",
            monitor.__file__,
            "--server.headless",
            "true",
            "--server.port",
            "8501",
        ]
    )
    try:
        yield
    finally:
        try:
            process.terminate()
        except Exception:
            logger.warning(
                "Failed to terminate Streamlit monitor (this is not a big deal)", exc_info=True
            )