去掉算力功能

main
陈博文 4 days ago
parent c0ecc88331
commit bedb4ebe19

@ -26,6 +26,7 @@ const props = defineProps({
key: String,
config: Array,
onClick: Function,
xName: String,
});
const currentConfig = ref(props.config);
const tabActive = ref('');
@ -45,6 +46,7 @@ const getTopOptions = () => {
(item) => item.key === tabActive.value,
);
const data = cloneDeep(config?.data) || [];
const xName = props?.xName || (props?.title?.slice(4, 7) || '') + '%';
return {
tooltip: {
trigger: 'axis',
@ -67,18 +69,26 @@ const getTopOptions = () => {
show: false,
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
top: '0',
// left: '3%',
// right: '4%',
// bottom: '3%',
// top: '0',
containLabel: true,
},
xAxis: {
type: 'value',
boundaryGap: [0, 0.01],
name: xName, // x
nameLocation: 'end', //
nameTextStyle: {
verticalAlign: 'top', //
align: 'right', //
padding: [30, 0, 0, 0] // 30
}
},
yAxis: {
type: 'category',
name: '节点',
data: data
.reverse()
.map((item) =>

@ -78,13 +78,13 @@ const totalTop = {
data: [],
query: `topk(5, sum(hami_container_vgpu_allocated{}) by (${props.type}) / sum(hami_vgpu_count{}) by (${props.type}) * 100)`,
},
{
tab: '算力',
key: 'core',
nameKey: props.type,
data: [],
query: `topk(5, sum(hami_container_vcore_allocated{}) by (${props.type}) / sum(hami_core_size{}) by (${props.type}) * 100)`,
},
// {
// tab: '',
// key: 'core',
// nameKey: props.type,
// data: [],
// query: `topk(5, sum(hami_container_vcore_allocated{}) by (${props.type}) / sum(hami_core_size{}) by (${props.type}) * 100)`,
// },
{
tab: '显存',
key: 'memory',
@ -112,13 +112,13 @@ const usedTop = {
data: [],
query: `topk(5, ((sum(node_memory_MemTotal_bytes) by (instance)) - sum(node_memory_MemAvailable_bytes) by (instance)) / sum(node_memory_MemTotal_bytes) by (instance) * 100)`,
},
{
tab: '算力',
key: 'core',
nameKey: props.type,
data: [],
query: `topk(5, avg(hami_core_util_avg) by (${props.type}))`,
},
// {
// tab: '',
// key: 'core',
// nameKey: props.type,
// data: [],
// query: `topk(5, avg(hami_core_util_avg) by (${props.type}))`,
// },
{
tab: '显存',
key: 'memory',

@ -18,7 +18,7 @@
<block-box>
<ul class="card-gauges">
<li v-for="(item, index) in gaugeConfig" :key="index">
<li v-for="(item, index) in gaugeConfig.slice(-3)" :key="index">
<template v-if="!detail.isExternal || index >= 2">
<Gauge v-bind="item" />
</template>
@ -39,14 +39,11 @@
<time-picker v-model="times" type="datetimerange" size="small" />
</template>
<div style="height: 200px">
<echarts-plus
:options="
getRangeOptions({
core: gaugeConfig[0].data,
memory: gaugeConfig[1].data,
})
"
/>
<echarts-plus :options="getRangeOptions({
core: gaugeConfig[0].data,
memory: gaugeConfig[1].data,
})
" />
</div>
</block-box>
<block-box title="资源使用趋势(%">
@ -54,14 +51,11 @@
<time-picker v-model="times" type="datetimerange" size="small" />
</template>
<div style="height: 200px">
<echarts-plus
:options="
getRangeOptions({
core: gaugeConfig[2].data,
memory: gaugeConfig[3].data,
})
"
/>
<echarts-plus :options="getRangeOptions({
core: gaugeConfig[2].data,
memory: gaugeConfig[3].data,
})
" />
</div>
</block-box>
@ -93,7 +87,7 @@ import { useRoute } from 'vue-router';
import BlockBox from '@/components/BlockBox.vue';
import { onMounted, ref, watch, defineProps } from 'vue';
import TaskList from '~/vgpu/views/task/admin/index.vue';
import {ElPopover} from 'element-plus';
import { ElPopover } from 'element-plus';
import Gauge from '~/vgpu/components/gauge.vue';
import useInstantVector from '~/vgpu/hooks/useInstantVector';
import { QuestionFilled } from '@element-plus/icons-vue';
@ -134,36 +128,36 @@ const columns = [
const text = health ? '健康' : '硬件错误';
const color = health ? '#2563eb' : '#EF4444';
return (
<div
style={{
color,
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
gap: '5px',
<div
style={{
color,
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
gap: '5px',
}}
>
<el-tag disable-transitions type={isExternal ? 'warning' : (health ? 'success' : 'danger')}>
{isExternal ? '未纳管' : (health ? '健康' : '硬件错误')}
</el-tag>
{!health && (
<ElPopover trigger="hover" popper-style={{ width: '190px' }}>
{{
reference: () => (
<el-icon color="#939EA9" size="14">
<QuestionFilled />
</el-icon>
),
default: () => (
<span style={{ marginLeft: '5px' }}>
请排查该 GPU 硬件问题
</span>
),
}}
>
<el-tag disable-transitions type={isExternal ? 'warning' : (health ? 'success' : 'danger')}>
{isExternal ? '未纳管' : (health ? '健康' : '硬件错误')}
</el-tag>
{!health && (
<ElPopover trigger="hover" popper-style={{ width: '190px' }}>
{{
reference: () => (
<el-icon color="#939EA9" size="14">
<QuestionFilled />
</el-icon>
),
default: () => (
<span style={{ marginLeft: '5px' }}>
请排查该 GPU 硬件问题
</span>
),
}}
</ElPopover>
)}
</div>
</ElPopover>
)}
</div>
);
} else {
return <el-tag disable-transitions size="small" type="info">加载中...</el-tag>;
@ -201,9 +195,9 @@ const columns = [
width: 120,
value: 'mode',
render: ({ mode, type }) => (
<el-tag disable-transitions>
{type?.split('-')[0] === "NVIDIA" ? mode : 'default'}
</el-tag>
<el-tag disable-transitions>
{type?.split('-')[0] === "NVIDIA" ? mode : 'default'}
</el-tag>
)
}
];
@ -362,9 +356,11 @@ watch(
//line-height: 20px;
margin-bottom: 20px;
}
.card-detail-left {
min-width: 1050px;
}
.card-detail-info {
//display: flex;
//flex-direction: column;
@ -393,6 +389,7 @@ watch(
list-style: none;
display: flex;
height: 200px;
li {
flex: 1;
}
@ -407,6 +404,7 @@ watch(
.node-block {
display: flex;
flex-direction: column;
.home-block-content {
flex: 1;
}

@ -55,39 +55,39 @@ export const getRangeOptions = ({ core = [], memory = [] }) => {
},
},
series: [
{
name: '算力',
data: core,
type: 'line',
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0, // 渐变起始点 0%
y: 0, // 渐变起始点 0%
x2: 0, // 渐变结束点 100%
y2: 1, // 渐变结束点 100%
colorStops: [
{
offset: 0,
color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
},
{
offset: 1,
color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
},
],
global: false, // 缺省为 false
},
},
},
itemStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
lineStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
},
// {
// name: '算力',
// data: core,
// type: 'line',
// areaStyle: {
// normal: {
// color: {
// type: 'linear',
// x: 0, // 渐变起始点 0%
// y: 0, // 渐变起始点 0%
// x2: 0, // 渐变结束点 100%
// y2: 1, // 渐变结束点 100%
// colorStops: [
// {
// offset: 0,
// color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
// },
// {
// offset: 1,
// color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
// },
// ],
// global: false, // 缺省为 false
// },
// },
// },
// itemStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// lineStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// },
{
name: '显存',
data: memory,

@ -97,16 +97,16 @@ const columns = [
</span>
),
},
{
title: '算力(已分配/总量)',
width: 120,
dataIndex: 'used',
render: ({ coreTotal, coreUsed, isExternal }) => (
<span>
{isExternal ? '--' : coreUsed}/{coreTotal}
</span>
),
},
// {
// title: '(/)',
// width: 120,
// dataIndex: 'used',
// render: ({ coreTotal, coreUsed, isExternal }) => (
// <span>
// {isExternal ? '--' : coreUsed}/{coreTotal}
// </span>
// ),
// },
{
title: '显存(已分配/总量)',
dataIndex: 'w',

@ -36,40 +36,40 @@ export const rangeConfigInit = [
color: 'rgb(250, 200, 88)',
},
},
{
name: '算力',
query: `sum(hami_container_vcore_allocated) / sum(hami_core_size) * 100`,
data: [],
type: 'line',
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(84, 112, 198, 0.16)',
},
{
offset: 1,
color: 'rgba(84, 112, 198, 0.00)',
},
],
global: false,
},
},
},
itemStyle: {
color: 'rgb(84, 112, 198)',
},
lineStyle: {
color: 'rgb(84, 112, 198)',
},
},
// {
// name: '算力',
// query: `sum(hami_container_vcore_allocated) / sum(hami_core_size) * 100`,
// data: [],
// type: 'line',
// areaStyle: {
// normal: {
// color: {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// colorStops: [
// {
// offset: 0,
// color: 'rgba(84, 112, 198, 0.16)',
// },
// {
// offset: 1,
// color: 'rgba(84, 112, 198, 0.00)',
// },
// ],
// global: false,
// },
// },
// },
// itemStyle: {
// color: 'rgb(84, 112, 198)',
// },
// lineStyle: {
// color: 'rgb(84, 112, 198)',
// },
// },
{
name: '显存',
query: `sum(hami_container_vmemory_allocated) / sum(hami_memory_size) * 100`,
@ -177,39 +177,39 @@ export const rangeConfigInit = [
{
title: '资源使用趋势',
dataSource: [
{
name: '算力',
query: `avg(hami_core_util_avg)`,
data: [],
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0, // 渐变起始点 0%
y: 0, // 渐变起始点 0%
x2: 0, // 渐变结束点 100%
y2: 1, // 渐变结束点 100%
colorStops: [
{
offset: 0,
color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
},
{
offset: 1,
color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
},
],
global: false, // 缺省为 false
},
},
},
itemStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
lineStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
},
// {
// name: '算力',
// query: `avg(hami_core_util_avg)`,
// data: [],
// areaStyle: {
// normal: {
// color: {
// type: 'linear',
// x: 0, // 渐变起始点 0%
// y: 0, // 渐变起始点 0%
// x2: 0, // 渐变结束点 100%
// y2: 1, // 渐变结束点 100%
// colorStops: [
// {
// offset: 0,
// color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
// },
// {
// offset: 1,
// color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
// },
// ],
// global: false, // 缺省为 false
// },
// },
// },
// itemStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// lineStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// },
{
name: '显存',
query: `sum(hami_memory_used) / sum(hami_memory_size) * 100`,

@ -8,14 +8,15 @@
</div>
</template> -->
<div class="card-overview">
<div v-for="item in cardGaugeConfig.slice(0, 5)" :key="item.title">
<Gauge v-bind="item" />
</div>
<template v-for="(item, index) in cardGaugeConfig.slice(0, 5)" :key="item.title">
<Gauge v-if="index !== 4" v-bind="item" />
</template>
</div>
<div class="card-overview">
<div v-for="item in cardGaugeConfig.slice(-3)" :key="item.title">
<Gauge v-bind="item" />
</div>
<template v-for="(item, index) in cardGaugeConfig.slice(-3)" :key="item.title">
<Gauge v-if="index !== 1" v-bind="item" />
</template>
</div>
</Block>
<Block title="资源总览">
@ -25,20 +26,19 @@
</div>
</template> -->
<ul class="resourceOverview">
<li v-for="{ title, count, icon, to, unit } in resourceOverview" :key="title"
:style="{ cursor: to ? 'pointer' : 'default' }" @click="sendRouteChange(to)">
<div class="avatar">
<svg-icon :icon="icon" />
</div>
<div class="main">
<div>
{{ title }}
<template v-for="({ title, count, icon, to, unit }, index) in resourceOverview" :key="title">
<li v-if="index !== 7" :style="{ cursor: to ? 'pointer' : 'default' }" @click="sendRouteChange(to)">
<div class="avatar">
<svg-icon :icon="icon" />
</div>
<div class="count">
{{ count }} <span style="font-size: 12px">{{ unit }}</span>
<div class="main">
<div>{{ title }}</div>
<div class="count">
{{ count }} <span style="font-size: 12px">{{ unit }}</span>
</div>
</div>
</div>
</li>
</li>
</template>
</ul>
</Block>
@ -393,13 +393,13 @@ const nodeUsedTop = {
// data: [],
// query: 'topk(5, ((node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes))',
// },
{
tab: '算力',
key: 'core',
nameKey: 'node',
data: [],
query: 'topk(5, avg(hami_core_util_avg) by (node))',
},
// {
// tab: '',
// key: 'core',
// nameKey: 'node',
// data: [],
// query: 'topk(5, avg(hami_core_util_avg) by (node))',
// },
{
tab: '显存',
key: 'memory',
@ -436,14 +436,14 @@ const nodeTotalTop = {
data: [],
query: `topk(5, avg(hami_container_vgpu_allocated{}) by (node) / avg(hami_vgpu_count{}) by (node) * 100)`,
},
{
tab: '算力',
key: 'core',
nameKey: 'node',
data: [],
query:
'topk(5, avg(hami_container_vcore_allocated{}) by (node) / avg(hami_core_size{}) by (node) * 100)',
},
// {
// tab: '',
// key: 'core',
// nameKey: 'node',
// data: [],
// query:
// 'topk(5, avg(hami_container_vcore_allocated{}) by (node) / avg(hami_core_size{}) by (node) * 100)',
// },
{
tab: '显存',
key: 'memory',
@ -562,7 +562,7 @@ watch(
padding-bottom: 10px;
height: 190px;
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-columns: repeat(4, 1fr);
.gauge-info {
margin-top: 10px;

@ -49,14 +49,16 @@
</li>
</ul>
<ul class="card-gauges" style="margin-top: 20px;">
<li v-for="(item, index) in gaugeConfig.slice(4, 7)" :key="index">
<template v-if="!detail.isExternal || item.title.includes('使用率')">
<Gauge v-bind="item" />
</template>
<template v-else-if="detail.isExternal && item.title.includes('')">
<el-empty description="暂无资源分配数据" :image-size="90" />
</template>
</li>
<template v-for="(item, index) in gaugeConfig.slice(4, 7)" :key="index">
<li v-if="index === 1"> <!-- index=1 -->
<template v-if="!detail.isExternal || item.title.includes('使用率')">
<Gauge v-bind="item" />
</template>
<template v-else-if="detail.isExternal && item.title.includes('')">
<el-empty description="暂无资源分配数据" :image-size="90" />
</template>
</li>
</template>
</ul>
</block-box>

@ -61,39 +61,39 @@ export const getRangeOptions = ({
},
},
series: [
{
name: '算力',
data: core,
type: 'line',
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0, // 渐变起始点 0%
y: 0, // 渐变起始点 0%
x2: 0, // 渐变结束点 100%
y2: 1, // 渐变结束点 100%
colorStops: [
{
offset: 0,
color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
},
{
offset: 1,
color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
},
],
global: false, // 缺省为 false
},
},
},
itemStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
lineStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
},
// {
// name: '算力',
// data: core,
// type: 'line',
// areaStyle: {
// normal: {
// color: {
// type: 'linear',
// x: 0, // 渐变起始点 0%
// y: 0, // 渐变起始点 0%
// x2: 0, // 渐变结束点 100%
// y2: 1, // 渐变结束点 100%
// colorStops: [
// {
// offset: 0,
// color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
// },
// {
// offset: 1,
// color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
// },
// ],
// global: false, // 缺省为 false
// },
// },
// },
// itemStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// lineStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// },
{
name: '显存',
data: memory,

@ -191,16 +191,16 @@ const columns = [
</span>
),
},
{
title: '算力(已分配/总量)',
width: 120,
dataIndex: 'used',
render: ({ coreTotal, coreUsed, isExternal }) => (
<span>
{isExternal ? '--' : coreUsed}/{coreTotal}
</span>
),
},
// {
// title: '(/)',
// width: 120,
// dataIndex: 'used',
// render: ({ coreTotal, coreUsed, isExternal }) => (
// <span>
// {isExternal ? '--' : coreUsed}/{coreTotal}
// </span>
// ),
// },
{
title: '显存(已分配/总量)',
dataIndex: 'w',

@ -104,16 +104,16 @@ const columns = [
</span>
),
},
{
title: '算力(已分配/总量)',
width: 120,
dataIndex: 'used',
render: ({ coreTotal, coreUsed, isExternal }) => (
<span>
{isExternal ? '--' : coreUsed}/{coreTotal}
</span>
),
},
// {
// title: '(/)',
// width: 120,
// dataIndex: 'used',
// render: ({ coreTotal, coreUsed, isExternal }) => (
// <span>
// {isExternal ? '--' : coreUsed}/{coreTotal}
// </span>
// ),
// },
{
title: '显存(已分配/总量)',
dataIndex: 'w',

@ -7,9 +7,11 @@
</li>
</ul>
<ul class="card-gauges" style="margin-top: 20px;">
<li v-for="(item, index) in gaugeConfig.slice(4, 7)" :key="index">
<Gauge v-bind="item" />
</li>
<template v-for="(item, index) in gaugeConfig.slice(4, 7)" :key="index">
<li v-if="index === 1"> <!-- index=1 -->
<Gauge v-bind="item" />
</li>
</template>
</ul>
</block-box>

@ -61,39 +61,39 @@ export const getRangeOptions = ({
},
},
series: [
{
name: '算力',
data: core,
type: 'line',
areaStyle: {
normal: {
color: {
type: 'linear',
x: 0, // 渐变起始点 0%
y: 0, // 渐变起始点 0%
x2: 0, // 渐变结束点 100%
y2: 1, // 渐变结束点 100%
colorStops: [
{
offset: 0,
color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
},
{
offset: 1,
color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
},
],
global: false, // 缺省为 false
},
},
},
itemStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
lineStyle: {
color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
},
},
// {
// name: '算力',
// data: core,
// type: 'line',
// areaStyle: {
// normal: {
// color: {
// type: 'linear',
// x: 0, // 渐变起始点 0%
// y: 0, // 渐变起始点 0%
// x2: 0, // 渐变结束点 100%
// y2: 1, // 渐变结束点 100%
// colorStops: [
// {
// offset: 0,
// color: 'rgba(84, 112, 198, 0.16)', // 渐变起始颜色
// },
// {
// offset: 1,
// color: 'rgba(84, 112, 198, 0.00)', // 渐变结束颜色
// },
// ],
// global: false, // 缺省为 false
// },
// },
// },
// itemStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// lineStyle: {
// color: 'rgb(84, 112, 198)', // 设置线条颜色为橙色
// },
// },
{
name: '显存',
data: memory,

@ -34,7 +34,7 @@
</ul>
</div>
<div class="right">
<div v-for="item in gaugeConfig" :key="item.title">
<div v-for="item in gaugeConfig.slice(-1)" :key="item.title">
<Gauge v-bind="item" />
</div>
</div>
@ -42,7 +42,8 @@
</block-box>
<template v-for="({ title, data }, index) in lineConfig">
<block-box v-if="detail.deviceIds?.length || [2, 3].includes(index)" :key="title + index" :title="title">
<block-box v-if="detail.deviceIds?.length ? [1, 2, 3].includes(index) : [2, 3].includes(index)" :key="title + index"
:title="title">
<template #extra v-if="detail.type && detail.type.startsWith('NVIDIA')">
<time-picker v-model="times" type="datetimerange" size="small" />
</template>
@ -177,10 +178,10 @@ const columns = [
render: ({ requestedMemory }) => <span>{bytesToGB(requestedMemory)} GiB</span>,
},
{
label: '分配算力',
value: 'allocatedCores',
},
// {
// label: '',
// value: 'allocatedCores',
// },
{
label: '分配显存',
value: 'allocatedMem',

@ -170,11 +170,11 @@ const columns = [
);
},
},
{
title: '分配算力',
dataIndex: 'allocatedCores',
render: ({ allocatedCores }) => `${allocatedCores} `,
},
// {
// title: '',
// dataIndex: 'allocatedCores',
// render: ({ allocatedCores }) => `${allocatedCores} `,
// },
{
title: '分配显存',
dataIndex: 'allocatedMem',

@ -38,6 +38,7 @@ const topConfig = [
{
title: '任务数量分布 Top5',
key: 'total',
xName: '任务数',
config: [
{
tab: '节点',
@ -62,6 +63,7 @@ const topConfig = [
{
title: '任务资源申请 Top5',
key: 'apply',
xName: '资源',
config: [
// {
// tab: 'CPU',
@ -79,14 +81,14 @@ const topConfig = [
// nameKey: 'container_pod_uuid',
// query: 'topk(5, sum by(container_pod_uuid) (hami_container_vmemory_allocated))',
// },
{
tab: '算力',
key: 'core',
data: [],
nameKey: 'container_pod_uuid',
unit: ' ',
query: 'topk(5, avg by (container_pod_uuid) (hami_container_vcore_allocated))',
},
// {
// tab: '',
// key: 'core',
// data: [],
// nameKey: 'container_pod_uuid',
// unit: ' ',
// query: 'topk(5, avg by (container_pod_uuid) (hami_container_vcore_allocated))',
// },
{
tab: '显存',
key: 'memory',

Loading…
Cancel
Save