Browse Source

Merge remote-tracking branch 'origin/res-manage' into res-manage

pull/2765/head
chenyifan01 2 years ago
parent
commit
bf60a67e0d
3 changed files with 50 additions and 22 deletions
  1. +0
    -1
      web_src/vuepages/apis/modules/resources.js
  2. +15
    -11
      web_src/vuepages/pages/resources/components/SceneDialog.vue
  3. +35
    -10
      web_src/vuepages/pages/resources/scene/index.vue

+ 0
- 1
web_src/vuepages/apis/modules/resources.js View File

@@ -127,7 +127,6 @@ export const syncResSpecification = () => {
"JobType":"TRAIN", //任务类型 DEBUG调试任务 BENCHMARK 评测任务 TRAIN 训练 INFERENCE 推理
"IsExclusive":true, //是否专属
"ExclusiveOrg":"123,456", //专属组织
"QueueId":2, //队列id
"SpecIds":[2,3] // 资源规格id
}
*/


+ 15
- 11
web_src/vuepages/pages/resources/components/SceneDialog.vue View File

@@ -130,10 +130,10 @@ export default {
QueueId: '',
SpecIds: [],
}
this.queueList = [];
this.specsList = [];
this.queueList.splice(0, Infinity);
this.specsList.splice(0, Infinity);
},
getQueueList() {
getQueueList(next) {
return getResQueueCode({ cluster: this.dataInfo.Cluster }).then(res => {
res = res.data;
if (res.Code === 0) {
@@ -146,9 +146,15 @@ export default {
v: `${item.QueueCode}(${getListValueWithKey(this.clusterList, item.Cluster)} - ${item.AiCenterName})`,
});
}
if (this.dataInfo.Cluster === 'C2Net') {
list.unshift({
k: '-1',
v: this.$t('resourcesManagement.allResQueue'),
});
}
this.queueList.splice(0, Infinity, ...list);
if (this.queueList.length === 0) {
this.changeQueue();
if (next) {
this.getResSpecificationList();
}
}
}).catch(err => {
@@ -158,11 +164,11 @@ export default {
getResSpecificationList() {
const params = {
cluster: this.dataInfo.Cluster,
queue: this.dataInfo.QueueId,
queue: this.dataInfo.QueueId === '-1' ? '' : this.dataInfo.QueueId,
status: 2,
page: 1,
};
getResSpecificationList(params).then(res => {
return getResSpecificationList(params).then(res => {
res = res.data;
if (res.Code === 0) {
const list = res.Data.List;
@@ -201,12 +207,10 @@ export default {
if (this.type === 'add') {
//
} else if (this.type === 'edit') {
this.dataInfo = Object.assign(this.dataInfo, { ...this.data });
Object.assign(this.dataInfo, { ...this.data, QueueId: this.data.QueueIds.length === 1 ? this.data.QueueIds[0] : '-1' });
this.queueList.splice(0, Infinity);
this.specsList.splice(0, Infinity);
this.getQueueList().then(() => {
this.getResSpecificationList();
});
this.getQueueList(true);
}
this.$emit("open");
},


+ 35
- 10
web_src/vuepages/pages/resources/scene/index.vue View File

@@ -43,9 +43,23 @@
</template>
</el-table-column>
<el-table-column prop="AiCenterStr" :label="$t('resourcesManagement.aiCenter')" align="center"
header-align="center"></el-table-column>
header-align="center">
<template slot-scope="scope">
<div v-if="!scope.row.Queues.length">--</div>
<div v-for="item in scope.row.Queues" :key="item.QueueId">
<span>{{ item.AiCenterName }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="QueueStr" :label="$t('resourcesManagement.resQueue')" align="center"
header-align="center"></el-table-column>
header-align="center">
<template slot-scope="scope">
<div v-if="!scope.row.Queues.length">--</div>
<div v-for="item in scope.row.Queues" :key="item.QueueId">
<span>{{ item.QueueStr }}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="SpecsList" :label="$t('resourcesManagement.resourceSpecification')" align="left"
header-align="center" min-width="180">
<template slot-scope="scope">
@@ -172,13 +186,26 @@ export default {
const data = list.map((item) => {
const Specs = item.Specs;
const specsList = [];
const queues = [], queueIds = [];
let cluster = '';
for (let i = 0, iLen = Specs.length; i < iLen; i++) {
const Spec = Specs[i];
const NGPU = `${item.ComputeResource}:${Spec.AccCardsNum === 0 ? '0' : Spec.AccCardsNum + '*' + getListValueWithKey(this.accCardTypeList, item.AccCardType)}`;
const NGPU = `${Spec.ComputeResource}:${Spec.AccCardsNum === 0 ? '0' : Spec.AccCardsNum + '*' + getListValueWithKey(this.accCardTypeList, Spec.AccCardType)}`;
specsList.push({
k: Spec.ID,
v: `${NGPU}, CPU:${Spec.CpuCores}, ${this.$t('resourcesManagement.gpuMem')}:${Spec.GPUMemGiB}GB, ${this.$t('resourcesManagement.mem')}:${Spec.MemGiB}GB, ${this.$t('resourcesManagement.shareMem')}:${Spec.ShareMemGiB}GB, ${this.$t('resourcesManagement.unitPrice')}:${Spec.UnitPrice}${this.$t('resourcesManagement.point_hr')}`,
})
});
cluster = Spec.Cluster;
if (queueIds.indexOf(Spec.QueueId) < 0) {
queues.push({
QueueId: Spec.QueueId,
QueueCode: Spec.QueueCode,
AiCenterCode: Spec.AiCenterCode,
AiCenterName: getListValueWithKey(this.aiCenterList, Spec.AiCenterCode),
QueueStr: `${Spec.QueueCode}(${getListValueWithKey(this.clusterList, Spec.Cluster)} - ${getListValueWithKey(this.aiCenterList, Spec.AiCenterCode)})`,
});
queueIds.push(Spec.QueueId);
}
}
return {
ID: item.ID,
@@ -188,11 +215,9 @@ export default {
IsExclusive: item.IsExclusive,
IsExclusiveStr: getListValueWithKey(this.isExclusiveList, item.IsExclusive ? '1' : '2'),
ExclusiveOrg: item.ExclusiveOrg,
AiCenterCode: item.AiCenterCode,
AiCenterStr: getListValueWithKey(this.aiCenterList, item.AiCenterCode),
Cluster: item.Cluster,
QueueId: item.QueueId,
QueueStr: item.QueueCode ? `${item.QueueCode}(${getListValueWithKey(this.clusterList, item.Cluster)} - ${getListValueWithKey(this.aiCenterList, item.AiCenterCode)})` : '--',
Cluster: cluster,
QueueIds: queueIds,
Queues: queues,
SpecsList: specsList,
}
});
@@ -253,7 +278,7 @@ export default {
IsExclusive: data.IsExclusive ? '1' : '2',
ExclusiveOrg: data.ExclusiveOrg,
Cluster: data.Cluster,
QueueId: data.QueueId,
QueueIds: data.QueueIds,
SpecIds: data.SpecsList.map((item) => item.k),
} : {};
this.sceneDialogShow = true;


Loading…
Cancel
Save