Skip to content

Commit 5f28cd7

Browse files
committed
fixes
1 parent 910f21b commit 5f28cd7

File tree

7 files changed

+50
-22
lines changed

7 files changed

+50
-22
lines changed

frontend/src/__mocks__/mockMaaSModelRefResource.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const mockMaaSModelRef = ({
99
},
1010
displayName = 'Test LLM Inference Service',
1111
description = 'Test LLM Inference Service Description',
12-
}: MaaSModelRef): MaaSModelRef => ({
12+
}: Partial<MaaSModelRef> = {}): MaaSModelRef => ({
1313
name,
1414
namespace,
1515
modelRef,

packages/maas/bff/internal/api/maasmodelref_handlers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ var _ = Describe("MaaSModelRefHandlers", Ordered, func() {
156156
Name: "updated-model",
157157
},
158158
EndpointOverride: "https://custom-endpoint.example.com",
159-
DisplayName: "Updated LLM Model",
160-
Description: "A high-performance updated language model",
159+
DisplayName: &[]string{"Updated LLM Model"}[0],
160+
Description: &[]string{"A high-performance updated language model"}[0],
161161
},
162162
k8Factory,
163163
identity,

packages/maas/bff/internal/models/maasmodelref.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ type CreateMaaSModelRefRequest struct {
1515
type UpdateMaaSModelRefRequest struct {
1616
ModelRef ModelReference `json:"modelRef"`
1717
EndpointOverride string `json:"endpointOverride,omitempty"`
18-
DisplayName string `json:"displayName,omitempty"`
19-
Description string `json:"description,omitempty"`
18+
DisplayName *string `json:"displayName,omitempty"`
19+
Description *string `json:"description,omitempty"`
2020
}

packages/maas/bff/internal/repositories/maasmodelrefs.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,20 @@ func (r *MaaSModelRefsRepository) UpdateMaaSModelRef(ctx context.Context, namesp
8787
if annotations == nil {
8888
annotations = map[string]string{}
8989
}
90-
if request.DisplayName != "" {
91-
annotations[displayNameAnnotation] = request.DisplayName
92-
} else {
93-
delete(annotations, displayNameAnnotation)
94-
}
95-
if request.Description != "" {
96-
annotations[descriptionAnnotation] = request.Description
97-
} else {
98-
delete(annotations, descriptionAnnotation)
90+
91+
if request.DisplayName != nil {
92+
if *request.DisplayName == "" {
93+
delete(annotations, displayNameAnnotation)
94+
} else {
95+
annotations[displayNameAnnotation] = *request.DisplayName
96+
}
97+
}
98+
if request.Description != nil {
99+
if *request.Description == "" {
100+
delete(annotations, descriptionAnnotation)
101+
} else {
102+
annotations[descriptionAnnotation] = *request.Description
103+
}
99104
}
100105
existing.SetAnnotations(annotations)
101106
existing.Object["spec"] = existingSpec

packages/maas/frontend/src/odh/modelServingExtensions/modelDeploymentWizard/MaaSEndpointCheckbox.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { isLLMInferenceServiceActive } from '@odh-dashboard/llmd-serving/formUti
66

77
export type MaaSFieldValue = {
88
isChecked: boolean;
9-
endpointOverride?: string;
109
};
1110

1211
export const maasFieldSchema = z.object({
@@ -16,7 +15,7 @@ export const maasFieldSchema = z.object({
1615

1716
const setMaaSFieldData = (value: MaaSFieldValue): MaaSFieldValue => value;
1817
const getInitialMaaSFieldData = (value?: MaaSFieldValue): MaaSFieldValue =>
19-
value ?? { isChecked: false, endpointOverride: undefined };
18+
value ?? { isChecked: false };
2019

2120
type MaaSFieldProps = {
2221
id: string;

packages/model-serving/src/components/deploymentWizard/deploying/useModelDeploymentSubmit.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getServingRuntimeFromTemplate } from '@odh-dashboard/internal/pages/mod
44
import { useDeployMethod } from './useDeployMethod';
55
import { ModelDeploymentWizardValidation } from '../useDeploymentWizardValidation';
66
import { useWizardFieldApply } from '../useWizardFieldApply';
7-
import { useWizardFieldPostDeploy } from '../useWizardFieldPostDeploy';
7+
import { useWizardFieldPostDeploy, type PostDeployFailure } from '../useWizardFieldPostDeploy';
88
import { deployModel } from '../utils';
99
import { Deployment, DeploymentAssemblyResources } from '../../../../extension-points';
1010
import { InitialWizardFormData } from '../types';
@@ -32,6 +32,8 @@ export const useModelDeploymentSubmit = (
3232
isLoading: boolean;
3333
submitError: Error | null;
3434
clearSubmitError: () => void;
35+
submitWarnings: PostDeployFailure[];
36+
clearSubmitWarnings: () => void;
3537
} => {
3638
const { deployMethod, deployMethodLoaded } = useDeployMethod(formState, resources);
3739
const { applyFieldData, applyExtensionsLoaded } = useWizardFieldApply(
@@ -43,6 +45,9 @@ export const useModelDeploymentSubmit = (
4345
const [submitError, setSubmitError] = React.useState<Error | null>(null);
4446
const [isLoading, setIsLoading] = React.useState(false);
4547

48+
// Warnings that something went wrong during post-deployment, doesn't block submission and closing of the wizard
49+
const [submitWarnings, setSubmitWarnings] = React.useState<PostDeployFailure[]>([]);
50+
4651
const onSave = React.useCallback(
4752
async (overwrite?: boolean) => {
4853
setSubmitError(null);
@@ -97,7 +102,10 @@ export const useModelDeploymentSubmit = (
97102
initialWizardData,
98103
applyFieldData,
99104
);
100-
await runPostDeploy(deployedDeployment.model, existingDeployment);
105+
const failures = await runPostDeploy(deployedDeployment.model, existingDeployment);
106+
if (failures.length > 0) {
107+
setSubmitWarnings(failures);
108+
}
101109
exitWizardOnSubmit();
102110
} catch (error) {
103111
setSubmitError(error instanceof Error ? error : new Error(String(error)));
@@ -131,7 +139,9 @@ export const useModelDeploymentSubmit = (
131139
isLoading,
132140
submitError,
133141
clearSubmitError: () => setSubmitError(null),
142+
submitWarnings,
143+
clearSubmitWarnings: () => setSubmitWarnings([]),
134144
}),
135-
[onSave, deployMethod?.properties.supportsOverwrite, isLoading, submitError],
145+
[onSave, deployMethod?.properties.supportsOverwrite, isLoading, submitError, submitWarnings],
136146
);
137147
};

packages/model-serving/src/components/deploymentWizard/useWizardFieldPostDeploy.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,17 @@ import {
77
type Deployment,
88
} from '../../../extension-points';
99

10+
/** A record of a post-deploy extension that failed, including the field it belongs to. */
11+
export type PostDeployFailure = { fieldId: string; error: Error };
12+
1013
/**
1114
* Hook that returns an async function to run all active post-deploy extensions after
1215
* a deployment is saved. Each extension receives the field's current data, the newly
1316
* saved model resource (which now has a uid), and the original deployment (if editing).
1417
*
1518
* Post-deploy extensions are only executed if their associated WizardField2 is active.
19+
* Errors thrown by individual extensions are caught and collected as PostDeployFailure
20+
* entries; subsequent extensions still run and the returned promise always resolves so these errors don't block submission and closing of the wizard
1621
*
1722
* @param wizardState - The current wizard form state at the point of submission
1823
*/
@@ -22,7 +27,7 @@ export const useWizardFieldPostDeploy = (
2227
runPostDeploy: (
2328
deployedModel: Deployment['model'],
2429
existingDeployment?: Deployment,
25-
) => Promise<void>;
30+
) => Promise<PostDeployFailure[]>;
2631
postDeployExtensionsLoaded: boolean;
2732
postDeployExtensionErrors: Error[];
2833
} => {
@@ -47,12 +52,21 @@ export const useWizardFieldPostDeploy = (
4752
);
4853

4954
const runPostDeploy = React.useCallback(
50-
async (deployedModel: Deployment['model'], existingDeployment?: Deployment): Promise<void> => {
55+
async (
56+
deployedModel: Deployment['model'],
57+
existingDeployment?: Deployment,
58+
): Promise<PostDeployFailure[]> => {
59+
const failures: PostDeployFailure[] = [];
5160
for (const ext of activePostDeployExtensions) {
5261
const { fieldId } = ext.properties;
5362
const fieldData: unknown = wizardState[fieldId];
54-
await ext.properties.postDeploy(fieldData, deployedModel, existingDeployment);
63+
try {
64+
await ext.properties.postDeploy(fieldData, deployedModel, existingDeployment);
65+
} catch (err) {
66+
failures.push({ fieldId, error: err instanceof Error ? err : new Error(String(err)) });
67+
}
5568
}
69+
return failures;
5670
},
5771
[activePostDeployExtensions, wizardState],
5872
);

0 commit comments

Comments
 (0)