Skip to content

Commit

Permalink
Add streams endpoint for multi runs events for org/team levels
Browse files Browse the repository at this point in the history
  • Loading branch information
polyaxon-ci committed Jul 24, 2024
1 parent b1a97a3 commit 2f9e59b
Showing 1 changed file with 51 additions and 5 deletions.
56 changes: 51 additions & 5 deletions haupt/haupt/streams/endpoints/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -172,6 +203,10 @@ async def get_run_importance_correlation(
)


URLS_ORGS_RUNS_MULTI_EVENTS = (
"<str:namespace>/orgs/<str:owner>/runs/multi/events/<str:event_kind>"
)
URLS_TEAMS_RUNS_MULTI_EVENTS = "<str:namespace>/orgs/<str:owner>/teams/<str:team>/runs/multi/events/<str:event_kind>"
URLS_RUNS_MULTI_EVENTS = (
"<str:namespace>/<str:owner>/<str:project>/runs/multi/events/<str:event_kind>"
)
Expand All @@ -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",
Expand Down

0 comments on commit 2f9e59b

Please sign in to comment.