| @@ -71,7 +71,8 @@ var ( | |||||
| FlavorInfos *models.FlavorInfos | FlavorInfos *models.FlavorInfos | ||||
| ImageInfos *models.ImageInfosModelArts | ImageInfos *models.ImageInfosModelArts | ||||
| TrainFlavorInfos *Flavor | TrainFlavorInfos *Flavor | ||||
| SpecialPools *models.SpecialPools | |||||
| SpecialPools *models.SpecialPools | |||||
| MultiNodeConfig *MultiNodes | |||||
| ) | ) | ||||
| type GenerateTrainJobReq struct { | type GenerateTrainJobReq struct { | ||||
| @@ -166,6 +167,14 @@ type ResourcePool struct { | |||||
| } `json:"resource_pool"` | } `json:"resource_pool"` | ||||
| } | } | ||||
| type MultiNodes struct{ | |||||
| Info []OrgMultiNode `json:"multinode"` | |||||
| } | |||||
| type OrgMultiNode struct{ | |||||
| Org string `json:"org"` | |||||
| Node []int `json:"node"` | |||||
| } | |||||
| // type Parameter struct { | // type Parameter struct { | ||||
| // Label string `json:"label"` | // Label string `json:"label"` | ||||
| // Value string `json:"value"` | // Value string `json:"value"` | ||||
| @@ -773,6 +782,13 @@ func InitSpecialPool() { | |||||
| } | } | ||||
| } | } | ||||
| func InitMultiNode(){ | |||||
| if MultiNodeConfig ==nil && setting.ModelArtsMultiNode!=""{ | |||||
| json.Unmarshal([]byte(setting.ModelArtsMultiNode), &MultiNodeConfig) | |||||
| } | |||||
| } | |||||
| func HandleTrainJobInfo(task *models.Cloudbrain) error { | func HandleTrainJobInfo(task *models.Cloudbrain) error { | ||||
| result, err := GetTrainJob(task.JobID, strconv.FormatInt(task.VersionID, 10)) | result, err := GetTrainJob(task.JobID, strconv.FormatInt(task.VersionID, 10)) | ||||
| @@ -547,6 +547,7 @@ var ( | |||||
| FlavorInfos string | FlavorInfos string | ||||
| TrainJobFLAVORINFOS string | TrainJobFLAVORINFOS string | ||||
| ModelArtsSpecialPools string | ModelArtsSpecialPools string | ||||
| ModelArtsMultiNode string | |||||
| //grampus config | //grampus config | ||||
| Grampus = struct { | Grampus = struct { | ||||
| @@ -1432,6 +1433,7 @@ func NewContext() { | |||||
| FlavorInfos = sec.Key("FLAVOR_INFOS").MustString("") | FlavorInfos = sec.Key("FLAVOR_INFOS").MustString("") | ||||
| TrainJobFLAVORINFOS = sec.Key("TrainJob_FLAVOR_INFOS").MustString("") | TrainJobFLAVORINFOS = sec.Key("TrainJob_FLAVOR_INFOS").MustString("") | ||||
| ModelArtsSpecialPools = sec.Key("SPECIAL_POOL").MustString("") | ModelArtsSpecialPools = sec.Key("SPECIAL_POOL").MustString("") | ||||
| ModelArtsMultiNode=sec.Key("MULTI_NODE").MustString("") | |||||
| sec = Cfg.Section("elk") | sec = Cfg.Section("elk") | ||||
| ElkUrl = sec.Key("ELKURL").MustString("") | ElkUrl = sec.Key("ELKURL").MustString("") | ||||
| @@ -763,9 +763,23 @@ func trainJobNewDataPrepare(ctx *context.Context) error { | |||||
| waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "") | waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "") | ||||
| ctx.Data["WaitCount"] = waitCount | ctx.Data["WaitCount"] = waitCount | ||||
| setMultiNodeIfConfigureMatch(ctx) | |||||
| return nil | return nil | ||||
| } | } | ||||
| func setMultiNodeIfConfigureMatch(ctx *context.Context) { | |||||
| modelarts.InitMultiNode() | |||||
| if modelarts.MultiNodeConfig != nil { | |||||
| for _, info := range modelarts.MultiNodeConfig.Info { | |||||
| if isInOrg, _ := models.IsOrganizationMemberByOrgName(info.Org, ctx.User.ID); isInOrg { | |||||
| ctx.Data["WorkNode"] = info.Node | |||||
| break | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| func setSpecBySpecialPoolConfig(ctx *context.Context, jobType string) { | func setSpecBySpecialPoolConfig(ctx *context.Context, jobType string) { | ||||
| modelarts.InitSpecialPool() | modelarts.InitSpecialPool() | ||||
| @@ -880,6 +894,7 @@ func trainJobErrorNewDataPrepare(ctx *context.Context, form auth.CreateModelArts | |||||
| ctx.Data["datasetType"] = models.TypeCloudBrainTwo | ctx.Data["datasetType"] = models.TypeCloudBrainTwo | ||||
| waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "") | waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "") | ||||
| ctx.Data["WaitCount"] = waitCount | ctx.Data["WaitCount"] = waitCount | ||||
| setMultiNodeIfConfigureMatch(ctx) | |||||
| return nil | return nil | ||||
| } | } | ||||
| @@ -287,8 +287,15 @@ | |||||
| id="trainjob_work_server_num" tabindex="3" autofocus required maxlength="255" value="1" | id="trainjob_work_server_num" tabindex="3" autofocus required maxlength="255" value="1" | ||||
| readonly> | readonly> | ||||
| <div class="field" id="trainjob_work_server_num_select" name="work_server_number_select"> | <div class="field" id="trainjob_work_server_num_select" name="work_server_number_select"> | ||||
| <select class="ui dropdown width" style='width: 100%;' name="work_server_id"> | |||||
| <select class="ui dropdown width" style='width: 100%;' name="work_server_id"> | |||||
| {{if .WorkNode}} | |||||
| {{range .WorkNode}} | |||||
| <option name="server_id" value="{{.}}">{{.}}</option> | |||||
| {{end}} | |||||
| {{else}} | |||||
| <option name="server_id" value="1">1</option> | <option name="server_id" value="1">1</option> | ||||
| {{end}} | |||||
| </select> | </select> | ||||
| </div> | </div> | ||||