Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/967tags/v1.21.12.1
| @@ -479,12 +479,12 @@ func trainJobNewVersionDataPrepare(ctx *context.Context) error { | |||||
| ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
| var jobID = ctx.Params(":jobid") | var jobID = ctx.Params(":jobid") | ||||
| var versionName = ctx.Query("version_name") | var versionName = ctx.Query("version_name") | ||||
| // canNewJob, err := canUserCreateTrainJobVersion(ctx, jobID, versionName) | // canNewJob, err := canUserCreateTrainJobVersion(ctx, jobID, versionName) | ||||
| // if err != nil { | // if err != nil { | ||||
| // ctx.ServerError("canNewJob can info failed", err) | // ctx.ServerError("canNewJob can info failed", err) | ||||
| // return err | // return err | ||||
| // } | // } | ||||
| // ctx.Data["canNewJob"] = canNewJob | |||||
| task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) | task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName) | ||||
| if err != nil { | if err != nil { | ||||
| @@ -643,6 +643,7 @@ func VersionErrorDataPrepare(ctx *context.Context, form auth.CreateModelArtsTrai | |||||
| ctx.Data["engine_name"] = form.EngineName | ctx.Data["engine_name"] = form.EngineName | ||||
| ctx.Data["flavor_code"] = task.FlavorCode | ctx.Data["flavor_code"] = task.FlavorCode | ||||
| ctx.Data["engine_id"] = task.EngineID | ctx.Data["engine_id"] = task.EngineID | ||||
| ctx.Data["version_name"] = form.VersionName | |||||
| ctx.Data["bootFile"] = form.BootFile | ctx.Data["bootFile"] = form.BootFile | ||||
| ctx.Data["uuid"] = form.Attachment | ctx.Data["uuid"] = form.Attachment | ||||
| @@ -881,6 +882,13 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ | |||||
| EngineName := form.EngineName | EngineName := form.EngineName | ||||
| isLatestVersion := modelarts.IsLatestVersion | isLatestVersion := modelarts.IsLatestVersion | ||||
| //判断权限 | |||||
| canNewJob, _ := canUserCreateTrainJobVersion(ctx, latestTask.UserID) | |||||
| if !canNewJob { | |||||
| ctx.RenderWithErr("user cann't new trainjob", tplModelArtsTrainJobVersionNew, &form) | |||||
| return | |||||
| } | |||||
| if err := paramCheckCreateTrainJob(form); err != nil { | if err := paramCheckCreateTrainJob(form); err != nil { | ||||
| log.Error("paramCheckCreateTrainJob failed:(%v)", err) | log.Error("paramCheckCreateTrainJob failed:(%v)", err) | ||||
| VersionErrorDataPrepare(ctx, form) | VersionErrorDataPrepare(ctx, form) | ||||
| @@ -927,6 +935,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ | |||||
| } | } | ||||
| parentDir := VersionOutputPath + "/" | parentDir := VersionOutputPath + "/" | ||||
| // parentDir := "" | |||||
| // if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | // if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | ||||
| if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { | if err := uploadCodeToObs(codeLocalPath, jobName, parentDir); err != nil { | ||||
| log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | ||||
| @@ -1183,7 +1192,7 @@ func TrainJobShow(ctx *context.Context) { | |||||
| if len(parameters.Parameter) > 0 { | if len(parameters.Parameter) > 0 { | ||||
| paramTemp := "" | paramTemp := "" | ||||
| for _, Parameter := range parameters.Parameter { | for _, Parameter := range parameters.Parameter { | ||||
| param := Parameter.Label + " = " + Parameter.Value + ", " | |||||
| param := Parameter.Label + " = " + Parameter.Value + "; " | |||||
| paramTemp = paramTemp + param | paramTemp = paramTemp + param | ||||
| } | } | ||||
| VersionListTasks[i].Parameters = paramTemp[:len(paramTemp)-2] | VersionListTasks[i].Parameters = paramTemp[:len(paramTemp)-2] | ||||
| @@ -1328,7 +1337,6 @@ func canUserCreateTrainJobVersion(ctx *context.Context, userID int64) (bool, err | |||||
| return true, nil | return true, nil | ||||
| } else { | } else { | ||||
| log.Error("Only user itself and admin can new trainjob!") | log.Error("Only user itself and admin can new trainjob!") | ||||
| // ctx.ServerError("Only user itself and admin can new trainjob!", nil) | |||||
| return false, nil | return false, nil | ||||
| } | } | ||||
| } | } | ||||
| @@ -54,7 +54,7 @@ | |||||
| </div> | </div> | ||||
| <div class="inline field {{if .Err_Description}}error{{end}}"> | <div class="inline field {{if .Err_Description}}error{{end}}"> | ||||
| <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | ||||
| <textarea id="description" name="description">{{.description}}</textarea> | |||||
| <textarea id="description" name="description" maxlength="255">{{.description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="inline field"> | <div class="inline field"> | ||||
| <label>{{.i18n.Tr "repo.template"}}</label> | <label>{{.i18n.Tr "repo.template"}}</label> | ||||
| @@ -122,7 +122,7 @@ | |||||
| </div> | </div> | ||||
| <div class="inline field {{if .Err_Description}}error{{end}}"> | <div class="inline field {{if .Err_Description}}error{{end}}"> | ||||
| <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | ||||
| <textarea id="description" name="description">{{.description}}</textarea> | |||||
| <textarea id="description" name="description" maxlength="255">{{.description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="inline field"> | <div class="inline field"> | ||||
| @@ -549,7 +549,6 @@ td, th { | |||||
| function refreshStatus(version_name){ | function refreshStatus(version_name){ | ||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`,(data)=>{ | $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}?version_name=${version_name}`,(data)=>{ | ||||
| console.log(data) | |||||
| // header status and duration | // header status and duration | ||||
| $(`#${version_name}-duration-span`).text(data.JobDuration) | $(`#${version_name}-duration-span`).text(data.JobDuration) | ||||
| $(`#${version_name}-status-span span`).text(data.JobStatus) | $(`#${version_name}-status-span span`).text(data.JobStatus) | ||||
| @@ -714,8 +713,7 @@ td, th { | |||||
| let scrollTop = container.scrollTop | let scrollTop = container.scrollTop | ||||
| let scrollHeight = container.scrollHeight | let scrollHeight = container.scrollHeight | ||||
| let clientHeight = container.clientHeight | let clientHeight = container.clientHeight | ||||
| if(parseInt(scrollTop) + clientHeight == scrollHeight && scrollHeight>clientHeight){ | |||||
| if(parseInt(scrollTop) + clientHeight == scrollHeight || parseInt(scrollTop) + clientHeight +1 == scrollHeight || parseInt(scrollTop) + clientHeight - 1 == scrollHeight){ | |||||
| let end_line = $(`#log${version_name} input[name=end_line]`).val() | let end_line = $(`#log${version_name} input[name=end_line]`).val() | ||||
| $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { | $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/log?version_name=${version_name}&base_line=${end_line}&lines=50&order=desc`, (data) => { | ||||
| if (data.Lines == 0){ | if (data.Lines == 0){ | ||||
| @@ -156,7 +156,11 @@ | |||||
| <form class="ui form" action="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version" method="post"> | <form class="ui form" action="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/create_version" method="post"> | ||||
| {{.CsrfTokenHtml}} | {{.CsrfTokenHtml}} | ||||
| <input type="hidden" name="action" value="update"> | <input type="hidden" name="action" value="update"> | ||||
| {{if .version_name}} | |||||
| <input type="hidden" name="version_name" value="{{.version_name}}"> | |||||
| {{else}} | |||||
| <input type="hidden" name="version_name" value=""> | <input type="hidden" name="version_name" value=""> | ||||
| {{end}} | |||||
| <input type="hidden" id="ai_engine_name" name="engine_names" value=""> | <input type="hidden" id="ai_engine_name" name="engine_names" value=""> | ||||
| <input type="hidden" id="ai_flaver_name" name="flaver_names" value=""> | <input type="hidden" id="ai_flaver_name" name="flaver_names" value=""> | ||||
| <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> | <h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> | ||||
| @@ -167,8 +171,11 @@ | |||||
| </div> | </div> | ||||
| <div class="required unite min_title inline field"> | <div class="required unite min_title inline field"> | ||||
| <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.parents_version"}}</label> | <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.parents_version"}}</label> | ||||
| {{if .version_name}} | |||||
| <input style="width: 60%;" value="{{.version_name}}" tabindex="3" disabled > | |||||
| {{else}} | |||||
| <input id="parents_version" style="width: 60%;" value="" tabindex="3" disabled > | <input id="parents_version" style="width: 60%;" value="" tabindex="3" disabled > | ||||
| {{end}} | |||||
| </div> | </div> | ||||
| <div class="unite min_title inline field"> | <div class="unite min_title inline field"> | ||||
| @@ -521,8 +528,8 @@ | |||||
| identifier : 'run_para_list', | identifier : 'run_para_list', | ||||
| rules: [ | rules: [ | ||||
| { | { | ||||
| type: 'maxLength[256]', | |||||
| prompt : '所有字符最长不超过256个字符。' | |||||
| type: 'maxLength[255]', | |||||
| prompt : '所有字符最长不超过255个字符。' | |||||
| } | } | ||||
| ] | ] | ||||
| }, | }, | ||||
| @@ -578,8 +585,8 @@ | |||||
| identifier : 'run_para_list', | identifier : 'run_para_list', | ||||
| rules: [ | rules: [ | ||||
| { | { | ||||
| type: 'maxLength[256]', | |||||
| prompt : '所有字符最长不超过256个字符。' | |||||
| type: 'maxLength[255]', | |||||
| prompt : '所有字符最长不超过255个字符。' | |||||
| } | } | ||||
| ] | ] | ||||
| }, | }, | ||||
| @@ -614,7 +621,6 @@ | |||||
| function get_name(){ | function get_name(){ | ||||
| let name1=$("#engine_name .text").text() | let name1=$("#engine_name .text").text() | ||||
| let name2=$("#flaver_name .text").text() | let name2=$("#flaver_name .text").text() | ||||
| console.log(name1,name2) | |||||
| $("input#ai_engine_name").val(name1) | $("input#ai_engine_name").val(name1) | ||||
| $("input#ai_flaver_name").val(name2) | $("input#ai_flaver_name").val(name2) | ||||
| @@ -53,7 +53,7 @@ | |||||
| </div> | </div> | ||||
| <div class="inline field {{if .Err_Description}}error{{end}}"> | <div class="inline field {{if .Err_Description}}error{{end}}"> | ||||
| <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | <label for="description">{{.i18n.Tr "repo.repo_desc"}}</label> | ||||
| <textarea id="description" name="description">{{.description}}</textarea> | |||||
| <textarea id="description" name="description" maxlength="255">{{.description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="inline field"> | <div class="inline field"> | ||||
| @@ -41,7 +41,7 @@ | |||||
| {{end}} | {{end}} | ||||
| <div class="field {{if .Err_Description}}error{{end}}"> | <div class="field {{if .Err_Description}}error{{end}}"> | ||||
| <label for="description">{{$.i18n.Tr "repo.repo_desc"}}</label> | <label for="description">{{$.i18n.Tr "repo.repo_desc"}}</label> | ||||
| <textarea id="description" name="description" rows="2">{{.Repository.Description}}</textarea> | |||||
| <textarea id="description" name="description" rows="2" maxlength="255">{{.Repository.Description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="field {{if .Err_Website}}error{{end}}"> | <div class="field {{if .Err_Website}}error{{end}}"> | ||||
| <label for="website">{{.i18n.Tr "repo.settings.site"}}</label> | <label for="website">{{.i18n.Tr "repo.settings.site"}}</label> | ||||
| @@ -34,7 +34,7 @@ | |||||
| </div> | </div> | ||||
| <div class="field {{if .Err_Description}}error{{end}}"> | <div class="field {{if .Err_Description}}error{{end}}"> | ||||
| <label for="description">{{$.i18n.Tr "user.user_bio"}}</label> | <label for="description">{{$.i18n.Tr "user.user_bio"}}</label> | ||||
| <textarea id="description" name="description" rows="2">{{.SignedUser.Description}}</textarea> | |||||
| <textarea id="description" name="description" rows="2" maxlength="255">{{.SignedUser.Description}}</textarea> | |||||
| </div> | </div> | ||||
| <div class="field {{if .Err_Website}}error{{end}}"> | <div class="field {{if .Err_Website}}error{{end}}"> | ||||
| <label for="website">{{.i18n.Tr "settings.website"}}</label> | <label for="website">{{.i18n.Tr "settings.website"}}</label> | ||||