-
Notifications
You must be signed in to change notification settings - Fork 178
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
handle kserve in global model serving page #2001
Merged
openshift-ci
merged 1 commit into
opendatahub-io:f/model-serving
from
christianvogt:global-model-serving
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { KnownLabels } from '~/k8sTypes'; | ||
|
||
export const LABEL_SELECTOR_DASHBOARD_RESOURCE = `${KnownLabels.DASHBOARD_RESOURCE}=true`; | ||
export const LABEL_SELECTOR_MODEL_SERVING_PROJECT = `${KnownLabels.MODEL_SERVING_PROJECT}=true`; | ||
export const LABEL_SELECTOR_MODEL_SERVING_PROJECT = KnownLabels.MODEL_SERVING_PROJECT; | ||
export const LABEL_SELECTOR_DATA_CONNECTION_AWS = `${KnownLabels.DATA_CONNECTION_AWS}=true`; | ||
export const LABEL_SELECTOR_PROJECT_SHARING = `${KnownLabels.PROJECT_SHARING}=true`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
frontend/src/pages/modelServing/screens/global/InferenceServiceModel.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/src/pages/modelServing/screens/global/InferenceServiceServingRuntime.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from 'react'; | ||
import { ServingRuntimeKind } from '~/k8sTypes'; | ||
import { getDisplayNameFromServingRuntimeTemplate } from '~/pages/modelServing/customServingRuntimes/utils'; | ||
|
||
type Props = { | ||
servingRuntime?: ServingRuntimeKind; | ||
}; | ||
|
||
const InferenceServiceServingRuntime: React.FC<Props> = ({ servingRuntime }) => ( | ||
<>{servingRuntime ? getDisplayNameFromServingRuntimeTemplate(servingRuntime) : 'Unknown'}</> | ||
); | ||
|
||
export default InferenceServiceServingRuntime; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
frontend/src/pages/modelServing/screens/global/__tests__/InferenceServiceProject.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { mockInferenceServiceK8sResource } from '~/__mocks__/mockInferenceServiceK8sResource'; | ||
import InferenceServiceProject from '~/pages/modelServing/screens/global/InferenceServiceProject'; | ||
import { ProjectsContext } from '~/concepts/projects/ProjectsContext'; | ||
import { mockProjectK8sResource } from '~/__mocks__/mockProjectK8sResource'; | ||
import { ProjectKind } from '~/k8sTypes'; | ||
|
||
describe('InferenceServiceProject', () => { | ||
it('should render error if loading fails', () => { | ||
const result = render( | ||
<InferenceServiceProject inferenceService={mockInferenceServiceK8sResource({})} />, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
loadError: new Error('test loading error'), | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText(/test loading error/)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render modelmesh project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [ | ||
mockProjectK8sResource({ | ||
k8sName: 'my-project', | ||
displayName: 'My Project', | ||
enableModelMesh: true, | ||
}), | ||
], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).toBeInTheDocument(); | ||
expect(result.queryByText('Multi-model serving enabled')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render kserve project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [ | ||
mockProjectK8sResource({ | ||
k8sName: 'my-project', | ||
displayName: 'My Project', | ||
enableModelMesh: false, | ||
}), | ||
], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).toBeInTheDocument(); | ||
expect(result.queryByText('Single model serving enabled')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render kserve project', () => { | ||
const result = render( | ||
<InferenceServiceProject | ||
inferenceService={mockInferenceServiceK8sResource({ | ||
namespace: 'my-project', | ||
})} | ||
/>, | ||
{ | ||
wrapper: ({ children }) => ( | ||
<ProjectsContext.Provider | ||
value={ | ||
{ | ||
loaded: true, | ||
modelServingProjects: [] as ProjectKind[], | ||
} as React.ComponentProps<typeof ProjectsContext.Provider>['value'] | ||
} | ||
> | ||
{children} | ||
</ProjectsContext.Provider> | ||
), | ||
}, | ||
); | ||
|
||
expect(result.queryByText('My Project')).not.toBeInTheDocument(); | ||
expect(result.queryByText('Unknown')).toBeInTheDocument(); | ||
expect(result.queryByText('Single model serving enabled')).not.toBeInTheDocument(); | ||
expect(result.queryByText('Multi-model serving enabled')).not.toBeInTheDocument(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...d/src/pages/modelServing/screens/global/__tests__/InferenceServiceServingRuntime.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import InferenceServiceServingRuntime from '~/pages/modelServing/screens/global/InferenceServiceServingRuntime'; | ||
import { mockServingRuntimeK8sResource } from '~/__mocks__/mockServingRuntimeK8sResource'; | ||
|
||
describe('InferenceServiceServingRuntime', () => { | ||
it('should handle undefined serving runtime', () => { | ||
const wrapper = render(<InferenceServiceServingRuntime />); | ||
expect(wrapper.container.textContent).toBe('Unknown'); | ||
}); | ||
|
||
it('should display serving runtime name', () => { | ||
const mockServingRuntime = mockServingRuntimeK8sResource({}); | ||
const wrapper = render(<InferenceServiceServingRuntime servingRuntime={mockServingRuntime} />); | ||
expect(wrapper.container.textContent).toBe('OpenVINO Serving Runtime (Supports GPUs)'); | ||
}); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could give a little bit of padding, but that can be a follow up enhancement and we can discuss it later with UX