diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 746aca32e..9cc9dc1ed 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -71,10 +71,6 @@ const ( SortByCreateTime = "create_time" ConfigTypeCustom = "custom" TotalVersionCount = 1 - - ShareAddr = "192.168.0.30:/" - MountPath = "/cache/sfs" - NasType = "nfs" ) var ( @@ -285,7 +281,7 @@ func GenerateTask(ctx *context.Context, jobName, uuid, description, flavor strin return nil } -func GenerateNotebook2(ctx *context.Context, displayJobName, jobName, uuid, description, imageId string, spec *models.Specification, bootFile string,autoStopDurationInMs int64) (string, error) { +func GenerateNotebook2(ctx *context.Context, displayJobName, jobName, uuid, description, imageId string, spec *models.Specification, bootFile string, autoStopDurationInMs int64) (string, error) { if poolInfos == nil { json.Unmarshal([]byte(setting.PoolInfos), &poolInfos) } @@ -383,9 +379,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, + ShareAddr: setting.ModelArtsShareAddr, + MountPath: setting.ModelArtsMountPath, + NasType: setting.ModelArtsNasType, }, }) } else { @@ -406,9 +402,9 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (jobId str Code: req.Spec.SourceSpecId, }, Parameter: req.Parameters, - ShareAddr: ShareAddr, - MountPath: MountPath, - NasType: NasType, + ShareAddr: setting.ModelArtsShareAddr, + MountPath: setting.ModelArtsMountPath, + NasType: setting.ModelArtsNasType, }, }) } @@ -527,9 +523,9 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job PreVersionId: req.PreVersionId, UserImageUrl: req.UserImageUrl, UserCommand: req.UserCommand, - ShareAddr: ShareAddr, - MountPath: MountPath, - NasType: NasType, + ShareAddr: setting.ModelArtsShareAddr, + MountPath: setting.ModelArtsMountPath, + NasType: setting.ModelArtsNasType, }, }, jobId) } else { @@ -549,9 +545,9 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobReq, job }, Parameter: req.Parameters, PreVersionId: req.PreVersionId, - ShareAddr: ShareAddr, - MountPath: MountPath, - NasType: NasType, + ShareAddr: setting.ModelArtsShareAddr, + MountPath: setting.ModelArtsMountPath, + NasType: setting.ModelArtsNasType, }, }, jobId) } @@ -988,14 +984,14 @@ func getJupyterBaseUrl(url string) string { } func getCookiesAndCsrf(jupyterUrl string) ([]*http.Cookie, string) { - log.Info("jupyter url:"+jupyterUrl) + log.Info("jupyter url:" + jupyterUrl) var cookies []*http.Cookie const retryTimes = 10 for i := 0; i < retryTimes; i++ { res, err := http.Get(jupyterUrl) if err != nil { - log.Error("browser jupyterUrl failed.",err) - if i==retryTimes-1{ + log.Error("browser jupyterUrl failed.", err) + if i == retryTimes-1 { return cookies, "" } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index a473dad6a..601a20309 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -584,6 +584,9 @@ var ( TrainJobFLAVORINFOS string ModelArtsSpecialPools string ModelArtsMultiNode string + ModelArtsShareAddr string + ModelArtsMountPath string + ModelArtsNasType string //kanban IsCloudbrainTimingEnabled bool @@ -1542,6 +1545,9 @@ func NewContext() { TrainJobFLAVORINFOS = sec.Key("TrainJob_FLAVOR_INFOS").MustString("") ModelArtsSpecialPools = sec.Key("SPECIAL_POOL").MustString("") ModelArtsMultiNode = sec.Key("MULTI_NODE").MustString("") + ModelArtsShareAddr = sec.Key("ModelArts_Share_Addr").MustString("192.168.0.30:/") + ModelArtsMountPath = sec.Key("ModelArts_Mount_Path").MustString("/cache/sfs") + ModelArtsNasType = sec.Key("ModelArts_Nas_Type").MustString("nfs") sec = Cfg.Section("elk") ElkUrl = sec.Key("ELKURL").MustString("")