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

feat(14691): serving runtime link to args #3400

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/modelServing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ class ServingRuntimeModal extends Modal {
return this.find().findByLabelText('Model server size');
}

findServingRuntimeTemplateHelptext() {
return this.find().findByTestId('serving-runtime-template-helptext');
}

findServingRuntimeTemplateDropdown() {
return this.find().findByTestId('serving-runtime-template-selection');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { deleteModal } from '~/__tests__/cypress/cypress/pages/components/Delete
import {
inferenceServiceModal,
inferenceServiceModalEdit,
kserveModal,
modelServingGlobal,
} from '~/__tests__/cypress/cypress/pages/modelServing';
import {
Expand All @@ -38,6 +39,7 @@ type HandlersProps = {
delayInferenceServices?: boolean;
delayServingRuntimes?: boolean;
disableKServeMetrics?: boolean;
disableServingRuntimeParamsConfig?: boolean;
};

const initIntercepts = ({
Expand All @@ -49,11 +51,15 @@ const initIntercepts = ({
delayInferenceServices,
delayServingRuntimes,
disableKServeMetrics,
disableServingRuntimeParamsConfig,
}: HandlersProps) => {
cy.interceptOdh(
'GET /api/dsc/status',
mockDscStatus({
installedComponents: { kserve: true, 'model-mesh': true },
installedComponents: {
kserve: true,
'model-mesh': true,
},
}),
);
cy.interceptOdh(
Expand All @@ -62,6 +68,7 @@ const initIntercepts = ({
disableKServe: disableKServeConfig,
disableModelMesh: disableModelMeshConfig,
disableKServeMetrics,
disableServingRuntimeParams: disableServingRuntimeParamsConfig,
}),
);
cy.interceptK8sList(ServingRuntimeModel, mockK8sResourceList(servingRuntimes));
Expand Down Expand Up @@ -490,6 +497,23 @@ describe('Model Serving Global', () => {
modelServingGlobal.findDeployModelButton().click();
cy.findByText('Error creating model server').should('not.exist');
});

it('Serving runtime helptext', () => {
initIntercepts({
projectEnableModelMesh: false,
disableServingRuntimeParamsConfig: false,
});
modelServingGlobal.visit('test-project');

modelServingGlobal.findDeployModelButton().click();

// test that you can not submit on empty
kserveModal.shouldBeOpen();
kserveModal.findServingRuntimeTemplateHelptext().should('not.exist');
kserveModal.findServingRuntimeTemplateDropdown().findSelectOption('Caikit').click();
kserveModal.findServingRuntimeTemplateHelptext().should('exist');
});

it('Navigate to kserve model metrics page only if enabled', () => {
initIntercepts({});
modelServingGlobal.visit('test-project');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import * as React from 'react';
import { FormGroup, Label, Split, SplitItem, Truncate } from '@patternfly/react-core';
import {
Button,
FormGroup,
FormHelperText,
HelperText,
HelperTextItem,
Label,
Split,
SplitItem,
Truncate,
} from '@patternfly/react-core';
import { UpdateObjectAtPropAndValue } from '~/pages/projects/types';
import { CreatingServingRuntimeObject } from '~/pages/modelServing/screens/types';
import { TemplateKind } from '~/k8sTypes';
Expand All @@ -14,6 +24,7 @@ import { AcceleratorProfileFormData } from '~/utilities/useAcceleratorProfileFor

type ServingRuntimeTemplateSectionProps = {
data: CreatingServingRuntimeObject;
onConfigureParamsClick?: () => void;
setData: UpdateObjectAtPropAndValue<CreatingServingRuntimeObject>;
templates: TemplateKind[];
isEditing?: boolean;
Expand All @@ -22,6 +33,7 @@ type ServingRuntimeTemplateSectionProps = {

const ServingRuntimeTemplateSection: React.FC<ServingRuntimeTemplateSectionProps> = ({
data,
onConfigureParamsClick,
setData,
templates,
isEditing,
Expand Down Expand Up @@ -77,6 +89,19 @@ const ServingRuntimeTemplateSection: React.FC<ServingRuntimeTemplateSectionProps
setData('servingRuntimeTemplateName', name);
}}
/>
{data.servingRuntimeTemplateName && onConfigureParamsClick && (
<FormHelperText>
<HelperText>
<HelperTextItem data-testid="serving-runtime-template-helptext">
You can optimize model performance by{' '}
<Button isInline onClick={() => onConfigureParamsClick()} variant="link">
configuring the parameters
</Button>{' '}
of the selected serving runtime.
</HelperTextItem>
</HelperText>
</FormHelperText>
)}
</FormGroup>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@
[editInfo, servingRuntimeTemplates, createDataServingRuntime.servingRuntimeTemplateName],
);

const servingRuntimeArgsInputRef = React.useRef<HTMLTextAreaElement>(null);

const onBeforeClose = (submitted: boolean) => {
fireFormTrackingEvent(editInfo ? 'Model Updated' : 'Model Deployed', {
outcome: TrackingOutcome.cancel,
Expand Down Expand Up @@ -377,6 +379,14 @@
/>
<ServingRuntimeTemplateSection
data={createDataServingRuntime}
onConfigureParamsClick={
servingRuntimeParamsEnabled
? () =>
requestAnimationFrame(() => {
servingRuntimeArgsInputRef.current?.focus();

Check warning on line 386 in frontend/src/pages/modelServing/screens/projects/kServeModal/ManageKServeModal.tsx

View check run for this annotation

Codecov / codecov/patch

frontend/src/pages/modelServing/screens/projects/kServeModal/ManageKServeModal.tsx#L386

Added line #L386 was not covered by tests
})
: undefined
}
setData={setCreateDataServingRuntime}
templates={servingRuntimeTemplates || []}
isEditing={!!editInfo}
Expand Down Expand Up @@ -440,6 +450,7 @@
<ServingRuntimeArgsSection
data={createDataInferenceService}
setData={setCreateDataInferenceService}
inputRef={servingRuntimeArgsInputRef}
/>
<EnvironmentVariablesSection
data={createDataInferenceService}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ import { CreatingInferenceServiceObject } from '~/pages/modelServing/screens/typ
type ServingRuntimeArgsSectionType = {
data: CreatingInferenceServiceObject;
setData: UpdateObjectAtPropAndValue<CreatingInferenceServiceObject>;
inputRef: React.RefObject<HTMLTextAreaElement>;
};

const ServingRuntimeArgsSection: React.FC<ServingRuntimeArgsSectionType> = ({ data, setData }) => (
const ServingRuntimeArgsSection: React.FC<ServingRuntimeArgsSectionType> = ({
data,
setData,
inputRef,
}) => (
<FormGroup
label="Additional serving runtime arguments"
labelIcon={
Expand All @@ -37,9 +42,11 @@ const ServingRuntimeArgsSection: React.FC<ServingRuntimeArgsSectionType> = ({ da
fieldId="serving-runtime-arguments"
>
<TextArea
id="servingRuntimeArgsInput"
ref={inputRef}
placeholder={`--arg\n--arg2=value2\n--arg3 value3`}
value={data.servingRuntimeArgs?.join('\n')}
onChange={(e, srArgs) => setData('servingRuntimeArgs', srArgs.split('\n'))}
onChange={(_e, srArgs) => setData('servingRuntimeArgs', srArgs.split('\n'))}
autoResize
/>
<FormHelperText>
Expand Down
Loading