diff --git a/haupt/haupt/streams/endpoints/events.py b/haupt/haupt/streams/endpoints/events.py index fccb99cad..13e3408d7 100644 --- a/haupt/haupt/streams/endpoints/events.py +++ b/haupt/haupt/streams/endpoints/events.py @@ -24,12 +24,8 @@ from traceml.processors.importance_processors import calculate_importance_correlation -@transaction.non_atomic_requests -async def get_multi_run_events( +async def _get_multi_run_events( request: ASGIRequest, - namespace: str, - owner: str, - project: str, event_kind: str, methods: Optional[Dict] = None, ) -> Union[UJSONResponse, HttpResponse]: @@ -61,6 +57,41 @@ async def get_multi_run_events( return UJSONResponse({"data": events}) +@transaction.non_atomic_requests +async def get_orgs_multi_run_events( + request: ASGIRequest, + namespace: str, + owner: str, + event_kind: str, + methods: Optional[Dict] = None, +) -> Union[UJSONResponse, HttpResponse]: + return await _get_multi_run_events(request, event_kind, methods) + + +@transaction.non_atomic_requests +async def get_teams_multi_run_events( + request: ASGIRequest, + namespace: str, + owner: str, + team: str, + event_kind: str, + methods: Optional[Dict] = None, +) -> Union[UJSONResponse, HttpResponse]: + return await _get_multi_run_events(request, event_kind, methods) + + +@transaction.non_atomic_requests +async def get_multi_run_events( + request: ASGIRequest, + namespace: str, + owner: str, + project: str, + event_kind: str, + methods: Optional[Dict] = None, +) -> Union[UJSONResponse, HttpResponse]: + return await _get_multi_run_events(request, event_kind, methods) + + async def get_package_event_assets( run_uuid: str, event_kind: str, event_names: Set[str], force: bool, connection: str ) -> HttpResponse: @@ -172,6 +203,10 @@ async def get_run_importance_correlation( ) +URLS_ORGS_RUNS_MULTI_EVENTS = ( + "/orgs//runs/multi/events/" +) +URLS_TEAMS_RUNS_MULTI_EVENTS = "/orgs//teams//runs/multi/events/" URLS_RUNS_MULTI_EVENTS = ( "///runs/multi/events/" ) @@ -186,6 +221,17 @@ async def get_run_importance_correlation( # fmt: off events_routes = [ path( + URLS_ORGS_RUNS_MULTI_EVENTS, + get_orgs_multi_run_events, + name="get_orgs_multi_run_events", + kwargs=dict(methods=["GET"]), + ), + path( + URLS_TEAMS_RUNS_MULTI_EVENTS, + get_teams_multi_run_events, + name="get_teams_multi_run_events", + kwargs=dict(methods=["GET"]), + ), path( URLS_RUNS_MULTI_EVENTS, get_multi_run_events, name="multi_run_events",