Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dchourasia committed Oct 18, 2024
2 parents 1fb5ecd + e385f43 commit f7d1ec6
Show file tree
Hide file tree
Showing 39 changed files with 989 additions and 303 deletions.
2 changes: 2 additions & 0 deletions frontend/src/__mocks__/mockInferenceServiceK8sResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export const mockInferenceServiceK8sResource = ({
generation: 1,
labels: {
name,
[KnownLabels.REGISTERED_MODEL_ID]: '1',
[KnownLabels.MODEL_VERSION_ID]: '3',
[KnownLabels.DASHBOARD_RESOURCE]: 'true',
...(kserveInternalLabel && { 'networking.knative.dev/visibility': 'cluster-local' }),
},
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/__mocks__/mockModelVersion.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { ModelVersion, ModelState } from '~/concepts/modelRegistry/types';
import { createModelRegistryLabelsObject } from './utils';
import {
ModelVersion,
ModelState,
ModelRegistryCustomProperties,
} from '~/concepts/modelRegistry/types';

type MockModelVersionType = {
author?: string;
id?: string;
registeredModelId?: string;
name?: string;
labels?: string[];
state?: ModelState;
description?: string;
createTimeSinceEpoch?: string;
lastUpdateTimeSinceEpoch?: string;
customProperties?: ModelRegistryCustomProperties;
};

export const mockModelVersion = ({
author = 'Test author',
registeredModelId = '1',
name = 'new model version',
labels = [],
customProperties = {},
id = '1',
state = ModelState.LIVE,
description = 'Description of model version',
Expand All @@ -26,7 +29,7 @@ export const mockModelVersion = ({
}: MockModelVersionType): ModelVersion => ({
author,
createTimeSinceEpoch,
customProperties: createModelRegistryLabelsObject(labels),
customProperties,
id,
lastUpdateTimeSinceEpoch,
name,
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/__mocks__/mockRegisteredModel.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
import { RegisteredModel, ModelState } from '~/concepts/modelRegistry/types';
import { createModelRegistryLabelsObject } from './utils';
import {
RegisteredModel,
ModelState,
ModelRegistryCustomProperties,
} from '~/concepts/modelRegistry/types';

type MockRegisteredModelType = {
id?: string;
name?: string;
owner?: string;
state?: ModelState;
description?: string;
labels?: string[];
customProperties?: ModelRegistryCustomProperties;
};

export const mockRegisteredModel = ({
name = 'test',
owner = 'Author 1',
state = ModelState.LIVE,
description = '',
labels = [],
customProperties = {},
id = '1',
}: MockRegisteredModelType): RegisteredModel => ({
createTimeSinceEpoch: '1710404288975',
Expand All @@ -26,5 +29,5 @@ export const mockRegisteredModel = ({
name,
state,
owner,
customProperties: createModelRegistryLabelsObject(labels),
customProperties,
});
48 changes: 22 additions & 26 deletions frontend/src/__mocks__/mockRegisteredModelsList.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegisteredModelList } from '~/concepts/modelRegistry/types';
import { ModelRegistryMetadataType, RegisteredModelList } from '~/concepts/modelRegistry/types';
import { mockRegisteredModel } from './mockRegisteredModel';

export const mockRegisteredModelList = ({
Expand All @@ -10,39 +10,35 @@ export const mockRegisteredModelList = ({
name: 'Fraud detection model',
description:
'A machine learning model trained to detect fraudulent transactions in financial data',
labels: [
'Financial data',
'Fraud detection',
'Test label',
'Machine learning',
'Next data to be overflow',
],
customProperties: {
'Financial data': {
metadataType: ModelRegistryMetadataType.STRING,
// eslint-disable-next-line camelcase
string_value: '',
},
},
}),
mockRegisteredModel({
name: 'Credit Scoring',
labels: [
'Credit Score Predictor',
'Creditworthiness scoring system',
'Default Risk Analyzer',
'Portfolio Management',
'Risk Assessment',
],
customProperties: {
'Credit Score Predictor': {
metadataType: ModelRegistryMetadataType.STRING,
// eslint-disable-next-line camelcase
string_value: '',
},
},
}),
mockRegisteredModel({
name: 'Label modal',
description:
'A machine learning model trained to detect fraudulent transactions in financial data',
labels: [
'Testing label',
'Financial data',
'Fraud detection',
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc',
'Machine learning',
'Next data to be overflow',
'Label x',
'Label y',
'Label z',
],
customProperties: {
'Testing label': {
metadataType: ModelRegistryMetadataType.STRING,
// eslint-disable-next-line camelcase
string_value: '',
},
},
}),
],
}: Partial<RegisteredModelList>): RegisteredModelList => ({
Expand Down
16 changes: 0 additions & 16 deletions frontend/src/__mocks__/utils.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ class ModelVersionArchive {
return cy.findByTestId('archive-version-page-breadcrumb');
}

findVersionDetailsTab() {
return cy.findByTestId('model-versions-details-tab');
}

findVersionDeploymentTab() {
return cy.findByTestId('deployments-tab');
}

findArchiveVersionTable() {
return cy.findByTestId('model-versions-archive-table');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TableRow } from '~/__tests__/cypress/cypress/pages/components/table';

class ModelVersionDetails {
visit() {
const preferredModelRegistry = 'modelregistry-sample';
Expand Down Expand Up @@ -70,6 +72,54 @@ class ModelVersionDetails {
findRegisteredDeploymentsTab() {
return cy.findByTestId('deployments-tab');
}

findAddPropertyButton() {
return cy.findByTestId('add-property-button');
}

findAddKeyInput() {
return cy.findByTestId('add-property-key-input');
}

findAddValueInput() {
return cy.findByTestId('add-property-value-input');
}

findKeyEditInput(key: string) {
return cy.findByTestId(['edit-property-key-input', key]);
}

findValueEditInput(value: string) {
return cy.findByTestId(['edit-property-value-input', value]);
}

findSaveButton() {
return cy.findByTestId('save-edit-button-property');
}

findCancelButton() {
return cy.findByTestId('discard-edit-button-property');
}

findExpandControlButton() {
return cy.findByTestId('expand-control-button');
}

private findTable() {
return cy.findByTestId('properties-table');
}

findPropertiesTableRows() {
return this.findTable().find('tbody tr');
}

getRow(name: string) {
return new PropertyRow(() =>
this.findTable().find(`[data-label=Key]`).contains(name).parents('tr'),
);
}
}

class PropertyRow extends TableRow {}

export const modelVersionDetails = new ModelVersionDetails();
8 changes: 8 additions & 0 deletions frontend/src/__tests__/cypress/cypress/pages/modelServing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ class InferenceServiceRow extends TableRow {
findInternalServicePopover() {
return cy.findByTestId('internal-service-popover');
}

findExternalServiceButton() {
return this.find().findByTestId('internal-external-service-button');
}

findExternalServicePopover() {
return cy.findByTestId('external-service-popover');
}
}
class ServingPlatformCard extends Contextual<HTMLElement> {
findDeployModelButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import { mockModelRegistryService } from '~/__mocks__/mockModelRegistryService';
import { asProjectEditUser } from '~/__tests__/cypress/cypress/utils/mockUsers';
import { mockSelfSubjectRulesReview } from '~/__mocks__/mockSelfSubjectRulesReview';
import { mockSelfSubjectAccessReview } from '~/__mocks__/mockSelfSubjectAccessReview';
import type { ModelVersion, RegisteredModel } from '~/concepts/modelRegistry/types';
import {
ModelRegistryMetadataType,
type ModelVersion,
type RegisteredModel,
} from '~/concepts/modelRegistry/types';
import type { ServiceKind } from '~/k8sTypes';

const MODEL_REGISTRY_API_VERSION = 'v1alpha3';
Expand All @@ -41,29 +45,72 @@ const initIntercepts = ({
name: 'Fraud detection model',
description:
'A machine learning model trained to detect fraudulent transactions in financial data',
labels: [
'Financial data',
'Fraud detection',
'Test label',
'Machine learning',
'Next data to be overflow',
],
customProperties: {
'Financial data': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Fraud detection': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Test label': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Machine learning': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Next data to be overflow': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
},
}),
mockRegisteredModel({
name: 'Label modal',
description:
'A machine learning model trained to detect fraudulent transactions in financial data',
labels: [
'Testing label',
'Financial data',
'Fraud detection',
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc',
'Machine learning',
'Next data to be overflow',
'Label x',
'Label y',
'Label z',
],
customProperties: {
'Testing label': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Financial data': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Fraud detection': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Long label data to be truncated abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc':
{
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Machine learning': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Next data to be overflow': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Label x': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Label y': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
'Label z': {
metadataType: ModelRegistryMetadataType.STRING,
string_value: '',
},
},
}),
],
modelVersions = [
Expand Down
Loading

0 comments on commit f7d1ec6

Please sign in to comment.