Browse Source

add

tags/v1.22.12.1^2
Gitea 3 years ago
parent
commit
405cd970e6
3 changed files with 21 additions and 30 deletions
  1. +9
    -5
      models/cloudbrain.go
  2. +9
    -23
      modules/modelarts/modelarts.go
  3. +3
    -2
      modules/modelarts/resty.go

+ 9
- 5
models/cloudbrain.go View File

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


type CreateTrainJobParams struct { type CreateTrainJobParams struct {
@@ -1081,10 +1083,12 @@ type Config struct {
LogUrl string `json:"log_url"` LogUrl string `json:"log_url"`
//UserImageUrl string `json:"user_image_url"` //UserImageUrl string `json:"user_image_url"`
//UserCommand string `json:"user_command"` //UserCommand string `json:"user_command"`
CreateVersion bool `json:"create_version"`
Flavor Flavor `json:"flavor"`
PoolID string `json:"pool_id"`
Volumes []Volumes `json:"volumes"`
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 { type CreateInferenceJobParams struct {


+ 9
- 23
modules/modelarts/modelarts.go View File

@@ -67,9 +67,9 @@ const (
ConfigTypeCustom = "custom" ConfigTypeCustom = "custom"
TotalVersionCount = 1 TotalVersionCount = 1


NfsID = "c6a73891-6a19-4a6a-a2e8-0d6baa72a7c5"
NfsSourcePath = "192.168.0.30:/"
NfsDestPath = "/cache/sfs"
ShareAddr = "192.168.0.30:/"
MountPath = "/cache/sfs"
NasType = "nfs"
) )


var ( var (
@@ -377,16 +377,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (jobId str
Parameter: req.Parameters, Parameter: req.Parameters,
UserImageUrl: req.UserImageUrl, UserImageUrl: req.UserImageUrl,
UserCommand: req.UserCommand, UserCommand: req.UserCommand,
Volumes: []models.Volumes{
{
Nfs: models.Nfs{
ID: NfsID,
SourcePath: NfsSourcePath,
DestPath: NfsDestPath,
ReadOnly: false,
},
},
},
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
}, },
}) })
} else { } else {
@@ -407,16 +400,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (jobId str
Code: req.Spec.SourceSpecId, Code: req.Spec.SourceSpecId,
}, },
Parameter: req.Parameters, Parameter: req.Parameters,
Volumes: []models.Volumes{
{
Nfs: models.Nfs{
ID: NfsID,
SourcePath: NfsSourcePath,
DestPath: NfsDestPath,
ReadOnly: false,
},
},
},
ShareAddr: ShareAddr,
MountPath: MountPath,
NasType: NasType,
}, },
}) })
} }


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

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


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


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


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


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


Loading…
Cancel
Save