Skip to content

Commit

Permalink
fix: step router
Browse files Browse the repository at this point in the history
Signed-off-by: Guilhem Barthés <[email protected]>
  • Loading branch information
guilhem-barthes committed Oct 4, 2024
1 parent 0e44ea8 commit 2e22d54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions backend/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions backend/api/views/task_profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 2e22d54

Please sign in to comment.