lablup / lablup/backend.ai-webui

Migrate Resource Group setting modal to adminUpdateResourceGroup and expose all editable fields

Open
#8,105 0 comments 0 reactions 0 assignees View on GitHub
preemption
Dominant language
TypeScript
Stars
133
Forks
81
Avg merge
1d 12h
Merged PRs (30d)
355

Description

## Background

The Resource Group setting modal (`react/src/components/ResourceGroupSettingModal.tsx`) still saves via the legacy Graphene mutations `modify_scaling_group` / `create_scaling_group`. The newer Strawberry mutation `adminUpdateResourceGroup(input: UpdateResourceGroupInput!)` (and `adminCreateResourceGroupV2`) is not used anywhere in the WebUI. As a result, several fields exposed by `UpdateResourceGroupInput` are not editable in the modal.

## Goal

Migrate the modal's save path to the Strawberry `adminUpdateResourceGroup` (and `adminCreateResourceGroupV2` on create) mutations and expose **all** `UpdateResourceGroupInput` fields so the resource group is fully editable.

## `UpdateResourceGroupInput` fields

Already editable today:

- `resourceGroupName` — yes (name)
- `isActive` — yes
- `isPublic` — yes
- `description` — yes
- `appProxyAddr` — yes (wsProxyAddress)
- `appproxyApiToken` — yes (wsProxyAPIToken)
- `schedulerType` — yes (scheduler)

Not editable yet — need to add:

- `useHostNetwork`
- `preemption.enabled` — opt-in toggle, default off; gates the sub-fields below
- `preemption.order` — `OLDEST` / `NEWEST` victim tie-break
- `preemption.mode` — `TERMINATE` / `RESCHEDULE`
- `preemption.preemptionMinRuntime` — seconds; anti-thrashing minimum runtime before a session is preemptible; 0 = disabled
- `preemption.preemptiblePriority` — see note below before wiring this one up

### Note on `preemption.preemptiblePriority`

Per the current preemption implementation (BEP-1014 / BA-3056), `preemptiblePriority` is a remnant field: it is still present in `PreemptionConfig` / `PreemptionConfigInput` (DB + GraphQL) but the scheduler's victim-selection logic no longer reads it. Victim eligibility is instead decided per-session via the session-level `jobPriority` field, compared only within the same owning user (see FR-2312 for the user-facing side). Do **not** build this as a live editable control that implies it changes preemption behavior — either show it read-only with an explanatory note, or omit it from the form entirely. Confirm the current status with backend before deciding.

## Prefill (edit mode)

Read current values from the Strawberry `ResourceGroup` node:

- `status { isActive, isPublic `}
- `metadata { description `}
- `network { wsproxyAddr, useHostNetwork `}
- `scheduler { type, preemption { enabled, preemptiblePriority, order, mode, preemptionMinRuntime } `}

The legacy `scaling_groups` list / `ScalingGroup` fragment does not expose preemption, so the modal must additionally query the Strawberry `ResourceGroup` node (by name) for prefill, or the source query must be extended.

## scheduler_opts gap (needs backend)

`UpdateResourceGroupInput` has **no** field for `scheduler_opts` (allowed session types, pending timeout, num_retries_to_skip). These are currently editable via the legacy modal. To avoid a regression:

- Keep editing `scheduler_opts` via the legacy `modify_scaling_group` mutation (hybrid save), and
- Add a `TODO(needs-backend)` marker referencing the backend report so it can be folded into `UpdateResourceGroupInput` later.

A separate backend issue should be filed to add `scheduler_opts` (allowed_session_types / pending_timeout / num_retries_to_skip) to `UpdateResourceGroupInput`.

## Scope

- `react/src/components/ResourceGroupSettingModal.tsx` — new mutations, new fields (useHostNetwork switch, preemption config group: enabled toggle gating order / mode / preemptionMinRuntime, preemptiblePriority handled per the note above), prefill wiring.
- i18n keys for the new fields (all languages via i18n flow).
- Relay compile + `scripts/verify.sh`.

## Acceptance criteria

- Create and update both go through the Strawberry mutations (create: `adminCreateResourceGroupV2` + update the rest via `adminUpdateResourceGroup`).
- useHostNetwork and preemption (enabled / order / mode / preemptionMinRuntime) are editable and correctly prefilled in edit mode; `preemptiblePriority` is not presented as a live behavior-changing control (read-only or omitted).
- scheduler_opts editing still works (no regression) with a TODO(needs-backend) marker.
- `bash scripts/verify.sh` passes.

## Related

- FR-2312 — User-facing UI for preemption (session launcher `jobPriority` / `isPreemptible`, session status handling).
- BA-3056 / BEP-1014 — backend epic and design doc for preemption.

JIRA Issue: FR-3240

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in react/src/components/ResourceGroupSettingModal.tsx by tracing the legacy save path and existing scaling-group prefill. Review the Strawberry ResourceGroup fields and mutation inputs, confirm the backend status of preemptiblePriority, then run Relay compilation and bash scripts/verify.sh; done means the listed fields are correctly prefilled and saved without breaking scheduler_opts editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.