Browse Source

Merge branch 'dataMount' into V20221130

tags/v1.22.12.1^2
Gitea 3 years ago
parent
commit
8aefc89ed7
3 changed files with 34 additions and 1 deletions
  1. +15
    -0
      models/cloudbrain.go
  2. +16
    -0
      modules/modelarts/modelarts.go
  3. +3
    -1
      modules/modelarts/resty.go

+ 15
- 0
models/cloudbrain.go View File

@@ -1060,6 +1060,9 @@ type UserImageConfig struct {
CreateVersion bool `json:"create_version"`
Flavor Flavor `json:"flavor"`
PoolID string `json:"pool_id"`
ShareAddr string `json:"nas_share_addr"`
MountPath string `json:"nas_mount_path"`
NasType string `json:"nas_type"`
}

type CreateTrainJobParams struct {
@@ -1083,13 +1086,18 @@ type Config struct {
CreateVersion bool `json:"create_version"`
Flavor Flavor `json:"flavor"`
PoolID string `json:"pool_id"`
ShareAddr string `json:"nas_share_addr"`
MountPath string `json:"nas_mount_path"`
NasType string `json:"nas_type"`
}

type CreateInferenceJobParams struct {
JobName string `json:"job_name"`
Description string `json:"job_desc"`
InfConfig InfConfig `json:"config"`
WorkspaceID string `json:"workspace_id"`
}

type CreateInfUserImageParams struct {
JobName string `json:"job_name"`
Description string `json:"job_desc"`
@@ -1147,6 +1155,9 @@ type TrainJobVersionConfig struct {
Flavor Flavor `json:"flavor"`
PoolID string `json:"pool_id"`
PreVersionId int64 `json:"pre_version_id"`
ShareAddr string `json:"nas_share_addr"`
MountPath string `json:"nas_mount_path"`
NasType string `json:"nas_type"`
}

type TrainJobVersionUserImageConfig struct {
@@ -1162,6 +1173,9 @@ type TrainJobVersionUserImageConfig struct {
PreVersionId int64 `json:"pre_version_id"`
UserImageUrl string `json:"user_image_url"`
UserCommand string `json:"user_command"`
ShareAddr string `json:"nas_share_addr"`
MountPath string `json:"nas_mount_path"`
NasType string `json:"nas_type"`
}

type CreateConfigParams struct {
@@ -1177,6 +1191,7 @@ type CreateConfigParams struct {
LogUrl string `json:"log_url"`
Flavor Flavor `json:"flavor"`
PoolID string `json:"pool_id"`
Volumes []Volumes `json:"volumes"`
}

type Parameter struct {


+ 16
- 0
modules/modelarts/modelarts.go View File

@@ -71,6 +71,10 @@ const (
SortByCreateTime = "create_time"
ConfigTypeCustom = "custom"
TotalVersionCount = 1

ShareAddr = "192.168.0.30:/"
MountPath = "/cache/sfs"
NasType = "nfs"
)

var (
@@ -379,6 +383,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (jobId str
Parameter: req.Parameters,
UserImageUrl: req.UserImageUrl,
UserCommand: req.UserCommand,
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
},
})
} else {
@@ -399,6 +406,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (jobId str
Code: req.Spec.SourceSpecId,
},
Parameter: req.Parameters,
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
},
})
}
@@ -517,6 +527,9 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job
PreVersionId: req.PreVersionId,
UserImageUrl: req.UserImageUrl,
UserCommand: req.UserCommand,
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
},
}, jobId)
} else {
@@ -536,6 +549,9 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job
},
Parameter: req.Parameters,
PreVersionId: req.PreVersionId,
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
},
}, jobId)
}


+ 3
- 1
modules/modelarts/resty.go View File

@@ -497,7 +497,7 @@ sendjob:
}

req, _ := json.Marshal(createJobParams)
log.Info("%s", req)
log.Info("postapi json: %s", req)

if res.StatusCode() == http.StatusUnauthorized && retry < 1 {
retry++
@@ -543,6 +543,8 @@ func createTrainJob(createJobParams models.CreateTrainJobParams) (*models.Create
var result models.CreateTrainJobResult

retry := 0
req, _ := json.Marshal(createJobParams)
log.Info("postapi json: %s", req)

sendjob:
res, err := client.R().


Loading…
Cancel
Save