| @@ -43,7 +43,7 @@ func GetCompleteInitValue(issuesClosed int64, releases int64, developAge int64, | |||||
| return setting.RadarMap.CompletenessIssuesClosed*float64(issuesClosed) + | return setting.RadarMap.CompletenessIssuesClosed*float64(issuesClosed) + | ||||
| setting.RadarMap.CompletenessReleases*float64(releases) + | setting.RadarMap.CompletenessReleases*float64(releases) + | ||||
| setting.RadarMap.CompletenessDevelopAge*float64(developAge) + | setting.RadarMap.CompletenessDevelopAge*float64(developAge) + | ||||
| setting.RadarMap.CompletenessDataset*float64(dataset/(1024*1024)) + | |||||
| setting.RadarMap.CompletenessDataset*(float64(dataset)/(1024*1024)) + | |||||
| setting.RadarMap.CompletenessModel*float64(model) + | setting.RadarMap.CompletenessModel*float64(model) + | ||||
| setting.RadarMap.CompletenessWiki*float64(wiki) | setting.RadarMap.CompletenessWiki*float64(wiki) | ||||
| @@ -755,6 +755,15 @@ unit_disabled = The site administrator has disabled this repository section. | |||||
| language_other = Other | language_other = Other | ||||
| datasets = Datasets | datasets = Datasets | ||||
| datasets.desc = Enable Dataset | datasets.desc = Enable Dataset | ||||
| debug=Debug | |||||
| stop=Stop | |||||
| delete=Delete | |||||
| model_download=Model Download | |||||
| submit_image=Submit Image | |||||
| download=Download | |||||
| cloudbrain=cloudbrain | cloudbrain=cloudbrain | ||||
| cloudbrain.new=New cloudbrain | cloudbrain.new=New cloudbrain | ||||
| cloudbrain.desc=cloudbrain | cloudbrain.desc=cloudbrain | ||||
| @@ -777,15 +786,21 @@ cloudbrain_status_createtime = Status/Createtime | |||||
| cloudbrain_status_runtime = Running Time | cloudbrain_status_runtime = Running Time | ||||
| modelarts.notebook=Debug Job | |||||
| modelarts.train_job=Create Job | |||||
| modelarts.train_job.new=New Job | |||||
| modelarts.notebook=Debug Task | |||||
| modelarts.train_job=Create Task | |||||
| modelarts.train_job.new_debug= New Debug Task | |||||
| modelarts.train_job.new_train=New Train Task | |||||
| modelarts.train_job.config=Configuration information | |||||
| modelarts.train_job.new=New train Task | |||||
| modelarts.train_job.basic_info=Basic Info | modelarts.train_job.basic_info=Basic Info | ||||
| modelarts.train_job.job_status=Job Status | modelarts.train_job.job_status=Job Status | ||||
| modelarts.train_job.job_name=Job Name | modelarts.train_job.job_name=Job Name | ||||
| modelarts.train_job.version=Job Version | modelarts.train_job.version=Job Version | ||||
| modelarts.train_job.start_time=Start Time | modelarts.train_job.start_time=Start Time | ||||
| modelarts.train_job.dura_time=Duration Time | |||||
| modelarts.train_job.dura_time=Running Time | |||||
| modelarts.train_job.description=Description | modelarts.train_job.description=Description | ||||
| modelarts.train_job.parameter_setting=Parameter setting | modelarts.train_job.parameter_setting=Parameter setting | ||||
| modelarts.train_job.parameter_setting_info=Parameter Info | modelarts.train_job.parameter_setting_info=Parameter Info | ||||
| @@ -795,7 +810,7 @@ modelarts.train_job.fast_parameter_setting_config_link=fast_parameter_setting_co | |||||
| modelarts.train_job.frames=frames | modelarts.train_job.frames=frames | ||||
| modelarts.train_job.algorithm_origin=算法来源 | modelarts.train_job.algorithm_origin=算法来源 | ||||
| modelarts.train_job.AI_driver=AI Engine | modelarts.train_job.AI_driver=AI Engine | ||||
| modelarts.train_job.start_file=启动文件 | |||||
| modelarts.train_job.start_file=Start File | |||||
| modelarts.train_job.boot_file_helper=启动文件是您程序执行的入口文件,必须是以.py结尾的文件。 | modelarts.train_job.boot_file_helper=启动文件是您程序执行的入口文件,必须是以.py结尾的文件。 | ||||
| modelarts.train_job.dataset=Dataset | modelarts.train_job.dataset=Dataset | ||||
| modelarts.train_job.run_parameter=Run Parameter | modelarts.train_job.run_parameter=Run Parameter | ||||
| @@ -757,6 +757,14 @@ unit_disabled=站点管理员已禁用此项目单元。 | |||||
| language_other=其它 | language_other=其它 | ||||
| datasets=数据集 | datasets=数据集 | ||||
| datasets.desc=数据集功能 | datasets.desc=数据集功能 | ||||
| debug=调试 | |||||
| stop=停止 | |||||
| delete=删除 | |||||
| model_download=模型下载 | |||||
| submit_image=提交镜像 | |||||
| download=模型下载 | |||||
| cloudbrain=云脑 | cloudbrain=云脑 | ||||
| cloudbrain.new=新建任务 | cloudbrain.new=新建任务 | ||||
| cloudbrain.desc=云脑功能 | cloudbrain.desc=云脑功能 | ||||
| @@ -779,15 +787,21 @@ cloudbrain_status_createtime=状态/创建时间 | |||||
| cloudbrain_status_runtime = 运行时长 | cloudbrain_status_runtime = 运行时长 | ||||
| cloudbrain_jobname_err=只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。 | cloudbrain_jobname_err=只能以小写字母或数字开头且只包含小写字母、数字、_和-,不能以_结尾,最长36个字符。 | ||||
| modelarts.notebook=调试作业 | |||||
| modelarts.train_job=训练作业 | |||||
| modelarts.train_job.new=新建作业 | |||||
| modelarts.notebook=调试任务 | |||||
| modelarts.train_job=训练任务 | |||||
| modelarts.train_job.new_debug=新建调试任务 | |||||
| modelarts.train_job.new_train=新建训练任务 | |||||
| modelarts.train_job.config=配置信息 | |||||
| modelarts.train_job.new=新建训练任务 | |||||
| modelarts.train_job.basic_info=基本信息 | modelarts.train_job.basic_info=基本信息 | ||||
| modelarts.train_job.job_status=作业状态 | modelarts.train_job.job_status=作业状态 | ||||
| modelarts.train_job.job_name=作业名称 | modelarts.train_job.job_name=作业名称 | ||||
| modelarts.train_job.version=作业版本 | modelarts.train_job.version=作业版本 | ||||
| modelarts.train_job.start_time=开始时间 | modelarts.train_job.start_time=开始时间 | ||||
| modelarts.train_job.dura_time=持续时间 | |||||
| modelarts.train_job.dura_time=运行时长 | |||||
| modelarts.train_job.description=作业描述 | modelarts.train_job.description=作业描述 | ||||
| modelarts.train_job.parameter_setting=参数设置 | modelarts.train_job.parameter_setting=参数设置 | ||||
| modelarts.train_job.parameter_setting_info=参数信息 | modelarts.train_job.parameter_setting_info=参数信息 | ||||
| @@ -74,6 +74,7 @@ func GetModelArtsTrainJob(ctx *context.APIContext) { | |||||
| ctx.JSON(http.StatusOK, map[string]interface{}{ | ctx.JSON(http.StatusOK, map[string]interface{}{ | ||||
| "JobID": jobID, | "JobID": jobID, | ||||
| "JobStatus": job.Status, | "JobStatus": job.Status, | ||||
| "JobDuration": job.Duration, | |||||
| }) | }) | ||||
| } | } | ||||
| @@ -357,14 +357,14 @@ func NotebookShow(ctx *context.Context) { | |||||
| task, err := models.GetCloudbrainByJobID(jobID) | task, err := models.GetCloudbrainByJobID(jobID) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| result, err := modelarts.GetJob(jobID) | result, err := modelarts.GetJob(jobID) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| @@ -373,7 +373,7 @@ func NotebookShow(ctx *context.Context) { | |||||
| err = models.UpdateJob(task) | err = models.UpdateJob(task) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.Data["error"] = err.Error() | ctx.Data["error"] = err.Error() | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsNotebookShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| @@ -528,6 +528,15 @@ func TrainJobIndex(ctx *context.Context) { | |||||
| } | } | ||||
| func TrainJobNew(ctx *context.Context) { | func TrainJobNew(ctx *context.Context) { | ||||
| err := trainJobNewDataPrepare(ctx) | |||||
| if err != nil { | |||||
| ctx.ServerError("get new train-job info failed", err) | |||||
| return | |||||
| } | |||||
| ctx.HTML(200, tplModelArtsTrainJobNew) | |||||
| } | |||||
| func trainJobNewDataPrepare(ctx *context.Context) error { | |||||
| ctx.Data["PageIsCloudBrain"] = true | ctx.Data["PageIsCloudBrain"] = true | ||||
| //can, err := canUserCreateTrainJob(ctx.User.ID) | //can, err := canUserCreateTrainJob(ctx.User.ID) | ||||
| @@ -549,35 +558,35 @@ func TrainJobNew(ctx *context.Context) { | |||||
| attachs, err := models.GetModelArtsUserAttachments(ctx.User.ID) | attachs, err := models.GetModelArtsUserAttachments(ctx.User.ID) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("GetAllUserAttachments failed:", err) | ctx.ServerError("GetAllUserAttachments failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["attachments"] = attachs | ctx.Data["attachments"] = attachs | ||||
| var resourcePools modelarts.ResourcePool | var resourcePools modelarts.ResourcePool | ||||
| if err = json.Unmarshal([]byte(setting.ResourcePools), &resourcePools); err != nil { | if err = json.Unmarshal([]byte(setting.ResourcePools), &resourcePools); err != nil { | ||||
| ctx.ServerError("json.Unmarshal failed:", err) | ctx.ServerError("json.Unmarshal failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["resource_pools"] = resourcePools.Info | ctx.Data["resource_pools"] = resourcePools.Info | ||||
| var engines modelarts.Engine | var engines modelarts.Engine | ||||
| if err = json.Unmarshal([]byte(setting.Engines), &engines); err != nil { | if err = json.Unmarshal([]byte(setting.Engines), &engines); err != nil { | ||||
| ctx.ServerError("json.Unmarshal failed:", err) | ctx.ServerError("json.Unmarshal failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["engines"] = engines.Info | ctx.Data["engines"] = engines.Info | ||||
| var versionInfos modelarts.VersionInfo | var versionInfos modelarts.VersionInfo | ||||
| if err = json.Unmarshal([]byte(setting.EngineVersions), &versionInfos); err != nil { | if err = json.Unmarshal([]byte(setting.EngineVersions), &versionInfos); err != nil { | ||||
| ctx.ServerError("json.Unmarshal failed:", err) | ctx.ServerError("json.Unmarshal failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["engine_versions"] = versionInfos.Version | ctx.Data["engine_versions"] = versionInfos.Version | ||||
| var flavorInfos modelarts.Flavor | var flavorInfos modelarts.Flavor | ||||
| if err = json.Unmarshal([]byte(setting.TrainJobFLAVORINFOS), &flavorInfos); err != nil { | if err = json.Unmarshal([]byte(setting.TrainJobFLAVORINFOS), &flavorInfos); err != nil { | ||||
| ctx.ServerError("json.Unmarshal failed:", err) | ctx.ServerError("json.Unmarshal failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["flavor_infos"] = flavorInfos.Info | ctx.Data["flavor_infos"] = flavorInfos.Info | ||||
| @@ -587,12 +596,12 @@ func TrainJobNew(ctx *context.Context) { | |||||
| configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) | configList, err := getConfigList(modelarts.PerPage, 1, modelarts.SortByCreateTime, "desc", "", modelarts.ConfigTypeCustom) | ||||
| if err != nil { | if err != nil { | ||||
| ctx.ServerError("getConfigList failed:", err) | ctx.ServerError("getConfigList failed:", err) | ||||
| return | |||||
| return err | |||||
| } | } | ||||
| ctx.Data["config_list"] = configList.ParaConfigs | ctx.Data["config_list"] = configList.ParaConfigs | ||||
| ctx.HTML(200, tplModelArtsTrainJobNew) | |||||
| return nil | |||||
| } | } | ||||
| func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) { | func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) { | ||||
| @@ -614,27 +623,29 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath | logObsPath := "/" + setting.Bucket + modelarts.JobPath + jobName + modelarts.LogPath | ||||
| dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" | dataPath := "/" + setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" | ||||
| can, err := canUserCreateTrainJob(ctx.User.ID) | |||||
| if err != nil { | |||||
| ctx.ServerError("canUserCreateTrainJob", err) | |||||
| return | |||||
| } | |||||
| if !can { | |||||
| log.Error("the user can not create train-job") | |||||
| ctx.RenderWithErr("the user can not create train-job", tplModelArtsTrainJobNew, &form) | |||||
| return | |||||
| } | |||||
| //can, err := canUserCreateTrainJob(ctx.User.ID) | |||||
| //if err != nil { | |||||
| // ctx.ServerError("canUserCreateTrainJob", err) | |||||
| // return | |||||
| //} | |||||
| // | |||||
| //if !can { | |||||
| // log.Error("the user can not create train-job") | |||||
| // ctx.RenderWithErr("the user can not create train-job", tplModelArtsTrainJobNew, &form) | |||||
| // return | |||||
| //} | |||||
| //param check | //param check | ||||
| if err := paramCheckCreateTrainJob(form); err != nil { | if err := paramCheckCreateTrainJob(form); err != nil { | ||||
| log.Error("paramCheckCreateTrainJob failed:(%v)", err) | log.Error("paramCheckCreateTrainJob failed:(%v)", err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { | if err := git.Clone(repo.RepoPath(), codeLocalPath, git.CloneRepoOptions{}); err != nil { | ||||
| log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err) | log.Error("Failed to clone repository: %s (%v)", repo.FullName(), err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("Failed to clone repository", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -642,18 +653,21 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| //todo: upload code (send to file_server todo this work?) | //todo: upload code (send to file_server todo this work?) | ||||
| if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.OutputPath); err != nil { | if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.OutputPath); err != nil { | ||||
| log.Error("Failed to obsMkdir_output: %s (%v)", repo.FullName(), err) | log.Error("Failed to obsMkdir_output: %s (%v)", repo.FullName(), err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("Failed to obsMkdir_output", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("Failed to obsMkdir_output", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.LogPath); err != nil { | if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.LogPath); err != nil { | ||||
| log.Error("Failed to obsMkdir_log: %s (%v)", repo.FullName(), err) | log.Error("Failed to obsMkdir_log: %s (%v)", repo.FullName(), err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("Failed to obsMkdir_log", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("Failed to obsMkdir_log", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil { | ||||
| log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("Failed to uploadCodeToObs", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("Failed to uploadCodeToObs", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -673,6 +687,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| err := json.Unmarshal([]byte(params), ¶meters) | err := json.Unmarshal([]byte(params), ¶meters) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("Failed to Unmarshal params: %s (%v)", params, err) | log.Error("Failed to Unmarshal params: %s (%v)", params, err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("运行参数错误", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("运行参数错误", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -691,6 +706,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| if isSaveParam == "on" { | if isSaveParam == "on" { | ||||
| if form.ParameterTemplateName == "" { | if form.ParameterTemplateName == "" { | ||||
| log.Error("ParameterTemplateName is empty") | log.Error("ParameterTemplateName is empty") | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("保存作业参数时,作业参数名称不能为空", tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("保存作业参数时,作业参数名称不能为空", tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -714,6 +730,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("Failed to CreateTrainJobConfig: %v", err) | log.Error("Failed to CreateTrainJobConfig: %v", err) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr("保存作业参数失败:"+err.Error(), tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr("保存作业参数失败:"+err.Error(), tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -735,9 +752,10 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||||
| Parameters: param, | Parameters: param, | ||||
| } | } | ||||
| err = modelarts.GenerateTrainJob(ctx, req) | |||||
| err := modelarts.GenerateTrainJob(ctx, req) | |||||
| if err != nil { | if err != nil { | ||||
| log.Error("GenerateTrainJob failed:%v", err.Error()) | log.Error("GenerateTrainJob failed:%v", err.Error()) | ||||
| trainJobNewDataPrepare(ctx) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) | ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobNew, &form) | ||||
| return | return | ||||
| } | } | ||||
| @@ -838,21 +856,21 @@ func TrainJobShow(ctx *context.Context) { | |||||
| task, err := models.GetCloudbrainByJobID(jobID) | task, err := models.GetCloudbrainByJobID(jobID) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetCloudbrainByJobID(%s) failed:%v", jobID, err.Error()) | log.Error("GetCloudbrainByJobID(%s) failed:%v", jobID, err.Error()) | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| attach, err := models.GetAttachmentByUUID(task.Uuid) | attach, err := models.GetAttachmentByUUID(task.Uuid) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetAttachmentByUUID(%s) failed:%v", jobID, err.Error()) | log.Error("GetAttachmentByUUID(%s) failed:%v", jobID, err.Error()) | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| result, err := modelarts.GetTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) | result, err := modelarts.GetTrainJob(jobID, strconv.FormatInt(task.VersionID, 10)) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("GetJob(%s) failed:%v", jobID, err.Error()) | log.Error("GetJob(%s) failed:%v", jobID, err.Error()) | ||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobIndex, nil) | |||||
| ctx.RenderWithErr(err.Error(), tplModelArtsTrainJobShow, nil) | |||||
| return | return | ||||
| } | } | ||||
| @@ -239,7 +239,7 @@ | |||||
| <div class="column"> | <div class="column"> | ||||
| <div class="ui blue small menu compact selectcloudbrain"> | <div class="ui blue small menu compact selectcloudbrain"> | ||||
| <a class="active item">调试任务</a> | |||||
| <a class="active item">{{$.i18n.Tr "repo.modelarts.notebook"}}</a> | |||||
| <!-- <a class="item" href="{{.RepoLink}}/modelarts">训练任务</a> --> | <!-- <a class="item" href="{{.RepoLink}}/modelarts">训练任务</a> --> | ||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -255,7 +255,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <a class="ui green button" href="{{.RepoLink}}/cloudbrain/create">新建调试任务</a> | |||||
| <a class="ui green button" href="{{.RepoLink}}/cloudbrain/create">{{$.i18n.Tr "repo.modelarts.train_job.new_debug"}}</a> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -323,7 +323,7 @@ | |||||
| {{else}} | {{else}} | ||||
| {{.Status}} | {{.Status}} | ||||
| {{end}} --> | {{end}} --> | ||||
| <span><i style="vertical-align: middle;" class="{{.Status}}"></i><span style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| <span><i id="{{.JobID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.JobID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| </span> | </span> | ||||
| <!-- <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" > | <!-- <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}" > | ||||
| {{if eq .Status "STOPPED"}} | {{if eq .Status "STOPPED"}} | ||||
| @@ -357,34 +357,34 @@ | |||||
| {{end}} | {{end}} | ||||
| <!-- 调试 --> | <!-- 调试 --> | ||||
| <a class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | |||||
| 调试 | |||||
| <a id="model-debug-{{.JobID}}" class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | |||||
| {{$.i18n.Tr "repo.debug"}} | |||||
| </a> | </a> | ||||
| <form id="stopForm-{{.JobID}}" action="{{if or (eq .Status "STOPPED") (eq .Status "FAILED")}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/stop{{end}}" method="post" style="margin-left:-1px;"> | |||||
| <form id="stopForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/stop" method="post" style="margin-left:-1px;"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui basic {{if or (eq .Status "STOPPED") (eq .Status "FAILED")}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| 停止 | |||||
| <a id="stop-model-debug-{{.JobID}}" class="ui basic {{if or (eq .Status "STOPPED") (eq .Status "FAILED")}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| {{$.i18n.Tr "repo.stop"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| <div class="ui compact buttons" style="margin-right:10px;"> | <div class="ui compact buttons" style="margin-right:10px;"> | ||||
| <!-- 模型下载 --> | <!-- 模型下载 --> | ||||
| <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | ||||
| 模型下载 | |||||
| {{$.i18n.Tr "repo.download"}} | |||||
| </a> | </a> | ||||
| <!-- 接收结果 --> | <!-- 接收结果 --> | ||||
| <iframe src="" frameborder="0" name="iframeContent" style="display: none;"></iframe> | <iframe src="" frameborder="0" name="iframeContent" style="display: none;"></iframe> | ||||
| <a class="imageBtn ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" value="{{.CanDebug}}">提交镜像</a> | |||||
| <a id="model-image-{{.JobID}}" class="imageBtn ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" value="{{.CanDebug}}">{{$.i18n.Tr "repo.submit_image"}}</a> | |||||
| </div> | </div> | ||||
| <!-- 删除任务 --> | <!-- 删除任务 --> | ||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if not .CanDel}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post"> | |||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/del" method="post"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui compact {{if not .CanDel}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| 删除 | |||||
| <a id="model-delete-{{.JobID}}" class="ui compact {{if not .CanDel}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| {{$.i18n.Tr "repo.delete"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| @@ -512,23 +512,52 @@ | |||||
| $(document).ready(loadJobStatus); | $(document).ready(loadJobStatus); | ||||
| function loadJobStatus() { | function loadJobStatus() { | ||||
| $(".job-status").each((index, job) => { | $(".job-status").each((index, job) => { | ||||
| console.log("---------",index,job) | |||||
| const jobID = job.dataset.jobid; | const jobID = job.dataset.jobid; | ||||
| const repoPath = job.dataset.repopath; | const repoPath = job.dataset.repopath; | ||||
| if (job.textContent.trim() == 'STOPPED' || job.textContent.trim() == 'FAILED') { | if (job.textContent.trim() == 'STOPPED' || job.textContent.trim() == 'FAILED') { | ||||
| return | return | ||||
| } | } | ||||
| $.get(`/api/v1/repos/${repoPath}/cloudbrain/${jobID}`, (data) => { | $.get(`/api/v1/repos/${repoPath}/cloudbrain/${jobID}`, (data) => { | ||||
| const jobID = data.JobID | const jobID = data.JobID | ||||
| const status = data.JobStatus | const status = data.JobStatus | ||||
| if (status != job.textContent.trim()) { | if (status != job.textContent.trim()) { | ||||
| //$('#' + jobID).text(status) | |||||
| console.log("---------") | |||||
| $('#' + jobID+'-icon').removeClass().addClass(status) | |||||
| $('#' + jobID+ '-text').text(status) | |||||
| //if (status == 'STOPPED') { | //if (status == 'STOPPED') { | ||||
| window.location.reload() | |||||
| // window.location.reload() | |||||
| //} | //} | ||||
| } | } | ||||
| if(status==="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('disabled') | |||||
| $('#model-debug-'+jobID).addClass('blue') | |||||
| $('#model-image-'+jobID).removeClass('disabled') | |||||
| $('#model-image-'+jobID).addClass('blue') | |||||
| } | |||||
| if(status!=="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('blue') | |||||
| $('#model-debug-'+jobID).addClass('disabled') | |||||
| $('#model-image-'+jobID).removeClass('blue') | |||||
| $('#model-image-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status!=="STOPPED" || status!=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('disabled') | |||||
| $('#stop-model-debug-'+jobID).addClass('blue') | |||||
| $('#model-delete-'+jobID).removeClass('red') | |||||
| $('#model-delete-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status=="STOPPED" || status=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('blue') | |||||
| $('#stop-model-debug-'+jobID).addClass('disabled') | |||||
| $('#model-delete-'+jobID).removeClass('disabled') | |||||
| $('#model-delete-'+jobID).addClass('red') | |||||
| } | |||||
| }).fail(function(err) { | }).fail(function(err) { | ||||
| console.log(err); | console.log(err); | ||||
| }); | }); | ||||
| @@ -200,6 +200,7 @@ | |||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <!-- 列表容器 --> | <!-- 列表容器 --> | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| {{template "base/alert" .}} | |||||
| <!-- 中间云脑和新建任务按钮 --> | <!-- 中间云脑和新建任务按钮 --> | ||||
| @@ -208,8 +209,8 @@ | |||||
| <div class="column"> | <div class="column"> | ||||
| <div class="ui blue small menu compact selectcloudbrain"> | <div class="ui blue small menu compact selectcloudbrain"> | ||||
| <a class="active item" href="{{.RepoLink}}/modelarts/notebook">调试任务</a> | |||||
| <a class="item" href="{{.RepoLink}}/modelarts/train-job">训练任务</a> | |||||
| <a class="active item" href="{{.RepoLink}}/modelarts/notebook">{{$.i18n.Tr "repo.modelarts.notebook"}}</a> | |||||
| <a class="item" href="{{.RepoLink}}/modelarts/train-job">{{$.i18n.Tr "repo.modelarts.train_job"}}</a> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="column right aligned"> | <div class="column right aligned"> | ||||
| @@ -224,7 +225,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/notebook/create">新建调试任务</a> | |||||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/notebook/create">{{$.i18n.Tr "repo.modelarts.train_job.new_debug"}}</a> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -254,17 +255,17 @@ | |||||
| <!-- 表头 --> | <!-- 表头 --> | ||||
| <div class="ui grid stackable" style="background: #f0f0f0;;"> | <div class="ui grid stackable" style="background: #f0f0f0;;"> | ||||
| <div class="row"> | <div class="row"> | ||||
| <div class="five wide column"> | |||||
| <div class="six wide column"> | |||||
| <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | ||||
| </div> | </div> | ||||
| <div class="three wide column"> | <div class="three wide column"> | ||||
| <span>{{$.i18n.Tr "repo.cloudbrain_status_createtime"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_status_createtime"}}</span> | ||||
| </div> | </div> | ||||
| <div class="one wide column"> | |||||
| <div class="two wide column text center"> | |||||
| <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | ||||
| </div> | </div> | ||||
| <div class="seven wide column text center"> | |||||
| <span style="margin-left: 10rem;">{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||||
| <div class="five wide column text center"> | |||||
| <span style="margin-left: 5rem;">{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -278,7 +279,7 @@ | |||||
| <div class="row"> | <div class="row"> | ||||
| <!-- 任务名 --> | <!-- 任务名 --> | ||||
| <div class="five wide column"> | |||||
| <div class="six wide column"> | |||||
| <a class="title" href="{{$.Link}}/{{.JobID}}" title="{{.JobName}}" style="font-size: 15px;"> | <a class="title" href="{{$.Link}}/{{.JobID}}" title="{{.JobName}}" style="font-size: 15px;"> | ||||
| <span class="fitted" style="vertical-align: middle;">{{svg "octicon-tasklist" 16}}</span> | <span class="fitted" style="vertical-align: middle;">{{svg "octicon-tasklist" 16}}</span> | ||||
| <span class="fitted" style="width: 90%;vertical-align: middle;margin-left: 0.4rem;">{{.JobName}}</span> | <span class="fitted" style="width: 90%;vertical-align: middle;margin-left: 0.4rem;">{{.JobName}}</span> | ||||
| @@ -291,13 +292,13 @@ | |||||
| {{.Status}} | {{.Status}} | ||||
| </span> --> | </span> --> | ||||
| <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | ||||
| <span><i style="vertical-align: middle;" class="{{.Status}}"></i><span style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| <span><i id="{{.JobID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.JobID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| </span> | </span> | ||||
| <!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
| <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | ||||
| </div> | </div> | ||||
| <div class="one wide column"> | |||||
| <div class="two wide column text center"> | |||||
| {{if .User.Name}} | {{if .User.Name}} | ||||
| <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | ||||
| {{else}} | {{else}} | ||||
| @@ -305,39 +306,39 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| <div class="seven wide column text right"> | |||||
| <div class="five wide column text right"> | |||||
| <div class="ui compact buttons"> | <div class="ui compact buttons"> | ||||
| <!-- <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}"> | <!-- <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}"> | ||||
| 查看 | 查看 | ||||
| </a> --> | </a> --> | ||||
| <a class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | |||||
| 调试 | |||||
| <a id="model-debug-{{.JobID}}" style="margin-right: 2rem;" class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | |||||
| {{$.i18n.Tr "repo.debug"}} | |||||
| </a> | </a> | ||||
| <form id="stopForm-{{.JobID}}" action="{{if ne .Status "RUNNING"}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/stop{{end}}" method="post" style="margin-left:-1px;"> | |||||
| <form id="stopForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/stop" method="post" style="margin-left:-1px;"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui basic {{if ne .Status "RUNNING"}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| 停止 | |||||
| <a id="stop-model-debug-{{.JobID}}" style="margin-right: 2rem;" class="ui basic {{if or (eq .Status "STOPPED") (eq .Status "FAILED")}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| {{$.i18n.Tr "repo.stop"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| <div class="ui compact buttons" style="margin-right:10px;"> | |||||
| <!-- <div class="ui compact buttons" style="margin-right:10px;"> --> | |||||
| <!-- 模型下载 --> | <!-- 模型下载 --> | ||||
| <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | |||||
| <!-- <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | |||||
| 模型下载 | 模型下载 | ||||
| </a> | |||||
| </a> --> | |||||
| <!-- 接收结果 --> | <!-- 接收结果 --> | ||||
| <iframe src="" frameborder="0" name="iframeContent" style="display: none;"></iframe> | |||||
| <a class="imageBtn ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" value="{{.CanDebug}}">提交镜像</a> | |||||
| <!-- <iframe src="" frameborder="0" name="iframeContent" style="display: none;"></iframe> | |||||
| <a class="imageBtn ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" value="{{.CanDebug}}">提交镜像</a> --> | |||||
| </div> | |||||
| <!-- </div> --> | |||||
| <!-- 删除任务 --> | <!-- 删除任务 --> | ||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if eq .Status "RUNNING"}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post"> | |||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/del" method="post"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui compact {{if eq .Status "RUNNING"}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| 删除 | |||||
| <a id="model-delete-{{.JobID}}" class="ui compact {{if eq .Status "RUNNING"}}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| {{$.i18n.Tr "repo.delete"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -436,11 +437,37 @@ | |||||
| const jobID = data.JobID | const jobID = data.JobID | ||||
| const status = data.JobStatus | const status = data.JobStatus | ||||
| if (status != job.textContent.trim()) { | if (status != job.textContent.trim()) { | ||||
| //$('#' + jobID).text(status) | |||||
| $('#' + jobID+'-icon').removeClass().addClass(status) | |||||
| $('#' + jobID+ '-text').text(status) | |||||
| //if (status == 'STOPPED') { | //if (status == 'STOPPED') { | ||||
| window.location.reload() | |||||
| // window.location.reload() | |||||
| //} | //} | ||||
| } | } | ||||
| if(status==="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('disabled') | |||||
| $('#model-debug-'+jobID).addClass('blue') | |||||
| } | |||||
| if(status!=="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('blue') | |||||
| $('#model-debug-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status!=="STOPPED" || status!=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('disabled') | |||||
| $('#stop-model-debug-'+jobID).addClass('blue') | |||||
| $('#model-delete-'+jobID).removeClass('red') | |||||
| $('#model-delete-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status=="STOPPED" || status=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('blue') | |||||
| $('#stop-model-debug-'+jobID).addClass('disabled') | |||||
| $('#model-delete-'+jobID).removeClass('disabled') | |||||
| $('#model-delete-'+jobID).addClass('red') | |||||
| } | |||||
| }).fail(function(err) { | }).fail(function(err) { | ||||
| console.log(err); | console.log(err); | ||||
| }); | }); | ||||
| @@ -200,6 +200,7 @@ | |||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <!-- 列表容器 --> | <!-- 列表容器 --> | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| {{template "base/alert" .}} | |||||
| <!-- 中间云脑和新建任务按钮 --> | <!-- 中间云脑和新建任务按钮 --> | ||||
| <!-- <div class="ui three column stack able grid"> | <!-- <div class="ui three column stack able grid"> | ||||
| @@ -231,8 +232,8 @@ | |||||
| <div class="column"> | <div class="column"> | ||||
| <div class="ui blue small menu compact selectcloudbrain"> | <div class="ui blue small menu compact selectcloudbrain"> | ||||
| <a class="item" href="{{.RepoLink}}/modelarts/notebook">调试任务</a> | |||||
| <a class="active item" href="{{.RepoLink}}/modelarts/train-job">训练任务</a> | |||||
| <a class="item" href="{{.RepoLink}}/modelarts/notebook">{{$.i18n.Tr "repo.modelarts.notebook"}}</a> | |||||
| <a class="active item" href="{{.RepoLink}}/modelarts/train-job">{{$.i18n.Tr "repo.modelarts.train_job"}}</a> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <div class="column right aligned"> | <div class="column right aligned"> | ||||
| @@ -247,7 +248,7 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/train-job/create">新建训练任务</a> | |||||
| <a class="ui green button" href="{{.RepoLink}}/modelarts/train-job/create">{{$.i18n.Tr "repo.modelarts.train_job.new_train"}}</a> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -283,14 +284,14 @@ | |||||
| <div class="three wide column"> | <div class="three wide column"> | ||||
| <span>{{$.i18n.Tr "repo.cloudbrain_status_createtime"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_status_createtime"}}</span> | ||||
| </div> | </div> | ||||
| <div class="three wide column"> | |||||
| <div class="two wide column"> | |||||
| <span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | ||||
| </div> | </div> | ||||
| <div class="one wide column"> | |||||
| <div class="one wide column text center"> | |||||
| <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | <span>{{$.i18n.Tr "repo.cloudbrain_creator"}}</span> | ||||
| </div> | </div> | ||||
| <div class="four wide column text center"> | |||||
| <span style="margin-left: 10rem;">{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||||
| <div class="five wide column text center"> | |||||
| <span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| @@ -317,25 +318,25 @@ | |||||
| {{.Status}} | {{.Status}} | ||||
| </span> --> | </span> --> | ||||
| <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | <span class="job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | ||||
| <span><i style="vertical-align: middle;" class="{{.Status}}"></i><span style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| <span><i id="{{.JobID}}-icon" style="vertical-align: middle;" class="{{.Status}}"></i><span id="{{.JobID}}-text" style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span> | |||||
| </span> | </span> | ||||
| <!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
| <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> | ||||
| </div> | </div> | ||||
| <div class="three wide column"> | |||||
| <div class="two wide column"> | |||||
| <!--任务状态 --> | <!--任务状态 --> | ||||
| <!-- <span class="ui compact button job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | <!-- <span class="ui compact button job-status" id="{{.JobID}}" data-repopath="{{$.RepoRelPath}}" data-jobid="{{.JobID}}"> | ||||
| {{.Status}} | {{.Status}} | ||||
| </span> --> | </span> --> | ||||
| <span>{{.TrainJobDuration}}</span> | |||||
| <span id="duration-{{.JobID}}"></span> | |||||
| <!-- 任务创建时间 --> | <!-- 任务创建时间 --> | ||||
| <!-- <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> --> | <!-- <span style="font-size: 12px;margin-left: 0.4rem;" class="">{{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}</span> --> | ||||
| </div> | </div> | ||||
| <div class="one wide column"> | |||||
| <div class="one wide column text center"> | |||||
| {{if .User.Name}} | {{if .User.Name}} | ||||
| <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | <a href="{{AppSubUrl}}/{{.User.Name}}" title="{{.User.Name}}"><img class="ui avatar image" src="{{.User.RelAvatarLink}}"></a> | ||||
| {{else}} | {{else}} | ||||
| @@ -343,7 +344,7 @@ | |||||
| {{end}} | {{end}} | ||||
| </div> | </div> | ||||
| <div class="four wide column text right"> | |||||
| <div class="five wide column text right"> | |||||
| <div class="ui compact buttons"> | <div class="ui compact buttons"> | ||||
| <!-- <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}"> | <!-- <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}"> | ||||
| 查看 | 查看 | ||||
| @@ -351,17 +352,17 @@ | |||||
| <a class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | <a class="ui basic {{if not .CanDebug}}disabled {{else}}blue {{end}}button" href="{{$.Link}}/{{.JobID}}/debug" target="_blank"> | ||||
| 调试 | 调试 | ||||
| </a> --> | </a> --> | ||||
| <form id="stopForm-{{.JobID}}" action="{{if ne .Status "RUNNING"}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/stop{{end}}" method="post" style="margin-left:-1px;"> | |||||
| <form id="stopForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/stop" method="post" style="margin-left:-1px;"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui basic {{if ne .Status "RUNNING"}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| 停止 | |||||
| <a id="stop-model-debug-{{.JobID}}" class="ui basic {{if or (eq .Status "KILLED") (eq .Status "FAILED")}}disabled {{else}}blue {{end}}button" onclick="document.getElementById('stopForm-{{.JobID}}').submit();"> | |||||
| {{$.i18n.Tr "repo.stop"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| <div class="ui compact buttons" style="margin-right:10px;"> | <div class="ui compact buttons" style="margin-right:10px;"> | ||||
| <!-- 模型下载 --> | <!-- 模型下载 --> | ||||
| <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | |||||
| 模型下载 | |||||
| <a class="ui basic blue button" href="{{$.Link}}/{{.JobID}}/models" target="_blank"> | |||||
| {{$.i18n.Tr "repo.model_download"}} | |||||
| </a> | </a> | ||||
| <!-- 接收结果 --> | <!-- 接收结果 --> | ||||
| @@ -370,10 +371,10 @@ | |||||
| </div> | </div> | ||||
| <!-- 删除任务 --> | <!-- 删除任务 --> | ||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{if eq .Status "RUNNING"}}javascript:void(0){{else}}{{$.Link}}/{{.JobID}}/del{{end}}" method="post"> | |||||
| <form class="ui compact buttons" id="delForm-{{.JobID}}" action="{{$.Link}}/{{.JobID}}/del" method="post"> | |||||
| {{$.CsrfTokenHtml}} | {{$.CsrfTokenHtml}} | ||||
| <a class="ui compact {{if eq .Status "RUNNING" }}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| 删除 | |||||
| <a id="model-delete-{{.JobID}}" class="ui compact {{if eq .Status "RUNNING" }}disabled {{else}}red {{end}}button" onclick="assertDelete(this)" style="border-radius: .28571429rem;"> | |||||
| {{$.i18n.Tr "repo.delete"}} | |||||
| </a> | </a> | ||||
| </form> | </form> | ||||
| </div> | </div> | ||||
| @@ -456,7 +457,31 @@ | |||||
| .modal('show') | .modal('show') | ||||
| } | } | ||||
| } | } | ||||
| function runtime(time){ | |||||
| if(time){ | |||||
| let hours = time/3600000<10 ? "0"+parseInt(time/3600000):parseInt(time/3600000) | |||||
| let miuns = time%3600000/60000<10 ? "0"+parseInt(time%3600000/60000):parseInt(time%3600000/60000) | |||||
| let seconds = time%60000/1000<10 ? "0"+parseInt(time%60000/1000):parseInt(time%60000/1000) | |||||
| return hours + ":" + miuns + ":" + seconds | |||||
| }else{ | |||||
| return "00:00:00" | |||||
| } | |||||
| } | |||||
| function loadJobDuration() { | |||||
| $(".job-status").each((index, job) => { | |||||
| const jobID = job.dataset.jobid; | |||||
| const repoPath = job.dataset.repopath; | |||||
| $.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}`, (data) => { | |||||
| const duration = data.JobDuration | |||||
| const jobID = data.JobID | |||||
| let train_duration = runtime(duration) | |||||
| $('#duration-'+jobID).text(train_duration) | |||||
| }) | |||||
| }) | |||||
| } | |||||
| $(document).ready(loadJobDuration); | |||||
| // 加载任务状态 | // 加载任务状态 | ||||
| var timeid = window.setInterval(loadJobStatus, 15000); | var timeid = window.setInterval(loadJobStatus, 15000); | ||||
| $(document).ready(loadJobStatus); | $(document).ready(loadJobStatus); | ||||
| @@ -464,6 +489,7 @@ | |||||
| $(".job-status").each((index, job) => { | $(".job-status").each((index, job) => { | ||||
| const jobID = job.dataset.jobid; | const jobID = job.dataset.jobid; | ||||
| const repoPath = job.dataset.repopath; | const repoPath = job.dataset.repopath; | ||||
| if (job.textContent.trim() == 'IMAGE_FAILED' || job.textContent.trim() == 'SUBMIT_FAILED' || job.textContent.trim() == 'DELETE_FAILED' | if (job.textContent.trim() == 'IMAGE_FAILED' || job.textContent.trim() == 'SUBMIT_FAILED' || job.textContent.trim() == 'DELETE_FAILED' | ||||
| || job.textContent.trim() == 'KILLED' || job.textContent.trim() == 'COMPLETED' || job.textContent.trim() == 'FAILED' | || job.textContent.trim() == 'KILLED' || job.textContent.trim() == 'COMPLETED' || job.textContent.trim() == 'FAILED' | ||||
| || job.textContent.trim() == 'CANCELED' || job.textContent.trim() == 'LOST') { | || job.textContent.trim() == 'CANCELED' || job.textContent.trim() == 'LOST') { | ||||
| @@ -473,18 +499,42 @@ | |||||
| $.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}`, (data) => { | $.get(`/api/v1/repos/${repoPath}/modelarts/train-job/${jobID}`, (data) => { | ||||
| const jobID = data.JobID | const jobID = data.JobID | ||||
| const status = data.JobStatus | const status = data.JobStatus | ||||
| const duration = data.JobDuration | |||||
| if (status != job.textContent.trim()) { | if (status != job.textContent.trim()) { | ||||
| //$('#' + jobID).text(status) | |||||
| //if (status == 'STOPPED') { | |||||
| window.location.reload() | |||||
| //} | |||||
| $('#' + jobID+'-icon').removeClass().addClass(status) | |||||
| $('#' + jobID+ '-text').text(status) | |||||
| } | |||||
| if(status==="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('disabled') | |||||
| $('#model-debug-'+jobID).addClass('blue') | |||||
| let train_duration = runtime(duration) | |||||
| $('#duration-'+jobID).text(train_duration) | |||||
| } | |||||
| if(status!=="RUNNING"){ | |||||
| $('#model-debug-'+jobID).removeClass('blue') | |||||
| $('#model-debug-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status!=="KILLED" || status!=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('disabled') | |||||
| $('#stop-model-debug-'+jobID).addClass('blue') | |||||
| $('#model-delete-'+jobID).removeClass('red') | |||||
| $('#model-delete-'+jobID).addClass('disabled') | |||||
| } | |||||
| if(status=="KILLED" || status=="FAILED"){ | |||||
| $('#stop-model-debug-'+jobID).removeClass('blue') | |||||
| $('#stop-model-debug-'+jobID).addClass('disabled') | |||||
| $('#model-delete-'+jobID).removeClass('disabled') | |||||
| $('#model-delete-'+jobID).addClass('red') | |||||
| } | } | ||||
| }).fail(function(err) { | }).fail(function(err) { | ||||
| console.log(err); | console.log(err); | ||||
| }); | }); | ||||
| }); | }); | ||||
| }; | }; | ||||
| // 获取弹窗 | // 获取弹窗 | ||||
| var modal = document.getElementById('imageModal'); | var modal = document.getElementById('imageModal'); | ||||
| @@ -49,12 +49,98 @@ | |||||
| text-align: center; | text-align: center; | ||||
| color: #C2C7CC;" | color: #C2C7CC;" | ||||
| } | } | ||||
| #mask { | |||||
| position: fixed; | |||||
| top: 0px; | |||||
| left: 0px; | |||||
| right: 0px; | |||||
| bottom: 0px; | |||||
| filter: alpha(opacity=60); | |||||
| background-color: #777; | |||||
| z-index: 1000; | |||||
| display: none; | |||||
| opacity: 0.8; | |||||
| -moz-opacity: 0.5; | |||||
| padding-top: 100px; | |||||
| color: #000000 | |||||
| } | |||||
| /* 加载圈css效果图 */ | |||||
| #loadingPage { | |||||
| margin: 200px auto; | |||||
| width: 50px; | |||||
| height: 40px; | |||||
| text-align: center; | |||||
| font-size: 10px; | |||||
| display: block; | |||||
| } | |||||
| #loadingPage>div { | |||||
| background-color: green; | |||||
| height: 100%; | |||||
| width: 6px; | |||||
| display: inline-block; | |||||
| -webkit-animation: sk-stretchdelay 1.2s infinite ease-in-out; | |||||
| animation: sk-stretchdelay 1.2s infinite ease-in-out; | |||||
| } | |||||
| #loadingPage .rect2 { | |||||
| -webkit-animation-delay: -1.1s; | |||||
| animation-delay: -1.1s; | |||||
| } | |||||
| #loadingPage .rect3 { | |||||
| -webkit-animation-delay: -1.0s; | |||||
| animation-delay: -1.0s; | |||||
| } | |||||
| #loadingPage .rect4 { | |||||
| -webkit-animation-delay: -0.9s; | |||||
| animation-delay: -0.9s; | |||||
| } | |||||
| #loadingPage .rect5 { | |||||
| -webkit-animation-delay: -0.8s; | |||||
| animation-delay: -0.8s; | |||||
| } | |||||
| @-webkit-keyframes sk-stretchdelay { | |||||
| 0%, | |||||
| 40%, | |||||
| 100% { | |||||
| -webkit-transform: scaleY(0.4) | |||||
| } | |||||
| 20% { | |||||
| -webkit-transform: scaleY(1.0) | |||||
| } | |||||
| } | |||||
| @keyframes sk-stretchdelay { | |||||
| 0%, | |||||
| 40%, | |||||
| 100% { | |||||
| transform: scaleY(0.4); | |||||
| -webkit-transform: scaleY(0.4); | |||||
| } | |||||
| 20% { | |||||
| transform: scaleY(1.0); | |||||
| -webkit-transform: scaleY(1.0); | |||||
| } | |||||
| } | |||||
| </style> | </style> | ||||
| <div class="ui page dimmer"> | |||||
| <!-- <div class="ui page dimmer"> | |||||
| <div class="ui text loader">{{.i18n.Tr "loading"}}</div> | <div class="ui text loader">{{.i18n.Tr "loading"}}</div> | ||||
| </div> --> | |||||
| <div id="mask"> | |||||
| <div id="loadingPage"> | |||||
| <div class="rect1"></div> | |||||
| <div class="rect2"></div> | |||||
| <div class="rect3"></div> | |||||
| <div class="rect4"></div> | |||||
| <div class="rect5"></div> | |||||
| </div> | |||||
| </div> | </div> | ||||
| <div class="repository"> | <div class="repository"> | ||||
| {{template "repo/header" .}} | {{template "repo/header" .}} | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| @@ -147,9 +233,9 @@ | |||||
| </div> | </div> | ||||
| </div> | </div> | ||||
| </div> --> | </div> --> | ||||
| <div class="inline unite min_title field"> | |||||
| <div class="inline unite min_title field required"> | |||||
| <label>{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label> | <label>{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label> | ||||
| <input style="width: 33.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3" autofocus required maxlength="255" placeholder="{{.i18n.Tr "repo.modelarts.train_job.boot_file_place"}}"> | |||||
| <input style="width: 33.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3" autofocus required maxlength="255" > | |||||
| <span> | <span> | ||||
| <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i> | ||||
| </span> | </span> | ||||
| @@ -412,14 +498,19 @@ | |||||
| } | } | ||||
| }, | }, | ||||
| onSuccess: function(){ | onSuccess: function(){ | ||||
| $('.ui.page.dimmer').dimmer('show') | |||||
| // $('.ui.page.dimmer').dimmer('show') | |||||
| document.getElementById("mask").style.display = "block" | |||||
| }, | }, | ||||
| onFailure: function(e){ | onFailure: function(e){ | ||||
| return false; | return false; | ||||
| } | } | ||||
| }) | }) | ||||
| } | } | ||||
| document.onreadystatechange = function() { | |||||
| if (document.readyState === "complete") { | |||||
| document.getElementById("mask").style.display = "none" | |||||
| } | |||||
| } | |||||
| function send_run_para(){ | function send_run_para(){ | ||||
| var run_parameters = [] | var run_parameters = [] | ||||
| var msg = {} | var msg = {} | ||||
| @@ -25,8 +25,8 @@ | |||||
| <div class="content active"> | <div class="content active"> | ||||
| <div class="ui container"> | <div class="ui container"> | ||||
| <div class="ui top attached tabular menu"> | <div class="ui top attached tabular menu"> | ||||
| <a class="item active" data-tab="configs">配置信息</a> | |||||
| <a class="item logs" data-tab="logs">{{$.i18n.Tr "repo.modelarts.log"}}</a> | |||||
| <a class="item active" data-tab="configs">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||||
| <a class="item logs" data-tab="logs">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a> | |||||
| <!-- <a class="item" data-tab="resources">资源占用情况</a> --> | <!-- <a class="item" data-tab="resources">资源占用情况</a> --> | ||||
| </div> | </div> | ||||
| <div class="ui bottom attached tab segment active" data-tab="configs"> | <div class="ui bottom attached tab segment active" data-tab="configs"> | ||||
| @@ -227,12 +227,12 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} | |||||
| .STOPPED, .KILLED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -459px -52px;} | .STOPPED, .KILLED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -459px -52px;} | ||||
| .RUNNING{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -478px -52px;} | .RUNNING{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -478px -52px;} | ||||
| .i-bg-orange{background-position: -495px -51px;} | .i-bg-orange{background-position: -495px -51px;} | ||||
| .FAILED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -532px -52px;} | |||||
| .FAILED,.START_FAILED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -532px -52px;} | |||||
| .i-bg-green{background-position: -441px -52px;} | .i-bg-green{background-position: -441px -52px;} | ||||
| .i-bg-used{background-position: -514px -52px;} | .i-bg-used{background-position: -514px -52px;} | ||||
| .icon-bind{background-position: -550px -52px;} | .icon-bind{background-position: -550px -52px;} | ||||
| .icon-unbind{background-position: -568px -52px;} | .icon-unbind{background-position: -568px -52px;} | ||||
| .CREATING, .STOPPING, .DELETING, .STARTING, .WAITING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} | |||||
| .CREATING, .STOPPING, .DELETING, .STARTING, .WAITING ,.INIT,.KILLING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} | |||||
| .COMPLETED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -441px -52px;} | .COMPLETED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -441px -52px;} | ||||
| .text_over{ | .text_over{ | ||||