Browse Source

更新函数名

pull/19/head
songjc 2 years ago
parent
commit
a085c8f568
5 changed files with 42 additions and 14 deletions
  1. +12
    -12
      api/pcm/pcm.go
  2. +1
    -1
      api/storage/cache.go
  3. +1
    -1
      api/storage/storage_test.go
  4. +2
    -0
      models/job.go
  5. +26
    -0
      utils/convertto/convertto.go

+ 12
- 12
api/pcm/pcm.go View File

@@ -12,7 +12,7 @@ import (
const CORRECT_CODE int = 200

type UploadImageReq struct {
NodeID int64 `json:"nodeID"`
SlwNodeID int64 `json:"slwNodeID"`
ImagePath string `json:"imagePath"`
}

@@ -52,7 +52,7 @@ func (c *Client) UploadImage(req UploadImageReq) (*UploadImageResp, error) {
}

type GetImageListReq struct {
NodeID int64 `json:"nodeID"`
SlwNodeID int64 `json:"slwNodeID"`
}

type GetImageListResp struct {
@@ -90,8 +90,8 @@ func (c *Client) GetImageList(req GetImageListReq) (*GetImageListResp, error) {
}

type DeleteImageReq struct {
NodeID int64 `json:"nodeID"`
PCMJobID int64 `json:"pcmJobID"`
SlwNodeID int64 `json:"slwNodeID"`
PCMJobID int64 `json:"pcmJobID"`
}

type DeleteImageResp struct {
@@ -129,10 +129,10 @@ func (c *Client) DeleteImage(req DeleteImageReq) (*DeleteImageResp, error) {
}

type ScheduleTaskReq struct {
NodeID int64 `json:"nodeID"`
Envs []map[string]string `json:"envs"`
ImageID int64 `json:"imageID"`
CMDLine string `json:"cmdLine"`
SlwNodeID int64 `json:"slwNodeID"`
Envs []map[string]string `json:"envs"`
ImageID int64 `json:"imageID"`
CMDLine string `json:"cmdLine"`
}

type ScheduleTaskResp struct {
@@ -171,8 +171,8 @@ func (c *Client) ScheduleTask(req ScheduleTaskReq) (*ScheduleTaskResp, error) {
}

type GetTaskStatusReq struct {
NodeID int64 `json:"nodeID"`
PCMJobID int64 `json:"pcmJobID"`
SlwNodeID int64 `json:"slwNodeID"`
PCMJobID int64 `json:"pcmJobID"`
}

type GetTaskStatusResp struct {
@@ -211,8 +211,8 @@ func (c *Client) GetTaskStatus(req GetTaskStatusReq) (*GetTaskStatusResp, error)
}

type DeleteTaskReq struct {
NodeID int64 `json:"nodeID"`
PCMJobID int64 `json:"pcmJobID"`
SlwNodeID int64 `json:"slwNodeID"`
PCMJobID int64 `json:"pcmJobID"`
}

type DeleteTaskResp struct {


+ 1
- 1
api/storage/cache.go View File

@@ -13,7 +13,7 @@ import (
type CacheMovePackageReq struct {
UserID int64 `json:"userID"`
PackageID int64 `json:"packageID"`
NodeID int64 `json:"nodeID"`
StgNodeID int64 `json:"stgNodeID"`
}

func (c *Client) CacheMovePackage(req CacheMovePackageReq) error {


+ 1
- 1
api/storage/storage_test.go View File

@@ -145,7 +145,7 @@ func Test_Cache(t *testing.T) {
err = cli.CacheMovePackage(CacheMovePackageReq{
UserID: 0,
PackageID: upResp.PackageID,
NodeID: 1,
StgNodeID: 1,
})
So(err, ShouldBeNil)



+ 2
- 0
models/job.go View File

@@ -88,6 +88,8 @@ type EnvVar struct {
Value string `json:"value"`
}

// CPU、GPU、NPU、MLU单位为:核
// Storage、Memory单位为:字节
type JobResourcesInfo struct {
CPU float64 `json:"cpu"`
GPU float64 `json:"gpu"`


+ 26
- 0
utils/convertto/convertto.go View File

@@ -0,0 +1,26 @@
package convertto

import (
"github.com/inhies/go-bytesize"
)

func GBToBytes(gb float64) int64 {
// 将 float64 转换为 bytesize.ByteSize 类型
size := bytesize.GB * bytesize.ByteSize(gb)

// 获取字节数
bytes := int64(size)

return bytes
}

func BytesToGB(bytes int64) float64 {
// 将字节数转换成 ByteSize 类型
size := bytesize.B * bytesize.ByteSize(bytes)

// 获取 GB 值
gb := float64(size)

return gb

}

Loading…
Cancel
Save