diff --git a/backend/api/urls.py b/backend/api/urls.py index abafd809b..edaa017e9 100644 --- a/backend/api/urls.py +++ b/backend/api/urls.py @@ -31,9 +31,8 @@ function_profiling_router = routers.NestedDefaultRouter(router, r"function", lookup="function") function_profiling_router.register(r"profiling", views.FunctionProfilingViewSet, basename="function-profiling") -task_profiling_router = routers.NestedDefaultRouter(router, r"task_profiling", lookup="task_profiling") -task_profiling_router.register(r"step", views.TaskProfilingStepViewSet, basename="step") - +task_profiling_router = routers.NestedDefaultRouter(router, r"task", lookup="compute_task") +task_profiling_router.register(r"profiling/step", views.TaskProfilingStepViewSet, basename="step") compute_plan_router = routers.NestedDefaultRouter(router, r"compute_plan", lookup="compute_plan") compute_plan_router.register(r"task", views.CPTaskViewSet, basename=f"{CP_BASENAME_PREFIX}task") compute_plan_router.register(r"functions", views.CPFunctionViewSet, basename=f"{CP_BASENAME_PREFIX}function") diff --git a/backend/api/views/task_profiling.py b/backend/api/views/task_profiling.py index 00af1fef9..3dcb9afad 100644 --- a/backend/api/views/task_profiling.py +++ b/backend/api/views/task_profiling.py @@ -72,7 +72,7 @@ def get_queryset(self) -> QuerySet[TaskProfiling]: return ProfilingStep.objects.filter(compute_task_profile__compute_task__channel=get_channel_name(self.request)) def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: - task_profile_pk = kwargs["task_profiling_pk"] + task_profile_pk = kwargs["compute_task_pk"] serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=True) try: @@ -85,7 +85,7 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: def get_object(self): queryset = self.get_queryset() filters = {**self.kwargs} - filters["compute_task_profile_id"] = filters.pop("task_profiling_pk") + filters["compute_task_profile_id"] = filters.pop("compute_task_pk") obj = get_object_or_404(queryset, **filters) self.check_object_permissions(self.request, obj)