Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: draft for autoscaling feature UI in model service creation/modification panel #3024

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

lizable
Copy link
Contributor

@lizable lizable commented Jan 14, 2025

This PR resolves applying UI for a new key feature, "applying auto scaling rule" for each model service, which allows gradual update of the volume of model service (mostly routing(session)) according to the rule(s). PLEASE REMIND THAT it's the user matters to consider the consequences of applying the rules, for now.
In this PR, there's a new panel added in service detail page, and user can add auto scaling rule by clicking "Add Rules" on the right side of panel. After input all required in popped up modal, and click "OK" button, the rule will be applied immediately to service.

Screenshot 2025-02-05 at 6.47.44 PM.png

If user want to edit certain rule, then clicking the gear icon in corresponding row will do. The Rest of the rule applying mechanism would be same as creation.
Screenshot 2025-02-05 at 6.49.24 PM.png

When user want to delete a rule, then user just need to click the red trash bin icon next to the gear icon. After clicking the button, there's a confirmation popup modal appears, and clicking Delete button will remove the rule right away.
Screenshot 2025-02-05 at 6.51.30 PM.png

How to test

Prerequisites:

  • model-service enabled Backend.AI Core environment
  • 1. User can create auto scaling rule for each service.
  • 2. User can see auto scaling rule(s) in service detail(routing info) page.
  • 3. User can update auto scaling rule.
  • 4. User can delete auto scaling rule.

Checklist: (if applicable)

  • Mention to the original issue
  • Documentation
  • Minimum required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

@github-actions github-actions bot added the size:L 100~500 LoC label Jan 14, 2025
Copy link
Contributor Author

lizable commented Jan 14, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
4.97% (-0% 🔻)
398/8002
🔴 Branches 4.29% 237/5522
🔴 Functions 2.98% 78/2615
🔴 Lines
4.89% (-0% 🔻)
383/7829

Test suite run success

124 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from 9fbef16

@lizable lizable force-pushed the feature/model-service-autoscaling branch from 9fbef16 to a229465 Compare January 31, 2025 11:32
@github-actions github-actions bot added area:ux UI / UX issue. area:i18n Localization size:XL 500~ LoC and removed size:L 100~500 LoC labels Jan 31, 2025
@lizable lizable force-pushed the feature/model-service-autoscaling branch from a229465 to 8c2825f Compare February 5, 2025 02:48
@lizable lizable marked this pull request as ready for review February 5, 2025 09:53
@lizable lizable requested review from agatha197 and yomybaby February 5, 2025 09:54
Copy link
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the ESLint failure.

Copy link
Member

@yomybaby yomybaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check my comment and reviews.

import Flex from './Flex';
import InputNumberWithSlider from './InputNumberWithSlider';
import { AutoScalingRuleEditorModalCreateMutation } from './__generated__/AutoScalingRuleEditorModalCreateMutation.graphql';
import { AutoScalingRuleEditorModalFragment$key } from './__generated__/AutoScalingRuleEditorModalFragment.graphql';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use AutoScalingMetricComparator type and AutoScalingMetricSource type generate type based on graphql schema.

Suggested change
import { AutoScalingRuleEditorModalFragment$key } from './__generated__/AutoScalingRuleEditorModalFragment.graphql';
import { AutoScalingMetricComparator, AutoScalingMetricSource, AutoScalingRuleEditorModalCreateMutation } from './__generated__/AutoScalingRuleEditorModalCreateMutation.graphql';

options={comparators}
optionType={'button'}
buttonStyle={'solid'}
></Radio.Group>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use solid button style yet. It'll be applied globally. :)

Suggested change
></Radio.Group>
></Radio.Group>

name={'threshold'}
rules={[{ required: true }]}
style={{ width: 200 }}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use flex instead of width to specify the width ratio of the children.

Suggested change
>
style={{ flex: 1 }}

name={'comparator'}
rules={[{ required: true }]}
style={{ width: 600 }}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use flex instead of width to specify the width ratio of the children.

Suggested change
>
style={{ flex: 3 }}

Comment on lines +277 to +280
// TODO: hardcoded for now
min={-3}
max={3}
inputNumberProps={{}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for the range being between -3 and 3? Is it specified by the API?

Comment on lines +285 to +292
<Form.Item
label={t('autoScalingRule.CoolDownSeconds')}
name={'cooldown_seconds'}
rules={[{ required: true }]}
>
<InputNumber defaultValue={300}></InputNumber>
</Form.Item>
<Flex
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cooldown_seconds cannot have a negative value, right? Please set the rule and min.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding allowNegative props to InputNumberWithSlider, it's better to have the slider of InputNumberWithSlider follow the min prop of InputNumberWithSlider. When you need to intentionally display a different value than the min of slider, like in the session launcher, you can use sliderProps to set the slider's min to other value(e.g. 0) when using InputNumberWithSlider.

Additionally, it seems unnecessary to handle exceptions for negative values in useEffect.

Comment on lines +913 to 916
</Card>
<Card>
{(baiClient.supports('modify-endpoint') || !endpoint) && (
<>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this an intentional change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:i18n Localization area:ux UI / UX issue. size:XL 500~ LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants