Skip to content

Commit acd6c6d

Browse files
fasdeploy frontend (#1198)
* end * end2 * end3 * end4 * end5 * end6 * end7 Co-authored-by: chenjian <[email protected]>
1 parent 9583bf7 commit acd6c6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+7581
-160
lines changed

frontend/packages/core/package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@
3939
"dist"
4040
],
4141
"dependencies": {
42+
"@antv/layout": "^0.3.7",
43+
"@antv/x6": "^2.0.2",
44+
"@antv/x6-plugin-clipboard": "^2.0.1",
45+
"@antv/x6-plugin-dnd": "^2.0.2",
46+
"@antv/x6-plugin-export": "^2.1.5",
47+
"@antv/x6-plugin-history": "^2.1.1",
48+
"@antv/x6-plugin-keyboard": "^2.1.2",
49+
"@antv/x6-plugin-selection": "^2.1.3",
50+
"@antv/x6-plugin-snapline": "^2.1.2",
51+
"@antv/x6-plugin-stencil": "^2.0.1",
52+
"@antv/x6-plugin-transform": "^2.0.1",
53+
"@antv/x6-react-shape": "^2.0.0",
4254
"@material-ui/core": "^4.12.4",
4355
"@snowpack/plugin-sass": "^1.4.0",
4456
"@tippyjs/react": "4.2.5",
@@ -60,7 +72,6 @@
6072
"i18next-browser-languagedetector": "6.1.2",
6173
"i18next-fetch-backend": "3.0.0",
6274
"jszip": "3.7.1",
63-
"lodash": "4.17.21",
6475
"mime-types": "2.1.32",
6576
"moment": "2.29.1",
6677
"nprogress": "0.2.0",
@@ -127,6 +138,7 @@
127138
"dotenv": "10.0.0",
128139
"enhanced-resolve": "5.8.2",
129140
"html-minifier": "4.0.0",
141+
"lodash": "^4.17.21",
130142
"snowpack": "3.8.8",
131143
"snowpack-plugin-copy": "1.0.1",
132144
"typescript": "4.4.2"
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"Load-model": "Please select a model repository",
3+
"Current-model": "Current model repository",
4+
"ensemble-pipeline": "ensemble pipeline",
5+
"variable": "variable",
6+
"instance": "instance",
7+
"Pre-trained": "Pre-trained model name",
8+
"The-config": "The config file chosen as startup config will overwrite config.pbtxt, and a backup config.pbtxt will be created first, please check to confirm",
9+
"Confirm": "Confirm to shutdown server",
10+
"Confirm-delete-config": "Confirm to delete config file",
11+
"Confirm-delete-resource": "Confirm to delete resource file",
12+
"load-model-repository": "load model repository",
13+
"ensemble-configuration": "ensemble configuration",
14+
"launch-server": "launch server",
15+
"cancel": "cancel",
16+
"launch": "launch",
17+
"set-as-launch-config": "set as start up config",
18+
"update": "update",
19+
"log": "log",
20+
"metric": "metric",
21+
"ok": "ok",
22+
"model-repository": "model repository",
23+
"open-client": "open client",
24+
"shutdown": "shutdown",
25+
"updates": "update",
26+
"Load-model-repository": "Load model repository",
27+
"Download-pre-trained-model": "Download pre-trained model",
28+
"Model-configuration": "Model configuration",
29+
"Ensemble-configuration": "Ensemble configuration",
30+
"Launch-parameters-configuration": "Launch parameters configuration",
31+
"Delete-config-file": "Delete config file",
32+
"Delete-resource-file": "Delete resource file",
33+
"Rename-resource-file": "Rename resource file",
34+
"Shutdown-server": "Shutdown server",
35+
"Update-configuration-successfully": "update configuration successfully",
36+
"Launch-server-successfully": "Launch server successfully",
37+
"Update-successfully": "Update log and metric for successfully",
38+
"Shutdown-server-successfully": "Shutdown server successfully",
39+
"Download-successfully": "Download pre-trained model successfully",
40+
"Set-successfully": "Set as startup config file successfully",
41+
"Rename-successfully": "Rename resource file successfully",
42+
"Delete-config-successfully": "Delete config file successfully",
43+
"Delete-resource-successfully": "Delete resource file successfully",
44+
"Backup-config": "Backup config file is not permitted to modify, please re-select",
45+
"Model-name": "Model name",
46+
"Execution-metric": "Execution metric",
47+
"inference-request-success": "inference request success",
48+
"inference-request-failure": "inference request failure",
49+
"inference-count": "inference count",
50+
"inference-exec-count": "inference exec count",
51+
"inference-request-duration": "inference request duration",
52+
"inference-queue-duration": "inference queue duration",
53+
"inference-comput-input-duration": "inference comput input duration",
54+
"inference-compute-infer-duration": "inference compute infer duration",
55+
"inference-compute-output-duration": "inference compute output duration",
56+
"Delay-metric": "Delay metric",
57+
"Device-name": "Device name",
58+
"Performance-metric": "Performance metric",
59+
"Memory": "Memory",
60+
"utilization": "utilization",
61+
"power-usage": "power usage",
62+
"power-limit": "power limit",
63+
"energy-consumption": "energy consumption",
64+
"total": "total",
65+
"used": "used",
66+
"Model-metrics": "Model metrics",
67+
"GPU-metrics": "GPU metrics"
68+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"Load-model": "请载入模型库",
3+
"Current-model": "当前模型库",
4+
"ensemble-pipeline": "ensemble模型结构",
5+
"variable": "变量",
6+
"instance": "实例",
7+
"Pre-trained": "预训练模型名",
8+
"The-config": "设为启动配置文件即会将当前文件作为config.pbtxt,并覆盖之前的config.pbtxt的内容,被覆盖前的config.pbtxt会自动进行备份,是否继续",
9+
"Confirm": "请确认是否关闭所启动服务",
10+
"Confirm-delete-config": "请确认是否删除配置文件",
11+
"Confirm-delete-resource": "请确认是否删除资源文件",
12+
"load-model-repository": "载入模型库",
13+
"ensemble-configuration": "ensemble配置",
14+
"launch-server": "启动服务",
15+
"cancel": "取消",
16+
"launch": "启动",
17+
"set-as-launch-config": "设为启动配置文件",
18+
"update": "更新",
19+
"log": "日志",
20+
"metric": "性能",
21+
"ok": "确定",
22+
"model-repository": "模型库配置",
23+
"open-client": "打开客户端",
24+
"shutdown": "关闭服务",
25+
"updates": "更新数据",
26+
"Load-model-repository": "载入模型库",
27+
"Download-pre-trained-model": "预训练模型下载",
28+
"Model-configuration": "配置模型",
29+
"Ensemble-configuration": "配置ensemble",
30+
"Launch-parameters-configuration": "配置启动参数",
31+
"Delete-config-file": "删除配置文件",
32+
"Delete-resource-file": "删除资源文件",
33+
"Rename-resource-file": "重命名文件",
34+
"Shutdown-server": "关闭服务",
35+
"Update-configuration-successfully": "更新配置成功",
36+
"Launch-server-successfully": "启动服务成功",
37+
"Update-successfully": "更新日志和性能数据成功",
38+
"Shutdown-server-successfully": "关闭服务成功",
39+
"Download-successfully": "下载预训练模型成功",
40+
"Set-successfully": "设为启动配置成功",
41+
"Rename-successfully": "重命名资源文件成功",
42+
"Delete-config-successfully": "删除配置文件成功",
43+
"Delete-resource-successfully": "删除资源文件成功",
44+
"Backup-config": "该文件为备份配置文件不允许修改,请重新选择",
45+
"Model-name": "模型名称",
46+
"Execution-metric": "执行统计",
47+
"inference-request-success": "请求处理成功数",
48+
"inference-request-failure": "请求处理失败数",
49+
"inference-count": "推理batch数",
50+
"inference-exec-count": "推理样本数",
51+
"inference-request-duration": "请求处理时间",
52+
"inference-queue-duration": "任务队列等待时间",
53+
"inference-comput-input-duration": "输入处理时间",
54+
"inference-compute-infer-duration": "模型推理时间",
55+
"inference-compute-output-duration": "输出处理时间",
56+
"Delay-metric": "延迟统计",
57+
"Device-name": "GPU",
58+
"Performance-metric": "性能指标",
59+
"Memory": "显存",
60+
"utilization": "利用率",
61+
"power-usage": "功率",
62+
"power-limit": "功率限制",
63+
"energy-consumption": "耗电量",
64+
"total": "总量",
65+
"used": "已使用",
66+
"Model-metrics": "模型服务监控",
67+
"GPU-metrics": "GPU监控"
68+
}

frontend/packages/core/snowpack.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ function isWorkspace() {
3737
const iconsPath = path.dirname(resolve.sync(cwd, '@visualdl/icons'));
3838
const netronPath = path.dirname(resolve.sync(cwd, '@visualdl/netron'));
3939
const netronPath2 = path.dirname(resolve.sync(cwd, '@visualdl/netron2'));
40+
// const netronPath3 = path.dirname(resolve.sync(cwd, '@visualdl/netron3'));
41+
4042
const TracePath = path.dirname(resolve.sync(cwd, './public/static'));
4143
const wasmPath = path.dirname(resolve.sync(cwd, '@visualdl/wasm'));
4244
const dest = path.resolve(cwd, './dist/__snowpack__/link/packages');
@@ -102,6 +104,10 @@ export default {
102104
source: [path.join(netronPath2, '**/*')],
103105
destination: path.join(dest, 'netron2/dist')
104106
},
107+
// {
108+
// source: [path.join(netronPath3, '**/*')],
109+
// destination: path.join(dest, 'netron3/dist')
110+
// },
105111
{
106112
source: [path.join(TracePath, '**/*')],
107113
destination: path.join(dest, 'trace/dist')
@@ -120,7 +126,7 @@ export default {
120126
},
121127
packageOptions: {
122128
polyfillNode: true,
123-
namedExports: ['gl-vec2', 'dagre'],
129+
namedExports: [],
124130
// knownEntrypoints: ['chai', '@testing-library/react', 'fetch-mock/esm/client']
125131
knownEntrypoints: ['chai', '@testing-library/react']
126132
},

frontend/packages/core/src/App.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
// cSpell:words pageview inited
1818
import 'antd/dist/antd.css';
19-
import React, {FunctionComponent, Suspense, useCallback, useEffect, useMemo, useState} from 'react';
20-
import {Redirect, Route, BrowserRouter as Router, Switch, useLocation, useHistory} from 'react-router-dom';
19+
import React, {FunctionComponent, Suspense, useCallback, useEffect, useMemo} from 'react';
20+
import {Redirect, Route, BrowserRouter as Router, Switch, useLocation} from 'react-router-dom';
2121
import {THEME, matchMedia} from '~/utils/theme';
2222
import {actions, selectors} from '~/store';
23-
import {headerHeight, position, size, zIndexes, setRem} from '~/utils/style';
23+
import {headerHeight, position, size, zIndexes} from '~/utils/style';
2424
import {useDispatch, useSelector} from 'react-redux';
2525
import ErrorBoundary from '~/components/ErrorBoundary';
2626
import ErrorPage from '~/pages/error';
@@ -32,12 +32,19 @@ import {ToastContainer} from 'react-toastify';
3232
import {fetcher} from '~/utils/fetch';
3333
import routes from '~/routes';
3434
import styled from 'styled-components';
35-
import {setDefaults, useTranslation} from 'react-i18next';
35+
import {useTranslation} from 'react-i18next';
3636

3737
const BASE_URI: string = import.meta.env.SNOWPACK_PUBLIC_BASE_URI;
3838

3939
const Main = styled.main`
4040
padding-top: ${headerHeight};
41+
.ant-select-selector {
42+
.ant-select-selection-item {
43+
.select_icon {
44+
display: none;
45+
}
46+
}
47+
}
4148
`;
4249

4350
const Header = styled.header`
@@ -74,10 +81,9 @@ const Telemetry: FunctionComponent = () => {
7481
}, [location.pathname]);
7582
return null;
7683
};
77-
84+
const defaultRoute = '';
7885
const App: FunctionComponent = () => {
7986
const {t, i18n} = useTranslation('errors');
80-
const [defaultRoute, setDefaultRoute] = useState('');
8187
const dir = useMemo(() => (i18n.language ? i18n.dir(i18n.language) : ''), [i18n]);
8288

8389
const dispatch = useDispatch();

frontend/packages/core/src/components/BarsChart.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
18-
import * as chart from '~/utils/chart';
19-
2017
import React, {useEffect, useImperativeHandle} from 'react';
2118
import {primaryColor} from '~/utils/style';
2219
import useECharts, {Options, Wrapper, useChartTheme} from '~/hooks/useECharts';
@@ -219,6 +216,7 @@ const Charts = React.forwardRef<BarChartRef, BarsChartProps>(
219216
});
220217
echart?.setOption(chartOptions, {notMerge: true});
221218
}
219+
// eslint-disable-next-line react-hooks/exhaustive-deps
222220
}, [options, data, title, theme, i18n.language, echart, isLegend, units, text]);
223221
return (
224222
<Wrapper ref={wrapper} className={className}>

frontend/packages/core/src/components/Check.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react-hooks/exhaustive-deps */
12
/**
23
* Copyright 2020 Baidu Inc. All Rights Reserved.
34
*

frontend/packages/core/src/components/CurvesPage/CurveChart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {rem, size} from '~/utils/style';
2323
import Chart from '~/components/Chart';
2424
import {Chart as ChartLoader} from '~/components/Loader/ChartPage';
2525
import ChartToolbox from '~/components/ChartToolbox';
26-
import type {EChartsOption} from 'echarts';
2726
import TooltipTable from '~/components/TooltipTable';
2827
import {cycleFetcher} from '~/utils/fetch';
2928
import {format} from 'd3-format';

frontend/packages/core/src/components/DistributedChart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import * as chart from '~/utils/chart';
17+
// import * as chart from '~/utils/chart';
1818

1919
import React, {useEffect, useCallback} from 'react';
2020
import {primaryColor} from '~/utils/style';
@@ -59,6 +59,7 @@ export type LineChartRef = {
5959

6060
const DistributedChart = React.forwardRef<LineChartRef, DistributedChartProps>(
6161
({options, data, titles, loading, zoom, className, onInit}, ref) => {
62+
console.log(ref);
6263
const {t} = useTranslation(['profiler', 'common']);
6364
const {i18n} = useTranslation();
6465

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import {Table} from 'antd';
2+
import type {ColumnsType} from 'antd/es/table';
3+
import React, {FunctionComponent, useEffect, useState} from 'react';
4+
import {useTranslation} from 'react-i18next';
5+
6+
interface DataType {
7+
key: string;
8+
name: string;
9+
money: string;
10+
address: string;
11+
}
12+
13+
type ArgumentProps = {
14+
Datas: any;
15+
};
16+
const App: FunctionComponent<ArgumentProps> = ({Datas}) => {
17+
const {t} = useTranslation(['Fastdeploy']);
18+
const columns: ColumnsType<DataType> = [
19+
{
20+
title: t('Fastdeploy:Device-name'),
21+
dataIndex: 'name',
22+
key: 'name',
23+
width: 100,
24+
fixed: 'left'
25+
},
26+
{
27+
title: t('Fastdeploy:Performance-metric'),
28+
children: [
29+
{
30+
title: `${t('Fastdeploy:utilization')}(%)`,
31+
dataIndex: 'nv_gpu_utilization',
32+
key: 'nv_gpu_utilization',
33+
width: 150
34+
},
35+
{
36+
title: `${t('Fastdeploy:power-usage')}(W)`,
37+
dataIndex: 'nv_gpu_power_usage',
38+
key: 'nv_gpu_power_usage',
39+
width: 150
40+
},
41+
{
42+
title: `${t('Fastdeploy:power-limit')}(W)`,
43+
dataIndex: 'nv_gpu_power_limit',
44+
key: 'nv_gpu_power_limit',
45+
width: 150
46+
},
47+
{
48+
title: `${t('Fastdeploy:energy-consumption')}(W)`,
49+
dataIndex: 'nv_energy_consumption',
50+
key: 'nv_energy_consumption',
51+
width: 150
52+
}
53+
]
54+
},
55+
{
56+
title: t('Fastdeploy:Memory'),
57+
children: [
58+
{
59+
title: `${t('Fastdeploy:total')}(GB)`,
60+
dataIndex: 'nv_gpu_memory_total_bytes',
61+
key: 'nv_gpu_memory_total_bytes',
62+
width: 150
63+
},
64+
{
65+
title: `${t('Fastdeploy:total')}(GB)`,
66+
dataIndex: 'nv_gpu_memory_used_bytes',
67+
key: 'nv_gpu_memory_used_bytes',
68+
width: 150
69+
}
70+
]
71+
}
72+
];
73+
const [tabelData, setTabelData] = useState<any>();
74+
useEffect(() => {
75+
if (!Datas) {
76+
return;
77+
}
78+
const arrays = Object.keys(Datas);
79+
const data = arrays.map((name: string) => {
80+
const model = Datas[name];
81+
82+
return {
83+
...model,
84+
key: name,
85+
name: name
86+
};
87+
});
88+
setTabelData(data);
89+
}, [Datas]);
90+
return <Table columns={columns} dataSource={tabelData} bordered pagination={false} />;
91+
};
92+
93+
export default App;

0 commit comments

Comments
 (0)