feat(gpu-service): support sliced (by-ratio) GPU instances and PV status

- Add whole/by-ratio segmented toggle to the GPU Instance form; sliced
  mode picks a VRAM ratio (10-100 or finer 1-10 when max<10), scales
  CPU/RAM by the ratio (floored, min 1), pins compute at 100%
- Availability, card Max, and Instance Type cell reflect sliceable types
- Add ready/deleting status columns for storage and storage types
This commit is contained in:
jialin
2026-07-22 15:52:16 +08:00
parent 730cbc9b64
commit 63ed6e777b
15 changed files with 514 additions and 47 deletions
@@ -262,15 +262,15 @@ export const getAcceleratorMax = (
// Picks the candidate (cluster + type name) that should fulfill a requested
// accelerator count: the first candidate of the smallest tier whose
// onceMaxRequest.accelerator is >= the requested count and whose cpu/ram/localStorage
// remaining are all > 0.
// onceMaxRequest.accelerator is >= the requested count. Accelerated types are
// not gated on CPU remaining (only CPU-only types are); in sliced mode the
// candidate's acceleratorSliced remaining must also be > 0.
export const pickCandidateForAccelerator = <
C extends {
cluster: string;
name: string;
cpu?: { remaining?: string | null } | null;
ram?: { remaining?: string | null } | null;
localStorage?: { remaining?: string | null } | null;
acceleratorSliced?: { remaining?: string | null } | null;
}
>(
tiers:
@@ -280,14 +280,21 @@ export const pickCandidateForAccelerator = <
}[]
| undefined
| null,
{ count, acceleratable }: { count: number; acceleratable?: boolean }
{
count,
acceleratable,
sliced
}: { count: number; acceleratable?: boolean; sliced?: boolean }
): C | null => {
if (!tiers?.length) return null;
const hasResources = (c: C) =>
parseQuantity(c.cpu?.remaining) > 0 &&
parseQuantity(c.ram?.remaining) > 0 &&
parseQuantity(c.localStorage?.remaining) > 0;
const hasResources = (c: C) => {
// Accelerated types are not gated on CPU remaining; CPU-only types are.
if (!acceleratable && parseQuantity(c.cpu?.remaining) <= 0) return false;
if (sliced && parseQuantity(c.acceleratorSliced?.remaining) <= 0)
return false;
return true;
};
const sorted = [...tiers].sort(
(a, b) =>