OpenHands/openhands/app_server/app_lifespan/app_lifespan_service.py
Tim O'Farrell f292f3a84d
V1 Integration (#11183)
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
2025-10-14 02:16:44 +00:00

22 lines
516 B
Python

from __future__ import annotations
from abc import ABC, abstractmethod
from fastapi import FastAPI
from openhands.sdk.utils.models import DiscriminatedUnionMixin
class AppLifespanService(DiscriminatedUnionMixin, ABC):
def lifespan(self, api: FastAPI):
"""Return lifespan wrapper."""
return self
@abstractmethod
async def __aenter__(self):
"""Open lifespan."""
@abstractmethod
async def __aexit__(self, exc_type, exc_value, traceback):
"""Close lifespan."""