updated ai db functions
Former-commit-id: c1a9ee19503fbedfe980ec175ec0fc846dd26e87
This commit is contained in:
parent
7701012136
commit
95c43cf271
|
@ -61,7 +61,7 @@ func (l *GetCenterOverviewLogic) GetCenterOverview() (resp *types.CenterOverview
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.CardNum = centerNum
|
resp.CardNum = cardNum
|
||||||
resp.PowerInTops = totalTops
|
resp.PowerInTops = totalTops
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|
|
@ -169,6 +169,34 @@ func (s *AiStorage) GetClusterResourcesById(clusterId string) (*models.TClusterR
|
||||||
return &clusterResource, nil
|
return &clusterResource, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *AiStorage) SaveClusterResources(clusterId string, clusterName string, clusterType int64, cpuAvail float64, cpuTotal float64,
|
||||||
|
memAvail float64, memTotal float64, diskAvail float64, diskTotal float64, gpuAvail float64, gpuTotal float64, cardTotal int64, topsTotal float64) error {
|
||||||
|
cId, err := strconv.ParseInt(clusterId, 10, 64)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
clusterResource := models.TClusterResource{
|
||||||
|
ClusterId: cId,
|
||||||
|
ClusterName: clusterName,
|
||||||
|
ClusterType: clusterType,
|
||||||
|
CpuAvail: cpuAvail,
|
||||||
|
CpuTotal: cpuTotal,
|
||||||
|
MemAvail: memAvail,
|
||||||
|
MemTotal: memTotal,
|
||||||
|
DiskAvail: diskAvail,
|
||||||
|
DiskTotal: diskTotal,
|
||||||
|
GpuAvail: gpuAvail,
|
||||||
|
GpuTotal: gpuTotal,
|
||||||
|
CardTotal: cardTotal,
|
||||||
|
CardTopsTotal: topsTotal,
|
||||||
|
}
|
||||||
|
tx := s.DbEngin.Create(&clusterResource)
|
||||||
|
if tx.Error != nil {
|
||||||
|
return tx.Error
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *AiStorage) UpdateTask() error {
|
func (s *AiStorage) UpdateTask() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue