|
|
@@ -1130,6 +1130,13 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
VersionCount := modelarts.VersionCountOne |
|
|
VersionCount := modelarts.VersionCountOne |
|
|
EngineName := form.EngineName |
|
|
EngineName := form.EngineName |
|
|
|
|
|
|
|
|
|
|
|
errStr:=checkMultiNode(ctx.User.ID,form.WorkServerNumber) |
|
|
|
|
|
if errStr!=""{ |
|
|
|
|
|
trainJobErrorNewDataPrepare(ctx, form) |
|
|
|
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobNew, &form) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) |
|
|
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
@@ -1160,7 +1167,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
errStr := checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) |
|
|
|
|
|
|
|
|
errStr = checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) |
|
|
if errStr != "" { |
|
|
if errStr != "" { |
|
|
trainJobErrorNewDataPrepare(ctx, form) |
|
|
trainJobErrorNewDataPrepare(ctx, form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobNew, &form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobNew, &form) |
|
|
@@ -1364,6 +1371,48 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) |
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job") |
|
|
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func checkMultiNode(userId int64, serverNum int) string{ |
|
|
|
|
|
if serverNum==1{ |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
modelarts.InitMultiNode() |
|
|
|
|
|
var isServerNumValid=false |
|
|
|
|
|
if modelarts.MultiNodeConfig != nil { |
|
|
|
|
|
for _, info := range modelarts.MultiNodeConfig.Info { |
|
|
|
|
|
if isInOrg, _ := models.IsOrganizationMemberByOrgName(info.Org, userId); isInOrg { |
|
|
|
|
|
if isInNodes(info.Node,serverNum){ |
|
|
|
|
|
isServerNumValid=true |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if isServerNumValid{ |
|
|
|
|
|
return "" |
|
|
|
|
|
}else{ |
|
|
|
|
|
return "repo.modelarts.no_node_right" |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
func checkInferenceJobMultiNode(userId int64, serverNum int) string{ |
|
|
|
|
|
if serverNum==1{ |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return "repo.modelarts.no_node_right" |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func isInNodes(nodes []int, num int) bool { |
|
|
|
|
|
for _, node:=range nodes{ |
|
|
|
|
|
if node==num{ |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func getUserCommand(engineId int, req *modelarts.GenerateTrainJobReq) (string, string) { |
|
|
func getUserCommand(engineId int, req *modelarts.GenerateTrainJobReq) (string, string) { |
|
|
userImageUrl := "" |
|
|
userImageUrl := "" |
|
|
userCommand := "" |
|
|
userCommand := "" |
|
|
@@ -1398,6 +1447,13 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ |
|
|
ctx.Data["PageIsTrainJob"] = true |
|
|
ctx.Data["PageIsTrainJob"] = true |
|
|
var jobID = ctx.Params(":jobid") |
|
|
var jobID = ctx.Params(":jobid") |
|
|
|
|
|
|
|
|
|
|
|
errStr:=checkMultiNode(ctx.User.ID,form.WorkServerNumber) |
|
|
|
|
|
if errStr!=""{ |
|
|
|
|
|
versionErrorDataPrepare(ctx, form) |
|
|
|
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobVersionNew, &form) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) |
|
|
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
@@ -1465,7 +1521,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
errStr := checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) |
|
|
|
|
|
|
|
|
errStr = checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeTrain)) |
|
|
if errStr != "" { |
|
|
if errStr != "" { |
|
|
versionErrorDataPrepare(ctx, form) |
|
|
versionErrorDataPrepare(ctx, form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobVersionNew, &form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsTrainJobVersionNew, &form) |
|
|
@@ -2036,6 +2092,13 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference |
|
|
ckptUrl := "/" + form.TrainUrl + form.CkptName |
|
|
ckptUrl := "/" + form.TrainUrl + form.CkptName |
|
|
log.Info("ckpt url:" + ckptUrl) |
|
|
log.Info("ckpt url:" + ckptUrl) |
|
|
|
|
|
|
|
|
|
|
|
errStr:=checkInferenceJobMultiNode(ctx.User.ID,form.WorkServerNumber) |
|
|
|
|
|
if errStr!=""{ |
|
|
|
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
|
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsInferenceJobNew, &form) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID) |
|
|
count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
log.Error("GetCloudbrainInferenceJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
log.Error("GetCloudbrainInferenceJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
@@ -2084,7 +2147,7 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
errStr := checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeInference)) |
|
|
|
|
|
|
|
|
errStr = checkModelArtsSpecialPool(ctx, flavorCode, string(models.JobTypeInference)) |
|
|
if errStr != "" { |
|
|
if errStr != "" { |
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsInferenceJobNew, &form) |
|
|
ctx.RenderWithErr(ctx.Tr(errStr), tplModelArtsInferenceJobNew, &form) |
|
|
|