INNER CODE UNIT · Python
_finalize_warmup
ohdearquant/lionagi · lionagi/studio/app.py:182
async def _finalize_warmup(task: asyncio.Task | None) -> None:
"""Cancel the warmup task if still running, then await it (avoids an
un-retrieved-task warning)."""
if task is None:
return
if not task.done():
task.cancel()
try:
await task
except asyncio.CancelledError:
pass
except Exception: # noqa: BLE001
_log.warning("Startup warmup task failed (non-fatal)", exc_info=True)
@asynccontextmanager
async def lifespan(app_instance):
from lionagi.cli._code_identity import snapshot_git_position