Skip to content

Commit

Permalink
refactor: Reflect feedbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Feb 3, 2025
1 parent 238f03f commit 3242582
Show file tree
Hide file tree
Showing 21 changed files with 388 additions and 268 deletions.
2 changes: 1 addition & 1 deletion src/ai/backend/manager/api/container_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def patch_container_registry(
request: web.Request, params: PatchContainerRegistryRequestModel
) -> PatchContainerRegistryResponseModel:
registry_id = uuid.UUID(request.match_info["registry_id"])
log.info("PATCH_CONTAINER_REGISTRY (cr:{})", registry_id)
log.info("PATCH_CONTAINER_REGISTRY (registry:{})", registry_id)
root_ctx: RootContext = request.app["_root.context"]
registry_row_updates = params.model_dump(exclude={"allowed_groups"}, exclude_none=True)

Expand Down
2 changes: 1 addition & 1 deletion src/ai/backend/manager/api/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import attrs

from ai.backend.common.metrics.metric import CommonMetricRegistry
from ai.backend.manager.api.services.base import ServicesContext
from ai.backend.manager.plugin.network import NetworkPluginContext
from ai.backend.manager.service.base import ServicesContext

if TYPE_CHECKING:
from ai.backend.common.bgtask import BackgroundTaskManager
Expand Down
16 changes: 8 additions & 8 deletions src/ai/backend/manager/api/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
})
)
async def update_registry_quota(request: web.Request, params: Any) -> web.Response:
log.info("UPDATE_REGISTRY_QUOTA (gr:{})", params["group_id"])
log.info("UPDATE_REGISTRY_QUOTA (group:{})", params["group_id"])
root_ctx: RootContext = request.app["_root.context"]
group_id = params["group_id"]
scope_id = ProjectScope(project_id=group_id, domain_name=None)
quota = int(params["quota"])

await root_ctx.services_ctx.per_project_container_registries_quota.update(scope_id, quota)
await root_ctx.services_ctx.per_project_container_registries_quota.update_quota(scope_id, quota)
return web.Response(status=204)


Expand All @@ -49,12 +49,12 @@ async def update_registry_quota(request: web.Request, params: Any) -> web.Respon
})
)
async def delete_registry_quota(request: web.Request, params: Any) -> web.Response:
log.info("DELETE_REGISTRY_QUOTA (gr:{})", params["group_id"])
log.info("DELETE_REGISTRY_QUOTA (group:{})", params["group_id"])
root_ctx: RootContext = request.app["_root.context"]
group_id = params["group_id"]
scope_id = ProjectScope(project_id=group_id, domain_name=None)

await root_ctx.services_ctx.per_project_container_registries_quota.delete(scope_id)
await root_ctx.services_ctx.per_project_container_registries_quota.delete_quota(scope_id)
return web.Response(status=204)


Expand All @@ -67,13 +67,13 @@ async def delete_registry_quota(request: web.Request, params: Any) -> web.Respon
})
)
async def create_registry_quota(request: web.Request, params: Any) -> web.Response:
log.info("CREATE_REGISTRY_QUOTA (gr:{})", params["group_id"])
log.info("CREATE_REGISTRY_QUOTA (group:{})", params["group_id"])
root_ctx: RootContext = request.app["_root.context"]
group_id = params["group_id"]
scope_id = ProjectScope(project_id=group_id, domain_name=None)
quota = int(params["quota"])

await root_ctx.services_ctx.per_project_container_registries_quota.create(scope_id, quota)
await root_ctx.services_ctx.per_project_container_registries_quota.create_quota(scope_id, quota)
return web.Response(status=204)


Expand All @@ -85,12 +85,12 @@ async def create_registry_quota(request: web.Request, params: Any) -> web.Respon
})
)
async def read_registry_quota(request: web.Request, params: Any) -> web.Response:
log.info("READ_REGISTRY_QUOTA (gr:{})", params["group_id"])
log.info("READ_REGISTRY_QUOTA (group:{})", params["group_id"])
root_ctx: RootContext = request.app["_root.context"]
group_id = params["group_id"]
scope_id = ProjectScope(project_id=group_id, domain_name=None)

quota = await root_ctx.services_ctx.per_project_container_registries_quota.read(scope_id)
quota = await root_ctx.services_ctx.per_project_container_registries_quota.read_quota(scope_id)

return web.json_response({"result": quota})

Expand Down
25 changes: 0 additions & 25 deletions src/ai/backend/manager/api/services/base.py

This file was deleted.

210 changes: 0 additions & 210 deletions src/ai/backend/manager/api/services/container_registries/harbor.py

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3242582

Please sign in to comment.