Skip to content

Commit

Permalink
[ML] Model management fixes and usability enhancements (elastic#118240)
Browse files Browse the repository at this point in the history
* [ML] update expanded rows on refresh

* [ML] truncateText for start and state columns

* remove deployment stats endpoints, replace with the trained models stats

* update layout for pipelines

* add edit icon

* rename deployment actions

* add panels for pipelines tab

* change deployment stats layout

* remove redundant fields from node details

* render roles with badges

* format nodes attrs

* hide empty stats tab

* enable trained models tests

* add canViewMlNodes capability, hide Nodes tab for the viewer

* remove unused translation

* support force stop

* import default ml capabilities in the security_solutions plugin

* update translation string id

* Revert "support force stop"

This reverts commit 1b1a3b2

* fix translation string ids

* remove mock id

* rename test subject

* remove getTrainedModelDeploymentStats leftovers

* update tags for nodes_overview endpoint

* update api integration tests

* fix paddings

* add info icons for ingest stats

* update api integration tests for capabilities with spaces

* expand first 3 pipelines by default

* fix typo in the filename

* add help_icon component

* fix test assertion
  • Loading branch information
darnautov authored and TinLe committed Dec 22, 2021
1 parent 6ef325b commit f44312a
Show file tree
Hide file tree
Showing 30 changed files with 882 additions and 774 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/ml/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export { composeValidators, patternValidator } from './util/validators';
export { isRuntimeMappings, isRuntimeField } from './util/runtime_field_utils';
export { extractErrorMessage } from './util/errors';
export type { RuntimeMappings } from './types/fields';
export { getDefaultCapabilities as getDefaultMlCapabilities } from './types/capabilities';
2 changes: 2 additions & 0 deletions x-pack/plugins/ml/common/types/capabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export const adminMlCapabilities = {
// Alerts
canCreateMlAlerts: false,
canUseMlAlerts: false,
// Model management
canViewMlNodes: false,
};

export type UserMlCapabilities = typeof userMlCapabilities;
Expand Down
14 changes: 12 additions & 2 deletions x-pack/plugins/ml/common/types/trained_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export interface TrainedModelDeploymentStatsResponse {
routing_state: { routing_state: string };
average_inference_time_ms: number;
last_access: number;
number_of_pending_requests: number;
start_time: number;
}>;
}

Expand All @@ -161,25 +163,33 @@ export interface AllocatedModel {
state: string;
allocation_count: number;
};
model_id: string;
/**
* Not required for rendering in the Model stats
*/
model_id?: string;
state: string;
model_threads: number;
model_size_bytes: number;
node: {
/**
* Not required for rendering in the Nodes overview
*/
name?: string;
average_inference_time_ms: number;
inference_count: number;
routing_state: {
routing_state: string;
reason?: string;
};
last_access?: number;
number_of_pending_requests: number;
start_time: number;
};
}

export interface NodeDeploymentStatsResponse {
id: string;
name: string;
transport_address: string;
attributes: Record<string, string>;
roles: string[];
allocated_models: AllocatedModel[];
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React, { FC, ReactNode } from 'react';
import { EuiIcon, EuiToolTip } from '@elastic/eui';

export const HelpIcon: FC<{ content: ReactNode | string }> = ({ content }) => {
return (
<EuiToolTip position="top" content={content}>
<EuiIcon
tabIndex={0}
type="questionInCircle"
color={'subdued'}
className="eui-alignTop"
size="s"
/>
</EuiToolTip>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

export { HelpIcon } from './help_icon';
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
ModelPipelines,
TrainedModelStat,
NodesOverviewResponse,
TrainedModelDeploymentStatsResponse,
} from '../../../../common/types/trained_models';

export interface InferenceQueryParams {
Expand Down Expand Up @@ -122,21 +121,6 @@ export function trainedModelsApiProvider(httpService: HttpService) {
});
},

getTrainedModelDeploymentStats(modelId?: string | string[]) {
let model = modelId ?? '*';
if (Array.isArray(modelId)) {
model = modelId.join(',');
}

return httpService.http<{
count: number;
deployment_stats: TrainedModelDeploymentStatsResponse[];
}>({
path: `${apiBasePath}/trained_models/${model}/deployment/_stats`,
method: 'GET',
});
},

getTrainedModelsNodesOverview() {
return httpService.http<NodesOverviewResponse>({
path: `${apiBasePath}/trained_models/nodes_overview`,
Expand Down
Loading

0 comments on commit f44312a

Please sign in to comment.