Compare commits

...

5 Commits

@ -48,9 +48,9 @@
<CardList :hideTitle="true" :filters="filters" />
</block-box>
<block-box title="任务列表">
<!-- <block-box title="任务列表">
<TaskList :hideTitle="true" :filters="filters" />
</block-box>
</block-box> -->
</div>
</template>

@ -53,17 +53,17 @@ export default (Layout) => ({
component: () => import('~/vgpu/views/card/admin/Detail.vue'),
name: 'card-admin-detail',
},
{
path: '/admin/vgpu/task/admin',
component: () => import('~/vgpu/views/task/admin/index.vue'),
name: 'task-admin',
meta: { title: '任务管理', icon: 'vgpu-task', noCache: true },
},
{
path: '/admin/vgpu/task/admin/detail',
component: () => import('~/vgpu/views/task/admin/Detail.vue'),
name: 'task-admin-detail',
},
// {
// path: '/admin/vgpu/task/admin',
// component: () => import('~/vgpu/views/task/admin/index.vue'),
// name: 'task-admin',
// meta: { title: '任务管理', icon: 'vgpu-task', noCache: true },
// },
// {
// path: '/admin/vgpu/task/admin/detail',
// component: () => import('~/vgpu/views/task/admin/Detail.vue'),
// name: 'task-admin-detail',
// },
],
},
],

@ -69,7 +69,7 @@
</block-box>
</div>
<block-box title="任务列表">
<!-- <block-box title="任务列表">
<template v-if="detail.isExternal">
<el-alert title="由于显卡未纳管,无法获取到任务数据" show-icon type="warning" :closable="false" />
<el-empty description="暂无任务数据" :image-size="100" />
@ -77,7 +77,7 @@
<template v-else>
<TaskList :hideTitle="true" :filters="{ deviceId: detail.uuid }" />
</template>
</block-box>
</block-box> -->
</div>
</template>

@ -97,7 +97,7 @@
<CardList :hideTitle="true" :filters="{ nodeUid: detail.uid }" />
</block-box>
<block-box title="任务列表">
<!-- <block-box title="任务列表">
<template v-if="detail.isExternal">
<el-alert title="由于节点未纳管,无法获取到任务数据" show-icon type="warning" :closable="false" />
<el-empty description="暂无任务数据" :image-size="100" />
@ -105,7 +105,7 @@
<template v-else>
<TaskList :hideTitle="true" :filters="{ nodeUid: detail.uid }" />
</template>
</block-box>
</block-box> -->
</div>
</template>

@ -50,9 +50,9 @@
<CardList :hideTitle="true" :filters="data" />
</block-box>
<block-box title="任务列表">
<!-- <block-box title="任务列表">
<TaskList :hideTitle="true" :filters="data" />
</block-box>
</block-box> -->
</template>
<script setup lang="jsx">

@ -65,7 +65,8 @@ module.exports = defineConfig({
},
proxy: {
'/api/vgpu': {
target: 'http://172.16.100.14:29999',
// target: 'http://172.16.100.14:29999',
target: 'https://hami.educoder.net',
// target: 'http://192.168.2.99:8000',
changeOrigin: true,
},

@ -3,6 +3,7 @@ package data
import (
"context"
"fmt"
"k8s.io/client-go/tools/cache"
"sync"
"time"
"vgpu/internal/biz"
@ -15,24 +16,21 @@ import (
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/informers"
listerscorev1 "k8s.io/client-go/listers/core/v1"
"k8s.io/client-go/tools/cache"
)
type podRepo struct {
data *Data
podLister listerscorev1.PodLister
pods map[k8stypes.UID]*biz.PodInfo
allPods []*biz.PodInfo
mutex sync.RWMutex
log *log.Helper
}
func NewPodRepo(data *Data, logger log.Logger) biz.PodRepo {
repo := &podRepo{
data: data,
pods: make(map[k8stypes.UID]*biz.PodInfo),
allPods: []*biz.PodInfo{},
log: log.NewHelper(logger),
data: data,
pods: make(map[k8stypes.UID]*biz.PodInfo),
log: log.NewHelper(logger),
}
repo.init()
return repo
@ -59,8 +57,7 @@ func (r *podRepo) onAddPod(obj interface{}) {
return
}
nodeID, ok := pod.Annotations[util.AssignedNodeAnnotations]
tpiID := pod.Labels["tpi-id"]
if !ok && tpiID == "" {
if !ok {
return
}
if biz.IsPodInTerminatedState(pod) {
@ -84,8 +81,7 @@ func (r *podRepo) onDeletedPod(obj interface{}) {
return
}
_, ok = pod.Annotations[util.AssignedNodeAnnotations]
tpiID := pod.Labels["tpi-id"]
if !ok && tpiID == "" {
if !ok {
return
}
r.delPod(pod)
@ -98,7 +94,6 @@ func (r *podRepo) addPod(pod *corev1.Pod, nodeID string, devices biz.PodDevices)
pi := &biz.PodInfo{Name: pod.Name, UID: pod.UID, Namespace: pod.Namespace, NodeID: nodeID, Devices: devices, Ctrs: ctrs, Labels: pod.Labels}
r.pods[pod.UID] = pi
r.allPods = append(r.allPods, pi)
r.log.Infof("Pod added: Name: %s, UID: %s, Namespace: %s, NodeID: %s", pod.Name, pod.UID, pod.Namespace, nodeID)
}
@ -123,10 +118,10 @@ func (r *podRepo) fetchContainerInfo(pod *corev1.Pod) []*biz.Container {
copier.Copy(&bizContainerDevices, pds)
}
if len(bizContainerDevices) < 1 {
for range pod.Spec.Containers {
bizContainerDevices = append(bizContainerDevices, biz.ContainerDevices{})
}
//return containers
//for range pod.Spec.Containers {
// bizContainerDevices = append(bizContainerDevices, biz.ContainerDevices{})
//}
return containers
}
ctrIdMaps := map[string]string{}

Loading…
Cancel
Save