Skip to content

Commit

Permalink
fix: Do null check on total_resource_slots value (#2509)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregataa authored Jul 18, 2024
1 parent 4c3eac6 commit 9140bed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions changes/2509.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do null check on `groups.total_resource_slots` and `domains.total_resource_slots` value.
4 changes: 3 additions & 1 deletion src/ai/backend/manager/models/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def from_row(cls, ctx: GraphQueryContext, row: Row) -> Optional[Domain]:
is_active=row["is_active"],
created_at=row["created_at"],
modified_at=row["modified_at"],
total_resource_slots=row["total_resource_slots"].to_json(),
total_resource_slots=row["total_resource_slots"].to_json()
if row["total_resource_slots"] is not None
else {},
allowed_vfolder_hosts=row["allowed_vfolder_hosts"].to_json(),
allowed_docker_registries=row["allowed_docker_registries"],
integration_id=row["integration_id"],
Expand Down
4 changes: 3 additions & 1 deletion src/ai/backend/manager/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ def from_row(cls, graph_ctx: GraphQueryContext, row: Row) -> Optional[Group]:
created_at=row["created_at"],
modified_at=row["modified_at"],
domain_name=row["domain_name"],
total_resource_slots=row["total_resource_slots"].to_json(),
total_resource_slots=row["total_resource_slots"].to_json()
if row["total_resource_slots"] is not None
else {},
allowed_vfolder_hosts=row["allowed_vfolder_hosts"].to_json(),
integration_id=row["integration_id"],
resource_policy=row["resource_policy"],
Expand Down

0 comments on commit 9140bed

Please sign in to comment.