Compare commits

..

No commits in common. 'online_demonstration' and 'main' have entirely different histories.

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

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

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

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

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

@ -65,8 +65,7 @@ module.exports = defineConfig({
}, },
proxy: { proxy: {
'/api/vgpu': { '/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', // target: 'http://192.168.2.99:8000',
changeOrigin: true, changeOrigin: true,
}, },

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

Loading…
Cancel
Save