diff --git a/models/cloudbrain.go b/models/cloudbrain.go index 06c2e98b4..ea6d0338e 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1,6 +1,7 @@ package models import ( + "code.gitea.io/gitea/modules/util" "encoding/json" "fmt" "strconv" @@ -102,15 +103,15 @@ type Cloudbrain struct { ContainerIp string CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` - Duration int64 - TrainJobDuration string - Image string //镜像名称 - GpuQueue string //GPU类型即GPU队列 - ResourceSpecId int //GPU规格id - DeletedAt time.Time `xorm:"deleted"` - CanDebug bool `xorm:"-"` - CanDel bool `xorm:"-"` - CanModify bool `xorm:"-"` + Duration int64 `xorm:"DEFAULT 0"` //运行时长 单位秒 + TrainJobDuration string `xorm:"DEFAULT '00:00:00'"` + Image string //镜像名称 + GpuQueue string //GPU类型即GPU队列 + ResourceSpecId int //GPU规格id + DeletedAt time.Time `xorm:"deleted"` + CanDebug bool `xorm:"-"` + CanDel bool `xorm:"-"` + CanModify bool `xorm:"-"` Type int BenchmarkTypeID int BenchmarkChildTypeID int @@ -150,6 +151,44 @@ type Cloudbrain struct { Repo *Repository `xorm:"-"` BenchmarkTypeName string `xorm:"-"` BenchmarkTypeRankLink string `xorm:"-"` + StartTime timeutil.TimeStamp + EndTime timeutil.TimeStamp +} + +func (task *Cloudbrain) ComputeAndSetDuration() { + var d int64 + if task.StartTime == 0 { + d = 0 + } else if task.EndTime == 0 { + d = time.Now().Unix() - task.StartTime.AsTime().Unix() + } else { + d = task.EndTime.AsTime().Unix() - task.StartTime.AsTime().Unix() + } + + if d < 0 { + d = 0 + } + task.Duration = d + task.TrainJobDuration = ConvertDurationToStr(d) +} + +func ConvertDurationToStr(duration int64) string { + if duration == 0 { + return "00:00:00" + } + return util.AddZero(duration/3600) + ":" + util.AddZero(duration%3600/60) + ":" + util.AddZero(duration%60) +} + +func IsTrainJobTerminal(status string) bool { + return status == string(ModelArtsTrainJobCompleted) || status == string(ModelArtsTrainJobFailed) || status == string(ModelArtsTrainJobKilled) +} + +func IsModelArtsDebugJobTerminal(status string) bool { + return status == string(ModelArtsStopped) +} + +func IsCloudBrainOneDebugJobTerminal(status string) bool { + return status == string(JobStopped) || status == string(JobFailed) || status == string(JobSucceeded) } type CloudbrainInfo struct { @@ -1019,6 +1058,7 @@ type GetTrainJobResult struct { NasShareAddr string `json:"nas_share_addr"` DatasetName string ModelMetricList string `json:"model_metric_list"` //列表里包含f1_score,recall,precision,accuracy,若有的话 + StartTime int64 `json:"start_time"` //训练作业开始时间。 } type GetTrainJobLogResult struct { @@ -1117,7 +1157,7 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { } else { lowerKeyWord := strings.ToLower(opts.Keyword) - cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord})) + cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_name)", lowerKeyWord}, builder.Like{"LOWER(cloudbrain.display_job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord})) count, err = sess.Table(&Cloudbrain{}).Where(cond). Join("left", "`user`", condition).Count(new(CloudbrainInfo)) @@ -1327,13 +1367,13 @@ func GetCloudbrainByJobIDAndIsLatestVersion(jobID string, isLatestVersion string func GetCloudbrainsNeededStopByUserID(userID int64) ([]*Cloudbrain, error) { cloudBrains := make([]*Cloudbrain, 0) - err := x.Cols("job_id", "status", "type", "job_type", "version_id").Where("user_id=? AND status !=?", userID, string(JobStopped)).Find(&cloudBrains) + err := x.Cols("job_id", "status", "type", "job_type", "version_id", "start_time").Where("user_id=? AND status !=?", userID, string(JobStopped)).Find(&cloudBrains) return cloudBrains, err } func GetCloudbrainsNeededStopByRepoID(repoID int64) ([]*Cloudbrain, error) { cloudBrains := make([]*Cloudbrain, 0) - err := x.Cols("job_id", "status", "type", "job_type", "version_id").Where("repo_id=? AND status !=?", repoID, string(JobStopped)).Find(&cloudBrains) + err := x.Cols("job_id", "status", "type", "job_type", "version_id", "start_time").Where("repo_id=? AND status !=?", repoID, string(JobStopped)).Find(&cloudBrains) return cloudBrains, err } @@ -1377,7 +1417,7 @@ func UpdateTrainJobVersion(job *Cloudbrain) error { func updateJobTrainVersion(e Engine, job *Cloudbrain) error { var sess *xorm.Session sess = e.Where("job_id = ? AND version_name=?", job.JobID, job.VersionName) - _, err := sess.Cols("status", "train_job_duration").Update(job) + _, err := sess.Cols("status", "train_job_duration", "duration", "start_time", "end_time").Update(job) return err } @@ -1457,7 +1497,7 @@ func UpdateInferenceJob(job *Cloudbrain) error { func updateInferenceJob(e Engine, job *Cloudbrain) error { var sess *xorm.Session sess = e.Where("job_id = ?", job.JobID) - _, err := sess.Cols("status", "train_job_duration").Update(job) + _, err := sess.Cols("status", "train_job_duration", "duration", "start_time", "end_time").Update(job) return err } func RestartCloudbrain(old *Cloudbrain, new *Cloudbrain) (err error) { diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4ccc68bbe..d295dd84a 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -273,6 +273,20 @@ code_search_results = Search results for '%s' code_last_indexed_at = Last indexed %s save=Save cancel=Cancel +hot_repo=Hot Repositories +active_repo=Active Repositories +all_fields = All fields +large_model = Large model +ai_development_tools = AI tools +computer_version = Computer version +natural_language_processing = NLP +machine_learning = Machine learning +neural_networks = Neural networks +autopilot = Autopilot +robot = Robot +federated_learning = Federated learning +data_mining = Data mining +RISC-V_development = RISC-V development [auth] create_new_account = Register Account @@ -891,6 +905,7 @@ model_noright=No right model_rename=Duplicate model name, please modify model name. debug=Debug +debug_again=Restart stop=Stop delete=Delete more=More @@ -898,7 +913,7 @@ gpu_type_all=All model_download=Model Download submit_image=Submit Image download=Download - +score=score cloudbrain=Cloudbrain cloudbrain.new=New cloudbrain @@ -1020,13 +1035,28 @@ cloudbrain.benchmark.evaluate_child_type=Child Type cloudbrain.benchmark.evaluate_mirror=Mirror cloudbrain.benchmark.evaluate_train=Train Script cloudbrain.benchmark.evaluate_test=Test Script +cloudbrain.benchmark.types={"type":[{"id":1,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=detection","first":"Target detection","second":[{"id":1,"value":"None","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"yangzhx","repo_name":"detection_benchmark_script"}]},{"id":2,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=reid","first":"Target re-identification","second":[{"id":1,"value":"Vehicle re-identification","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"},{"id":2,"value":"Image-based person re-identification","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"}]},{"id":3,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=tracking","first":"Multi-target tracking","second":[{"id":1,"value":"None","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"lix07","repo_name":"MOT_benchmark_script"}]}]} + modelarts.infer_job_model = Model modelarts.infer_job_model_file = Model File modelarts.infer_job = Inference Job modelarts.infer_job.model_version = Model/Version modelarts.infer_job.select_model = Select Model +modelarts.infer_job.boot_file_helper=The startup file is the entry file for your program execution and must end in.py.Such as inference.py, main.py, example/inference. Py, case/main.py. modelarts.infer_job.tooltip = The model has been deleted and cannot be viewed. + +debug_task_not_created = Debug task has not been created +train_task_not_created = Train task has not been created +inference_job_not_created = Inference job has not been created +model_Evaluation_not_created = Model evaluation has not been created +repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; +debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; +dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; +platform_instructions = Instructions for use: You can refer to the Xiaobai training camp course of Qizhi AI collaboration platform. +model_not_exist = Model file: You do not have a model file yet, please generate and export the model through the training task first ; +benchmark_leaderboards = Benchmark leaderboards + model.manage.import_new_model=Import New Model model.manage.create_error=Equal Name and Version has existed. model.manage.model_name = Model Name @@ -2863,4 +2893,24 @@ benchmark_path = Benchmark script path snn4imagenet_path = Snn4imagenet script path brainscore_path = Brainscore script path start_command = Start command -choose_mirror = select mirror +choose_mirror = select mirror or enter mirror path +select_dataset = select dataset +specification = specification +select_specification = select specification +description = description + +job_name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). +dataset_path_rule = The dataset location is stored in the environment variable data_url, and the training output path is stored in the environment variable train_url. +view_sample = View sample +inference_output_path_rule = The inference output path is stored in the environment variable result_url. +model_file_path_rule=The model file location is stored in the environment variable ckpt_url + +delete_task = Delete task +task_delete_confirm = Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered. +operate_confirm = confirm +operate_cancel = cancel + +gpu_num = GPU +cpu_num = CPU +memory = Memory +shared_memory = Shared Memory diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 4cc95f6ba..4e73fbad5 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -275,6 +275,20 @@ code_search_results=“%s” 的搜索结果是 code_last_indexed_at=最后索引于 %s save=保存 cancel=取消 +hot_repo=热门项目 +active_repo=活跃项目 +all_fields = 全部领域 +large_model = 大模型 +ai_development_tools = AI开发工具 +computer_version = 计算机视觉 +natural_language_processing = 自然语言处理 +machine_learning = 机器学习 +neural_networks = 神经网络 +autopilot = 自动驾驶 +robot = 机器人 +federated_learning = 联邦学习 +data_mining = 数据挖掘 +RISC-V_development = RISC-V开发 [auth] create_new_account=注册帐号 @@ -904,6 +918,7 @@ gpu_type_all=全部 model_download=结果下载 submit_image=提交镜像 download=模型下载 +score=评分 cloudbrain=云脑 cloudbrain.new=新建任务 @@ -1027,7 +1042,7 @@ cloudbrain.benchmark.evaluate_child_type=子类型 cloudbrain.benchmark.evaluate_mirror=镜像 cloudbrain.benchmark.evaluate_train=训练程序 cloudbrain.benchmark.evaluate_test=测试程序 - +cloudbrain.benchmark.types={"type":[{"id":1,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=detection","first":"目标检测","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"yangzhx","repo_name":"detection_benchmark_script"}]},{"id":2,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=reid","first":"目标重识别","second":[{"id":1,"value":"车辆重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"},{"id":2,"value":"基于图像的行人重识别","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"JiahongXu","repo_name":"benchmark_reID_script"}]},{"id":3,"rank_link":"https://git.openi.org.cn/benchmark/?username=admin&algType=tracking","first":"多目标跟踪","second":[{"id":1,"value":"无","attachment":"84cf39c4-d8bc-41aa-aaa3-182ce289b105","owner":"lix07","repo_name":"MOT_benchmark_script"}]}]} modelarts.infer_job_model = 模型名称 modelarts.infer_job_model_file = 模型文件 @@ -1037,6 +1052,18 @@ modelarts.infer_job.select_model = 选择模型 modelarts.infer_job.boot_file_helper=启动文件是您程序执行的入口文件,必须是以.py结尾的文件。比如inference.py、main.py、example/inference.py、case/main.py。 modelarts.infer_job.tooltip = 该模型已删除,无法查看。 + +debug_task_not_created = 未创建过调试任务 +train_task_not_created = 未创建过训练任务 +inference_job_not_created = 未创建过推理任务 +model_Evaluation_not_created = 未创建过评测任务 +repo_not_initialized = 代码版本:您还没有初始化代码仓库,请先创建代码版本; +debug_task_running_limit = 运行时长:最长不超过4个小时,超过4个小时将自动停止; +dataset_desc = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; +platform_instructions = 使用说明:可以参考启智AI协作平台小白训练营课程。 +model_not_exist = 模型文件:您还没有模型文件,请先通过训练任务产生并 导出模型 ; +benchmark_leaderboards = 基准测试排行榜 + model.manage.import_new_model=导入新模型 model.manage.create_error=相同的名称和版本的模型已经存在。 model.manage.model_name = 模型名称 @@ -2874,3 +2901,24 @@ snn4imagenet_path = snn4imagenet脚本存放路径 brainscore_path = brainscore脚本存放路径 start_command = 启动命令 choose_mirror = 选择镜像或输入镜像地址 +select_dataset = 选择数据集 +specification = 规格 +select_specification = 选择资源规格 +description = 描述 + +job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 +dataset_path_rule = 数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。 +view_sample = 查看样例 +inference_output_path_rule = 推理输出路径存储在环境变量result_url中。 +model_file_path_rule = 模型文件位置存储在环境变量ckpt_url中。 + +delete_task = 删除任务 +task_delete_confirm = 你确认删除该任务么?此任务一旦删除不可恢复。 +operate_confirm = 确定操作 +operate_cancel = 取消操作 + +gpu_num = GPU数 +cpu_num = CPU数 +memory = 内存 +shared_memory = 共享内存 + diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index f92259c3d..b2f529dfb 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -6,6 +6,7 @@ package repo import ( + "code.gitea.io/gitea/modules/timeutil" "net/http" "sort" "time" @@ -77,9 +78,17 @@ func GetCloudbrainTask(ctx *context.APIContext) { job.ContainerIp = taskRes.TaskStatuses[0].ContainerIP job.ContainerID = taskRes.TaskStatuses[0].ContainerID job.Status = taskRes.TaskStatuses[0].State + + if job.StartTime == 0 && !taskRes.TaskStatuses[0].StartAt.IsZero() { + job.StartTime = timeutil.TimeStamp(taskRes.TaskStatuses[0].StartAt.Unix()) + } } if result.JobStatus.State != string(models.JobWaiting) { + if job.EndTime == 0 && models.IsCloudBrainOneDebugJobTerminal(job.Status) { + job.EndTime = timeutil.TimeStampNow() + } + job.ComputeAndSetDuration() err = models.UpdateJob(job) if err != nil { log.Error("UpdateJob failed:", err) diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index 893f2a32c..d7d011e07 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -6,12 +6,11 @@ package repo import ( + "code.gitea.io/gitea/modules/timeutil" "net/http" "strconv" "strings" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" @@ -67,8 +66,14 @@ func GetModelArtsNotebook2(ctx *context.APIContext) { ctx.NotFound(err) return } - + if job.StartTime == 0 && result.Lease.CreateTime > 0 { + job.StartTime = timeutil.TimeStamp(result.Lease.CreateTime / 1000) + } job.Status = result.Status + if job.EndTime == 0 && models.IsModelArtsDebugJobTerminal(job.Status) { + job.EndTime = timeutil.TimeStampNow() + } + job.ComputeAndSetDuration() err = models.UpdateJob(job) if err != nil { log.Error("UpdateJob failed:", err) @@ -133,16 +138,17 @@ func GetModelArtsTrainJobVersion(ctx *context.APIContext) { ctx.NotFound(err) return } - + if job.StartTime == 0 && result.StartTime > 0 { + job.StartTime = timeutil.TimeStamp(result.StartTime / 1000) + } job.Status = modelarts.TransTrainJobStatus(result.IntStatus) - job.Duration = result.Duration + job.Duration = result.Duration / 1000 job.TrainJobDuration = result.TrainJobDuration - if result.Duration != 0 { - job.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) + job.TrainJobDuration = models.ConvertDurationToStr(job.Duration) - } else { - job.TrainJobDuration = "00:00:00" + if job.EndTime == 0 && models.IsTrainJobTerminal(job.Status) && job.StartTime > 0 { + job.EndTime = job.StartTime.Add(job.Duration) } err = models.UpdateTrainJobVersion(job) @@ -366,16 +372,17 @@ func GetModelArtsInferenceJob(ctx *context.APIContext) { ctx.NotFound(err) return } - + if job.StartTime == 0 && result.StartTime > 0 { + job.StartTime = timeutil.TimeStamp(result.StartTime / 1000) + } job.Status = modelarts.TransTrainJobStatus(result.IntStatus) - job.Duration = result.Duration + job.Duration = result.Duration / 1000 job.TrainJobDuration = result.TrainJobDuration - if result.Duration != 0 { - job.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) + job.TrainJobDuration = models.ConvertDurationToStr(result.Duration) - } else { - job.TrainJobDuration = "00:00:00" + if job.EndTime == 0 && models.IsTrainJobTerminal(job.Status) && job.StartTime > 0 { + job.EndTime = job.StartTime.Add(job.Duration) } err = models.UpdateInferenceJob(job) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index b1f344d55..2c42f8a16 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -292,41 +292,41 @@ func getFileName(ctx *context.Context, beginTime time.Time, endTime time.Time, p func allProjectsPeroidHeader(ctx *context.Context) map[string]string { - return map[string]string{"A1": ctx.Tr("admin.repos.id"), "B1": ctx.Tr("admin.repos.projectName"), "C1": ctx.Tr("repo.owner"), "D1": ctx.Tr("admin.repos.isPrivate"), "E1": ctx.Tr("admin.repos.isFork"), "F1": ctx.Tr("admin.repos.isMirror"), "G1": ctx.Tr("admin.repos.openi"), "H1": ctx.Tr("admin.repos.visit"), "I1": ctx.Tr("admin.repos.download"), "J1": ctx.Tr("admin.repos.pr"), "K1": ctx.Tr("admin.repos.commit"), - "L1": ctx.Tr("admin.repos.watches"), "M1": ctx.Tr("admin.repos.stars"), "N1": ctx.Tr("admin.repos.forks"), "O1": ctx.Tr("admin.repos.issues"), "P1": ctx.Tr("admin.repos.closedIssues"), "Q1": ctx.Tr("admin.repos.contributor"), "R1": ctx.Tr("admin.repos.create")} + return map[string]string{"A1": ctx.Tr("admin.repos.id"), "B1": ctx.Tr("admin.repos.projectName"), "C1": ctx.Tr("repo.owner"), "D1": ctx.Tr("admin.repos.isPrivate"), "E1": ctx.Tr("admin.repos.openi"), "F1": ctx.Tr("admin.repos.visit"), "G1": ctx.Tr("admin.repos.download"), "H1": ctx.Tr("admin.repos.pr"), "I1": ctx.Tr("admin.repos.commit"), + "J1": ctx.Tr("admin.repos.watches"), "K1": ctx.Tr("admin.repos.stars"), "L1": ctx.Tr("admin.repos.forks"), "M1": ctx.Tr("admin.repos.issues"), "N1": ctx.Tr("admin.repos.closedIssues"), "O1": ctx.Tr("admin.repos.contributor"), "P1": ctx.Tr("admin.repos.isFork"), "Q1": ctx.Tr("admin.repos.isMirror"), "R1": ctx.Tr("admin.repos.create")} } func allProjectsPeroidValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getBoolDisplay(rs.IsPrivate, ctx), getCellName("E", row): getBoolDisplay(rs.IsFork, ctx), getCellName("F", row): getBoolDisplay(rs.IsMirror, ctx), getCellName("G", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), - getCellName("H", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("I", row): strconv.FormatInt(rs.NumDownloads, 10), getCellName("J", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("K", row): strconv.FormatInt(rs.NumCommits, 10), - getCellName("L", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("M", row): strconv.FormatInt(rs.NumStars, 10), getCellName("N", row): strconv.FormatInt(rs.NumForks, 10), getCellName("O", row): strconv.FormatInt(rs.NumIssues, 10), - getCellName("P", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("Q", row): strconv.FormatInt(rs.NumContributor, 10), getCellName("R", row): time.Unix(int64(rs.RepoCreatedUnix), 0).Format(CREATE_TIME_FORMAT), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getBoolDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + getCellName("F", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("G", row): strconv.FormatInt(rs.NumDownloads, 10), getCellName("H", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("I", row): strconv.FormatInt(rs.NumCommits, 10), + getCellName("J", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("K", row): strconv.FormatInt(rs.NumStars, 10), getCellName("L", row): strconv.FormatInt(rs.NumForks, 10), getCellName("M", row): strconv.FormatInt(rs.NumIssues, 10), + getCellName("N", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("O", row): strconv.FormatInt(rs.NumContributor, 10), getCellName("P", row): getBoolDisplay(rs.IsFork, ctx), getCellName("Q", row): getBoolDisplay(rs.IsMirror, ctx), getCellName("R", row): time.Unix(int64(rs.RepoCreatedUnix), 0).Format(CREATE_TIME_FORMAT), } } func allProjectsOpenIHeader() map[string]string { - return map[string]string{"A1": "ID", "B1": "项目名称", "C1": "拥有者", "D1": "私有", "E1": "迁移", "F1": "镜像", "G1": "OpenI指数", - "H1": "影响力", "I1": "成熟度", "J1": "活跃度", "K1": "项目健康度", "L1": "团队健康度", "M1": "项目发展趋势", - "N1": "关注数", "O1": "点赞数", "P1": "派生数", "Q1": "代码下载量", "R1": "评论数", "S1": "浏览量", "T1": "已解决任务数", "U1": "版本发布数量", "V1": "有效开发年龄", - "W1": "数据集", "X1": "模型数", "Y1": "百科页面数量", "Z1": "提交数", "AA1": "任务数", "AB1": "PR数", "AC1": "版本发布数量", "AD1": "任务完成比例", "AE1": "贡献者数", "AF1": "关键贡献者数", - "AG1": "新人增长量", "AH1": "代码规模增长量", "AI1": "任务增长量", "AJ1": "新人增长量", "AK1": "提交增长量", "AL1": "评论增长量", "AM1": "项目创建时间", + return map[string]string{"A1": "ID", "B1": "项目名称", "C1": "拥有者", "D1": "私有", "E1": "OpenI指数", + "F1": "影响力", "G1": "成熟度", "H1": "活跃度", "I1": "项目健康度", "J1": "团队健康度", "K1": "项目发展趋势", + "L1": "关注数", "M1": "点赞数", "N1": "派生数", "O1": "代码下载量", "P1": "评论数", "Q1": "浏览量", "R1": "已解决任务数", "S1": "版本发布数量", "T1": "有效开发年龄", + "U1": "数据集", "V1": "模型数", "W1": "百科页面数量", "X1": "提交数", "Y1": "任务数", "Z1": "PR数", "AA1": "版本发布数量", "AB1": "任务完成比例", "AC1": "贡献者数", "AD1": "关键贡献者数", + "AE1": "新人增长量", "AF1": "代码规模增长量", "AG1": "任务增长量", "AH1": "新人增长量", "AI1": "提交增长量", "AJ1": "评论增长量", "AK1": "迁移", "AL1": "镜像", "AM1": "项目创建时间", } } func allProjectsOpenIValues(row int, rs *models.RepoStatistic, ctx *context.Context) map[string]string { - return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getBoolDisplay(rs.IsPrivate, ctx), getCellName("E", row): getBoolDisplay(rs.IsFork, ctx), getCellName("F", row): getBoolDisplay(rs.IsMirror, ctx), getCellName("G", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), - getCellName("H", row): strconv.FormatFloat(rs.Impact, 'f', 2, 64), getCellName("I", row): strconv.FormatFloat(rs.Completeness, 'f', 2, 64), getCellName("J", row): strconv.FormatFloat(rs.Liveness, 'f', 2, 64), getCellName("K", row): strconv.FormatFloat(rs.ProjectHealth, 'f', 2, 64), getCellName("L", row): strconv.FormatFloat(rs.TeamHealth, 'f', 2, 64), getCellName("M", row): strconv.FormatFloat(rs.Growth, 'f', 2, 64), - getCellName("N", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("O", row): strconv.FormatInt(rs.NumStars, 10), getCellName("P", row): strconv.FormatInt(rs.NumForks, 10), getCellName("Q", row): strconv.FormatInt(rs.NumDownloads, 10), + return map[string]string{getCellName("A", row): strconv.FormatInt(rs.RepoID, 10), getCellName("B", row): rs.DisplayName(), getCellName("C", row): rs.OwnerName, getCellName("D", row): getBoolDisplay(rs.IsPrivate, ctx), getCellName("E", row): strconv.FormatFloat(rs.RadarTotal, 'f', 2, 64), + getCellName("F", row): strconv.FormatFloat(rs.Impact, 'f', 2, 64), getCellName("G", row): strconv.FormatFloat(rs.Completeness, 'f', 2, 64), getCellName("H", row): strconv.FormatFloat(rs.Liveness, 'f', 2, 64), getCellName("I", row): strconv.FormatFloat(rs.ProjectHealth, 'f', 2, 64), getCellName("J", row): strconv.FormatFloat(rs.TeamHealth, 'f', 2, 64), getCellName("K", row): strconv.FormatFloat(rs.Growth, 'f', 2, 64), + getCellName("L", row): strconv.FormatInt(rs.NumWatches, 10), getCellName("M", row): strconv.FormatInt(rs.NumStars, 10), getCellName("N", row): strconv.FormatInt(rs.NumForks, 10), getCellName("O", row): strconv.FormatInt(rs.NumDownloads, 10), - getCellName("R", row): strconv.FormatInt(rs.NumComments, 10), getCellName("S", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("T", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("U", row): strconv.FormatInt(rs.NumVersions, 10), - getCellName("V", row): strconv.FormatInt(rs.NumDevMonths, 10), getCellName("W", row): strconv.FormatInt(rs.DatasetSize, 10), getCellName("X", row): strconv.FormatInt(rs.NumModels, 10), getCellName("Y", row): strconv.FormatInt(rs.NumWikiViews, 10), - getCellName("Z", row): strconv.FormatInt(rs.NumCommits, 10), getCellName("AA", row): strconv.FormatInt(rs.NumIssues, 10), getCellName("AB", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("AC", row): strconv.FormatInt(rs.NumVersions, 10), - getCellName("AD", row): strconv.FormatFloat(float64(rs.IssueFixedRate), 'f', 2, 64), getCellName("AE", row): strconv.FormatInt(rs.NumContributor, 10), getCellName("AF", row): strconv.FormatInt(rs.NumKeyContributor, 10), getCellName("AG", row): strconv.FormatInt(rs.NumContributorsGrowth, 10), - getCellName("AH", row): strconv.FormatInt(rs.NumCommitLinesGrowth, 10), getCellName("AI", row): strconv.FormatInt(rs.NumIssuesGrowth, 10), getCellName("AJ", row): strconv.FormatInt(rs.NumContributorsGrowth, 10), getCellName("AK", row): strconv.FormatInt(rs.NumCommitsGrowth, 10), getCellName("AL", row): strconv.FormatInt(rs.NumCommentsGrowth, 10), getCellName("AM", row): time.Unix(int64(rs.RepoCreatedUnix), 0).Format(CREATE_TIME_FORMAT), + getCellName("P", row): strconv.FormatInt(rs.NumComments, 10), getCellName("Q", row): strconv.FormatInt(rs.NumVisits, 10), getCellName("R", row): strconv.FormatInt(rs.NumClosedIssues, 10), getCellName("S", row): strconv.FormatInt(rs.NumVersions, 10), + getCellName("T", row): strconv.FormatInt(rs.NumDevMonths, 10), getCellName("U", row): strconv.FormatInt(rs.DatasetSize, 10), getCellName("V", row): strconv.FormatInt(rs.NumModels, 10), getCellName("W", row): strconv.FormatInt(rs.NumWikiViews, 10), + getCellName("X", row): strconv.FormatInt(rs.NumCommits, 10), getCellName("Y", row): strconv.FormatInt(rs.NumIssues, 10), getCellName("Z", row): strconv.FormatInt(rs.NumPulls, 10), getCellName("AA", row): strconv.FormatInt(rs.NumVersions, 10), + getCellName("AB", row): strconv.FormatFloat(float64(rs.IssueFixedRate), 'f', 2, 64), getCellName("AC", row): strconv.FormatInt(rs.NumContributor, 10), getCellName("AD", row): strconv.FormatInt(rs.NumKeyContributor, 10), getCellName("AE", row): strconv.FormatInt(rs.NumContributorsGrowth, 10), + getCellName("AF", row): strconv.FormatInt(rs.NumCommitLinesGrowth, 10), getCellName("AG", row): strconv.FormatInt(rs.NumIssuesGrowth, 10), getCellName("AH", row): strconv.FormatInt(rs.NumContributorsGrowth, 10), getCellName("AI", row): strconv.FormatInt(rs.NumCommitsGrowth, 10), getCellName("AJ", row): strconv.FormatInt(rs.NumCommentsGrowth, 10), getCellName("AK", row): getBoolDisplay(rs.IsFork, ctx), getCellName("AL", row): getBoolDisplay(rs.IsMirror, ctx), getCellName("AM", row): time.Unix(int64(rs.RepoCreatedUnix), 0).Format(CREATE_TIME_FORMAT), } } diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 3b1c7a643..96f17b74b 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -281,14 +281,20 @@ func GetAttachment(ctx *context.Context) { } if dataSet != nil { - isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User) - if err != nil { - ctx.Error(http.StatusInternalServerError, "GetUserDataSetPermission", err.Error()) - return - } - if !isPermit { - ctx.Error(http.StatusNotFound) + if !ctx.IsSigned { + ctx.SetCookie("redirect_to", setting.AppSubURL+ctx.Req.URL.RequestURI(), 0, setting.AppSubURL) + ctx.Redirect(setting.AppSubURL + "/user/login") return + } else { + isPermit, err := models.GetUserDataSetPermission(dataSet, ctx.User) + if err != nil { + ctx.Error(http.StatusInternalServerError, "GetUserDataSetPermission", err.Error()) + return + } + if !isPermit { + ctx.Error(http.StatusNotFound) + return + } } } diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 6b7dadde5..0905efd54 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -2,9 +2,11 @@ package repo import ( "bufio" + "code.gitea.io/gitea/modules/timeutil" "encoding/json" "errors" "fmt" + "github.com/unknwon/i18n" "io" "net/http" "os" @@ -45,6 +47,10 @@ var ( benchmarkResourceSpecs *models.ResourceSpecs ) +const BENCHMARK_TYPE_CODE = "repo.cloudbrain.benchmark.types" + +var benchmarkTypesMap = make(map[string]*models.BenchmarkTypes, 0) + var jobNamePattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$`) // MustEnableDataset check if repository enable internal cb @@ -130,12 +136,7 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error { } ctx.Data["benchmark_categories"] = categories.Category - if benchmarkTypes == nil { - if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { - log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) - } - } - ctx.Data["benchmark_types"] = benchmarkTypes.BenchmarkType + ctx.Data["benchmark_types"] = GetBenchmarkTypes(ctx).BenchmarkType if gpuInfos == nil { json.Unmarshal([]byte(setting.GpuTypes), &gpuInfos) @@ -341,13 +342,6 @@ func CloudBrainRestart(ctx *context.Context) { } func CloudBrainBenchMarkShow(ctx *context.Context) { - if benchmarkTypes == nil { - if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { - log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) - ctx.ServerError(err.Error(), err) - return - } - } cloudBrainShow(ctx, tplCloudBrainBenchmarkShow) } @@ -382,6 +376,9 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { task.Status = taskRes.TaskStatuses[0].State task.ContainerID = taskRes.TaskStatuses[0].ContainerID task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP + if task.StartTime == 0 && !taskRes.TaskStatuses[0].StartAt.IsZero() { + task.StartTime = timeutil.TimeStamp(taskRes.TaskStatuses[0].StartAt.Unix()) + } err = models.UpdateJob(task) if err != nil { ctx.Data["error"] = err.Error() @@ -407,14 +404,8 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { task.User = user } - var duration int64 - if task.Status == string(models.JobRunning) { - duration = time.Now().Unix() - int64(task.CreatedUnix) - } else { - duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) - } if task.BenchmarkTypeID > 0 { - for _, benchmarkType := range benchmarkTypes.BenchmarkType { + for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { if task.BenchmarkTypeID == benchmarkType.Id { ctx.Data["BenchmarkTypeName"] = benchmarkType.First for _, benchmarkChildType := range benchmarkType.Second { @@ -427,8 +418,16 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName) { } } } - - ctx.Data["duration"] = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000) + if task.TrainJobDuration == "" { + var duration int64 + if task.Status == string(models.JobRunning) { + duration = time.Now().Unix() - int64(task.CreatedUnix) + } else { + duration = int64(task.UpdatedUnix) - int64(task.CreatedUnix) + } + task.TrainJobDuration = models.ConvertDurationToStr(duration) + } + ctx.Data["duration"] = task.TrainJobDuration ctx.Data["task"] = task ctx.Data["jobName"] = task.JobName ctx.Data["displayJobName"] = task.DisplayJobName @@ -491,6 +490,10 @@ func CloudBrainStop(ctx *context.Context) { } task.Status = string(models.JobStopped) + if task.EndTime == 0 { + task.EndTime = timeutil.TimeStampNow() + } + task.ComputeAndSetDuration() err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err, ctx.Data["msgID"]) @@ -584,6 +587,10 @@ func logErrorAndUpdateJobStatus(err error, taskInfo *models.Cloudbrain) { log.Warn("Failed to stop cloudBrain job:"+taskInfo.JobID, err) } else { taskInfo.Status = string(models.JobStopped) + if taskInfo.EndTime == 0 { + taskInfo.EndTime = timeutil.TimeStampNow() + } + taskInfo.ComputeAndSetDuration() err = models.UpdateJob(taskInfo) if err != nil { log.Warn("UpdateJob failed", err) @@ -955,6 +962,13 @@ func SyncCloudbrainStatus() { task.Status = taskRes.TaskStatuses[0].State if task.Status != string(models.JobWaiting) { task.Duration = time.Now().Unix() - taskRes.TaskStatuses[0].StartAt.Unix() + if task.StartTime == 0 && !taskRes.TaskStatuses[0].StartAt.IsZero() { + task.StartTime = timeutil.TimeStamp(taskRes.TaskStatuses[0].StartAt.Unix()) + } + if task.EndTime == 0 && models.IsCloudBrainOneDebugJobTerminal(task.Status) { + task.EndTime = timeutil.TimeStampNow() + } + task.ComputeAndSetDuration() err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err) @@ -975,6 +989,10 @@ func SyncCloudbrainStatus() { continue } task.Status = string(models.JobStopped) + if task.EndTime == 0 { + task.EndTime = timeutil.TimeStampNow() + } + task.ComputeAndSetDuration() err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err) @@ -993,7 +1011,13 @@ func SyncCloudbrainStatus() { if result != nil { task.Status = result.Status - + if task.StartTime == 0 && result.Lease.CreateTime > 0 { + task.StartTime = timeutil.TimeStamp(result.Lease.CreateTime / 1000) + } + if task.EndTime == 0 && models.IsModelArtsDebugJobTerminal(task.Status) { + task.EndTime = timeutil.TimeStampNow() + } + task.ComputeAndSetDuration() err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err) @@ -1009,14 +1033,15 @@ func SyncCloudbrainStatus() { if result != nil { task.Status = modelarts.TransTrainJobStatus(result.IntStatus) - task.Duration = result.Duration + task.Duration = result.Duration / 1000 task.TrainJobDuration = result.TrainJobDuration - if result.Duration != 0 { - task.TrainJobDuration = util.AddZero(result.Duration/3600000) + ":" + util.AddZero(result.Duration%3600000/60000) + ":" + util.AddZero(result.Duration%60000/1000) - - } else { - task.TrainJobDuration = "00:00:00" + if task.StartTime == 0 && result.StartTime > 0 { + task.StartTime = timeutil.TimeStamp(result.StartTime / 1000) + } + task.TrainJobDuration = models.ConvertDurationToStr(task.Duration) + if task.EndTime == 0 && models.IsTrainJobTerminal(task.Status) && task.StartTime > 0 { + task.EndTime = task.StartTime.Add(task.Duration) } err = models.UpdateJob(task) @@ -1061,26 +1086,22 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { return } - if benchmarkTypes == nil { - if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { - ctx.ServerError("Get BenchmarkTypes faild:", err) - return - } - } - for i, task := range ciTasks { ciTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource - var duration int64 - if task.Status == string(models.JobRunning) { - duration = time.Now().Unix() - int64(task.Cloudbrain.CreatedUnix) - } else { - duration = int64(task.Cloudbrain.UpdatedUnix) - int64(task.Cloudbrain.CreatedUnix) + if ciTasks[i].TrainJobDuration == "" { + var duration int64 + if task.Status == string(models.JobRunning) { + duration = time.Now().Unix() - int64(task.Cloudbrain.CreatedUnix) + } else { + duration = int64(task.Cloudbrain.UpdatedUnix) - int64(task.Cloudbrain.CreatedUnix) + } + ciTasks[i].TrainJobDuration = models.ConvertDurationToStr(duration) } - ciTasks[i].TrainJobDuration = util.AddZero(duration/3600000) + ":" + util.AddZero(duration%3600000/60000) + ":" + util.AddZero(duration%60000/1000) + ciTasks[i].BenchmarkTypeName = "" if task.BenchmarkTypeID > 0 { - for _, benchmarkType := range benchmarkTypes.BenchmarkType { + for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { if task.BenchmarkTypeID == benchmarkType.Id { ciTasks[i].BenchmarkTypeRankLink = benchmarkType.RankLink ciTasks[i].BenchmarkTypeName = benchmarkType.First @@ -1104,15 +1125,8 @@ func GetChildTypes(ctx *context.Context) { benchmarkTypeID := ctx.QueryInt("benchmark_type_id") re := make(map[string]interface{}) for { - if benchmarkTypes == nil { - if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { - log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) - re["errMsg"] = "system error" - break - } - } var isExist bool - for _, benchmarkType := range benchmarkTypes.BenchmarkType { + for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { if benchmarkTypeID == benchmarkType.Id { isExist = true re["child_types"] = benchmarkType.Second @@ -1143,17 +1157,11 @@ func CloudBrainBenchmarkNew(ctx *context.Context) { ctx.HTML(200, tplCloudBrainBenchmarkNew) } -func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (*models.BenchmarkDataset, error) { +func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int, ctx *context.Context) (*models.BenchmarkDataset, error) { var childInfo *models.BenchmarkDataset - if benchmarkTypes == nil { - if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { - log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err) - return childInfo, err - } - } var isExist bool - for _, benchmarkType := range benchmarkTypes.BenchmarkType { + for _, benchmarkType := range GetBenchmarkTypes(ctx).BenchmarkType { if benchmarkType.Id == benchmarkTypeID { for _, childType := range benchmarkType.Second { if childType.Id == benchmarkChildTypeID { @@ -1267,7 +1275,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF return } - childInfo, err := getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID) + childInfo, err := getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID, ctx) if err != nil { log.Error("getBenchmarkAttachment failed:%v", err, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) @@ -1397,3 +1405,17 @@ func BenchmarkDel(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") } } + +func GetBenchmarkTypes(ctx *context.Context) *models.BenchmarkTypes { + var lang = ctx.Locale.Language() + if benchmarkTypesMap[lang] == nil { + var val = i18n.Tr(lang, BENCHMARK_TYPE_CODE) + var tempType *models.BenchmarkTypes + if err := json.Unmarshal([]byte(val), &tempType); err != nil { + log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", val, err, ctx.Data["MsgID"]) + return &models.BenchmarkTypes{} + } + benchmarkTypesMap[lang] = tempType + } + return benchmarkTypesMap[lang] +} diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 51df16002..fa8affc32 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -2,6 +2,7 @@ package repo import ( "archive/zip" + "code.gitea.io/gitea/modules/timeutil" "encoding/json" "errors" "io" @@ -410,6 +411,10 @@ func NotebookManage(ctx *context.Context) { } task.Status = res.Status + if task.EndTime == 0 && models.IsModelArtsDebugJobTerminal(task.Status) { + task.EndTime = timeutil.TimeStampNow() + } + task.ComputeAndSetDuration() err = models.UpdateJob(task) if err != nil { log.Error("UpdateJob(%s) failed:%v", task.JobName, err.Error(), ctx.Data["MsgID"]) diff --git a/templates/admin/cloudbrain/list.tmpl b/templates/admin/cloudbrain/list.tmpl index 9aac97e70..39b2c21de 100644 --- a/templates/admin/cloudbrain/list.tmpl +++ b/templates/admin/cloudbrain/list.tmpl @@ -43,26 +43,26 @@ {{$.i18n.Tr "repo.cloudbrain_status_runtime"}}
- {{$.i18n.Tr "repo.modelarts.computing_resources"}} + {{$.i18n.Tr "repo.modelarts.computing_resources"}}
- {{$.i18n.Tr "repo.cloudbrain_creator"}} + {{$.i18n.Tr "repo.cloudbrain_creator"}}
- {{$.i18n.Tr "repository"}} + {{$.i18n.Tr "repository"}}
- {{.i18n.Tr "admin.cloudbrain.cloudbrain_name"}} + {{.i18n.Tr "admin.cloudbrain.cloudbrain_name"}}
{{$.i18n.Tr "repo.cloudbrain_operate"}}
- - + + {{range .Tasks}} {{if .Repo}}
-
+
{{$JobID := '0'}} {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} @@ -91,8 +91,8 @@ {{end}}
-
- {{.JobType}} +
+ {{.JobType}}
@@ -105,12 +105,12 @@ {{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}
-
- {{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}} +
+ {{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}
- {{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}} + {{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}
@@ -178,7 +178,7 @@ {{$JobID = .JobID}} {{end}}
-
+
{{if eq .JobType "DEBUG"}} @@ -200,8 +200,8 @@ {{end}}
-
- {{.JobType}} +
+ {{.JobType}}
@@ -214,12 +214,12 @@ {{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}
-
- {{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}} +
+ {{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}
- {{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}} + {{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}
@@ -296,18 +296,18 @@
diff --git a/templates/explore/repo_left.tmpl b/templates/explore/repo_left.tmpl index ca6a3b3dd..66c46e1ba 100755 --- a/templates/explore/repo_left.tmpl +++ b/templates/explore/repo_left.tmpl @@ -4,73 +4,73 @@ - 全部领域 + {{.i18n.Tr "explore.all_fields"}} - 大模型 + {{.i18n.Tr "explore.large_model"}} - AI开发工具 + {{.i18n.Tr "explore.ai_development_tools"}} - 计算机视觉 + {{.i18n.Tr "explore.computer_version"}} - 自然语言处理 + {{.i18n.Tr "explore.natural_language_processing"}} - 机器学习 + {{.i18n.Tr "explore.machine_learning"}} - 神经网络 + {{.i18n.Tr "explore.neural_networks"}} - 自动驾驶 + {{.i18n.Tr "explore.autopilot"}} - 机器人 + {{.i18n.Tr "explore.robot"}} - 联邦学习 + {{.i18n.Tr "explore.federated_learning"}} - 数据挖掘 + {{.i18n.Tr "explore.data_mining"}} - RISC-V开发 - + {{.i18n.Tr "explore.RISC-V_development"}} +
-
\ No newline at end of file +
diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index 0e01186b0..b6bb49da9 100755 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -44,13 +44,13 @@ - 热门{{.i18n.Tr "explore.repos"}} + {{.i18n.Tr "explore.hot_repo"}} - 活跃{{.i18n.Tr "explore.repos"}} + {{.i18n.Tr "explore.active_repo"}} {{end}} diff --git a/templates/repo/attachment/edit.tmpl b/templates/repo/attachment/edit.tmpl index b923be77e..c1331fa3a 100644 --- a/templates/repo/attachment/edit.tmpl +++ b/templates/repo/attachment/edit.tmpl @@ -43,8 +43,3 @@
{{template "base/footer" .}} - \ No newline at end of file diff --git a/templates/repo/attachment/upload.tmpl b/templates/repo/attachment/upload.tmpl index d617e07a6..42aac99df 100644 --- a/templates/repo/attachment/upload.tmpl +++ b/templates/repo/attachment/upload.tmpl @@ -71,7 +71,3 @@
{{template "base/footer" .}} - \ No newline at end of file diff --git a/templates/repo/cloudbrain/benchmark/index.tmpl b/templates/repo/cloudbrain/benchmark/index.tmpl index f66b94f20..989e3bfd2 100755 --- a/templates/repo/cloudbrain/benchmark/index.tmpl +++ b/templates/repo/cloudbrain/benchmark/index.tmpl @@ -39,8 +39,8 @@
- 基准测试排行榜 - {{if .Permission.CanWrite $.UnitTypeCloudBrain}} + {{$.i18n.Tr "repo.benchmark_leaderboards"}} + {{if .Permission.CanWrite $.UnitTypeCloudBrain}} {{$.i18n.Tr "repo.modelarts.evaluate_job.new_job"}} {{else}} {{$.i18n.Tr "repo.modelarts.evaluate_job.new_job"}} @@ -50,12 +50,12 @@ {{if eq 0 (len .Tasks)}}
-
未创建过评测任务
+
{{$.i18n.Tr "repo.model_Evaluation_not_created"}}
{{if $.RepoIsEmpty}} -
代码版本:您还没有初始化代码仓库,请先创建代码版本;
+
{{$.i18n.Tr "repo.repo_not_initialized" .RepoLink | Safe}}
{{end}} -
使用说明:可以参考启智AI协作平台小白训练营课程。
+
{{$.i18n.Tr "repo.platform_instructions" | Safe}}
{{else}} @@ -85,21 +85,21 @@ {{$.i18n.Tr "repo.cloudbrain_status_runtime"}}
- {{$.i18n.Tr "repo.modelarts.computing_resources"}} + {{$.i18n.Tr "repo.modelarts.computing_resources"}}
- {{$.i18n.Tr "repo.cloudbrain_creator"}} + {{$.i18n.Tr "repo.cloudbrain_creator"}}
{{$.i18n.Tr "repo.cloudbrain_operate"}}
-
-
+
+ {{range .Tasks}}
- + - - {{end}} + {{end}} - + {{template "base/paginate" .}}
@@ -204,18 +204,18 @@
diff --git a/templates/repo/cloudbrain/benchmark/new.tmpl b/templates/repo/cloudbrain/benchmark/new.tmpl index bcd237f94..e7b1f0a77 100755 --- a/templates/repo/cloudbrain/benchmark/new.tmpl +++ b/templates/repo/cloudbrain/benchmark/new.tmpl @@ -78,8 +78,8 @@
{{.CsrfTokenHtml}} - - + +
@@ -90,7 +90,7 @@
- + + {{range .images}} @@ -136,13 +136,13 @@
- +
- - {{range .benchmark_resource_specs}} - + {{end}}
@@ -150,25 +150,25 @@
- 查看样例 + {{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}
- 查看样例 + {{.i18n.Tr "cloudbrain.view_sample"}}
- +
{{.i18n.Tr "repo.cloudbrain.cancel"}}
- + - +
@@ -217,7 +217,7 @@ setChildType(); } } - + function validate(){ $('.ui.form') .form({ @@ -239,7 +239,7 @@ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" }, - onFailure: function(e){ + onFailure: function(e){ return false; } }) @@ -247,6 +247,6 @@ $('.ui.create_train_job.green.button').click(function(e) { - validate() + validate() }) - \ No newline at end of file + diff --git a/templates/repo/cloudbrain/benchmark/show.tmpl b/templates/repo/cloudbrain/benchmark/show.tmpl index a6c529597..3c8f91528 100755 --- a/templates/repo/cloudbrain/benchmark/show.tmpl +++ b/templates/repo/cloudbrain/benchmark/show.tmpl @@ -82,7 +82,7 @@ vertical-align: inherit; } .ti-text-form-label { - + padding-bottom: 20px; padding-right: 20px; color: #8a8e99; @@ -152,7 +152,7 @@ td, th { opacity: .45 !important; } .pad20{ - + border:0px !important; } .model_file_bread{ @@ -196,14 +196,14 @@ td, th {
- {{TimeSinceUnix1 .CreatedUnix}} - + {{TimeSinceUnix1 .CreatedUnix}} + {{$.i18n.Tr "repo.modelarts.status"}}: {{.Status}} {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}: {{$.duration}} - +
@@ -244,12 +244,12 @@ td, th { - + - {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} + {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} - +
{{TimeSinceUnix1 .CreatedUnix}} @@ -258,9 +258,9 @@ td, th { - {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} + {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} - +
{{$.duration}} @@ -269,9 +269,9 @@ td, th { - 镜像 + 镜像 - +
{{.Image}} @@ -280,30 +280,30 @@ td, th { - 类型 + 类型 - +
{{$.BenchmarkTypeName}}
- - + +
- - + + - + - + - + - + - + - + - + - + --> - + - + - + - + - + - + - + - + - + - + - + - + - + " html += "" html += "" - + } html += "" html += "
训练程序
train.py @@ -314,19 +314,19 @@ td, th {
测试程序
test.py
- {{$.i18n.Tr "repo.modelarts.train_job.description"}} + {{$.i18n.Tr "repo.modelarts.train_job.description"}}
{{.Description}} @@ -336,9 +336,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.standard"}} + {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
{{$.resource_spec}} @@ -348,9 +348,9 @@ td, th {
- 创建者 + 创建者
{{.User.Name}} @@ -359,9 +359,9 @@ td, th {
- 子类型 + 子类型
{{$.BenchmarkChildTypeName}} @@ -373,7 +373,7 @@ td, th {
- +
@@ -386,11 +386,11 @@ td, th {

                             
- + - + - + @@ -400,24 +400,24 @@ td, th {
- - + + {{template "base/footer" .}} @@ -430,7 +430,7 @@ td, th { $(document).ready(function(){ $('.secondary.menu .item').tab(); }); - + let userName let repoPath let jobName @@ -454,5 +454,5 @@ td, th { document.getElementById("mask").style.display = "none" }); } - - \ No newline at end of file + + diff --git a/templates/repo/cloudbrain/new.tmpl b/templates/repo/cloudbrain/new.tmpl index 08cd6144a..5e84857bd 100755 --- a/templates/repo/cloudbrain/new.tmpl +++ b/templates/repo/cloudbrain/new.tmpl @@ -149,12 +149,12 @@
- +
- {{if .is_snn4imagenet_enabled}} @@ -206,9 +206,9 @@ {{template "custom/select_dataset" .}}
- {{range .resource_specs}} - + {{end}}
@@ -258,7 +258,6 @@
{{template "base/footer" .}} diff --git a/templates/repo/datasets/index.tmpl b/templates/repo/datasets/index.tmpl index a6de99749..a38e86525 100755 --- a/templates/repo/datasets/index.tmpl +++ b/templates/repo/datasets/index.tmpl @@ -344,17 +344,3 @@ {{template "base/delete_modal_actions" .}} {{template "base/footer" .}} - \ No newline at end of file diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index e12226e7d..ddcccc926 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -208,7 +208,7 @@ {{template "repo/header" .}} {{template "base/alert" .}} - +
@@ -242,14 +242,14 @@ {{if eq 0 (len .Tasks)}}
-
未创建过调试任务
+
{{$.i18n.Tr "repo.debug_task_not_created"}}
{{if $.RepoIsEmpty}} -
代码版本:您还没有初始化代码仓库,请先创建代码版本
+
{{$.i18n.Tr "repo.repo_not_initialized" .RepoLink | Safe}}
{{end}} -
运行时长:最长不超过4个小时,超过4个小时将自动停止;
-
数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;
-
使用说明:可以参考启智AI协作平台小白训练营课程。
+
{{$.i18n.Tr "repo.debug_task_running_limit"}}
+
{{$.i18n.Tr "repo.dataset_desc"}}
+
{{$.i18n.Tr "repo.platform_instructions" | Safe}}
{{else}} @@ -458,18 +458,18 @@
@@ -478,7 +478,6 @@
{{template "base/footer" .}} \ No newline at end of file + diff --git a/templates/repo/modelarts/inferencejob/show.tmpl b/templates/repo/modelarts/inferencejob/show.tmpl index 4e221acd4..e11919b71 100644 --- a/templates/repo/modelarts/inferencejob/show.tmpl +++ b/templates/repo/modelarts/inferencejob/show.tmpl @@ -82,7 +82,7 @@ vertical-align: inherit; } .ti-text-form-label { - + padding-bottom: 20px; padding-right: 20px; color: #8a8e99; @@ -152,7 +152,7 @@ td, th { opacity: .45 !important; } .pad20{ - + border:0px !important; } .model_file_bread{ @@ -180,12 +180,12 @@ td, th { {{with .task}}
{{$.i18n.Tr "repo.modelarts.run_version"}}
{{.VersionName}} @@ -227,9 +227,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.start_time"}} + {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
{{TimeSinceUnix1 .CreatedUnix}} @@ -238,9 +238,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}} + {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
{{.TrainJobDuration}} @@ -248,23 +248,23 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}} + {{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}
{{.EngineName}}
{{$.i18n.Tr "repo.model.manage.description"}}
{{if .Description}} @@ -279,7 +279,7 @@ td, th {
创建人
{{$.userName}} @@ -288,7 +288,7 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.compute_node"}} + {{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}
@@ -304,19 +304,19 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.infer_job_model"}} + {{$.i18n.Tr "repo.modelarts.infer_job_model"}}
{{.ModelName}}   {{$.i18n.Tr "repo.modelarts.version"}}:{{.ModelVersion}}   - +
- {{$.i18n.Tr "repo.modelarts.infer_job_model_file"}} + {{$.i18n.Tr "repo.modelarts.infer_job_model_file"}}
@@ -328,10 +328,10 @@ td, th {
{{$.i18n.Tr "repo.modelarts.model_label"}}
- + {{if .LabelName}} {{range $.labelName}} {{.}} @@ -342,7 +342,7 @@ td, th {
{{$.i18n.Tr "repo.modelarts.code_version"}} @@ -358,7 +358,7 @@ td, th { {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
{{.BootFile}} @@ -367,9 +367,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.infer_dataset"}} + {{$.i18n.Tr "repo.modelarts.infer_dataset"}}
{{.DatasetName}} @@ -378,9 +378,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}} + {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
{{if .Parameters}} @@ -393,9 +393,9 @@ td, th {
- {{$.i18n.Tr "repo.modelarts.train_job.standard"}} + {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
{{.FlavorName}} @@ -407,10 +407,10 @@ td, th {
- + - +
- +
- +
@@ -434,34 +434,34 @@ td, th {
- +
- + {{end}} - - - - - + + + + +
@@ -493,7 +493,7 @@ function loadLog(version_name){ }); } function logScroll(version_name) { - + let container = document.querySelector(`#log${version_name}`) let scrollTop = container.scrollTop let scrollHeight = container.scrollHeight @@ -506,7 +506,7 @@ function logScroll(version_name) { $(`.message${version_name} #header`).text('您已翻阅至日志底部') $(`.message${version_name}`).css('display', 'block') setTimeout(function(){ - $(`.message${version_name}`).css('display', 'none') + $(`.message${version_name}`).css('display', 'none') }, 1000) }else{ if(end_line===data.EndLine){ @@ -514,9 +514,9 @@ function logScroll(version_name) { } else{ $(`#log${version_name} input[name=end_line]`).val(data.EndLine) - $(`#log${version_name}`).append('
' + data.Content) 
+                    $(`#log${version_name}`).append('
' + data.Content)
                 }
-                
+
             }
         }).fail(function(err) {
             console.log(err);
@@ -529,7 +529,7 @@ function logScroll(version_name) {
                 $(`.message${version_name} #header`).text('您已翻阅至日志顶部')
                 $(`.message${version_name}`).css('display', 'block')
                 setTimeout(function(){
-                    $(`.message${version_name}`).css('display', 'none')     
+                    $(`.message${version_name}`).css('display', 'none')
                 }, 1000)
             }else{
                 $(`#log${version_name} input[name=start_line]`).val(data.StartLine)   //如果变动就改变所对应的值
@@ -557,7 +557,7 @@ function loadModelFile(version_name,parents,filename,init){
     filename = filename || ''
     init = init || ''
     $.get(`/api/v1/repos/${userName}/${repoPath}/modelarts/inference-job/${jobID}/result_list?version_name=${version_name}&parentDir=${parents}`, (data) => {
-            $(`#dir_list${version_name}`).empty() 
+            $(`#dir_list${version_name}`).empty()
             renderDir(data,version_name)
             if(init==="init"){
                 $(`input[name=model${version_name}]`).val("")
@@ -565,7 +565,7 @@ function loadModelFile(version_name,parents,filename,init){
                 $(`#file_breadcrumb${version_name}`).empty()
                 let htmlBread = ""
                 htmlBread += `
result
` - htmlBread += "
/
" + htmlBread += "
/
" $(`#file_breadcrumb${version_name}`).append(htmlBread) }else{ renderBrend(version_name,parents,filename,init) @@ -573,7 +573,7 @@ function loadModelFile(version_name,parents,filename,init){ }).fail(function(err) { console.log(err,version_name); }); - + } function renderBrend(version_name,parents,filename,init){ if(init=="folder"){ @@ -586,9 +586,9 @@ function renderBrend(version_name,parents,filename,init){ }else{ $(`#file_breadcrumb${version_name} .active.section`).replaceWith(`${sectionName}`) } - + htmlBrend += `
${filename}
` - htmlBrend += "
/
" + htmlBrend += "
/
" $(`#file_breadcrumb${version_name}`).append(htmlBrend) $(`input[name=model${version_name}]`).val(parents) $(`input[name=modelback${version_name}]`).val(filename) @@ -599,7 +599,7 @@ function renderBrend(version_name,parents,filename,init){ $(`#file_breadcrumb${version_name} a.section:contains(${filename})`).replaceWith(`
${filename}
`) $(`#file_breadcrumb${version_name} div.section:contains(${filename})`).append("
/
") } - + } function renderDir(data,version_name){ let html="" @@ -638,14 +638,14 @@ function renderDir(data,version_name){ }else{ html += ""+ `${dirs_size}` + "" } - + html += "
" html += "" + data.Dirs[i].ModTime + "" html += "
" @@ -655,4 +655,4 @@ function renderDir(data,version_name){ html += "
" $(`#dir_list${version_name}`).append(html) } - \ No newline at end of file + diff --git a/templates/repo/modelarts/notebook/new.tmpl b/templates/repo/modelarts/notebook/new.tmpl index 3c78874eb..a66690f43 100755 --- a/templates/repo/modelarts/notebook/new.tmpl +++ b/templates/repo/modelarts/notebook/new.tmpl @@ -30,7 +30,7 @@
- +
- +
- - {{range .images}} {{end}}
+<<<<<<< HEAD {{template "custom/select_dataset" .}} +======= + +
+ + + + {{range .attachments}} + + {{end}} + + +
+>>>>>>> V20220328
- +
-->
- +
@@ -108,8 +122,8 @@ form.onsubmit = function(e){ let value_task = $("input[name='display_job_name']").val() - - + + let re = /^[a-z0-9][a-z0-9-_]{1,36}$/ let flag = re.test(value_task) if(!flag){ @@ -118,12 +132,12 @@ $('#messageInfo p').text(str) return false } - + let min_value_task = value_task.toLowerCase() - + $("input[name='display_job_name']").attr("value",min_value_task) document.getElementById("mask").style.display = "block" - + } // 点击按钮后遮罩层显示 // function showmask() { @@ -139,7 +153,6 @@ $('select.dropdown') .dropdown(); - $(function() { $("#cloudbrain_job_type").change(function() { if ($(this).val() == 'BENCHMARK') { @@ -156,5 +169,4 @@ } }); }); - console.log({{.cloudbraintype}}) - \ No newline at end of file + diff --git a/templates/repo/modelarts/trainjob/index.tmpl b/templates/repo/modelarts/trainjob/index.tmpl index ed94c0598..19c6b3841 100755 --- a/templates/repo/modelarts/trainjob/index.tmpl +++ b/templates/repo/modelarts/trainjob/index.tmpl @@ -39,7 +39,7 @@
- {{if .Permission.CanWrite $.UnitTypeCloudBrain}} + {{if .Permission.CanWrite $.UnitTypeCloudBrain}} {{$.i18n.Tr "repo.modelarts.train_job.new_train"}} {{else}} {{$.i18n.Tr "repo.modelarts.train_job.new_train"}} @@ -49,13 +49,13 @@ {{if eq 0 (len .Tasks)}}
-
未创建过训练任务
+
{{$.i18n.Tr "repo.train_task_not_created"}}
{{if $.RepoIsEmpty}} -
代码版本:您还没有初始化代码仓库,请先创建代码版本;
+
{{$.i18n.Tr "repo.repo_not_initialized" .RepoLink | Safe}}
{{end}} -
数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境;
-
使用说明:可以参考启智AI协作平台小白训练营课程。
+
{{$.i18n.Tr "repo.dataset_desc"}}
+
{{$.i18n.Tr "repo.platform_instructions" | Safe}}
{{else}} @@ -85,31 +85,31 @@ {{$.i18n.Tr "repo.cloudbrain_status_runtime"}}
- {{$.i18n.Tr "repo.modelarts.computing_resources"}} + {{$.i18n.Tr "repo.modelarts.computing_resources"}}
- {{$.i18n.Tr "repo.cloudbrain_creator"}} + {{$.i18n.Tr "repo.cloudbrain_creator"}}
{{$.i18n.Tr "repo.cloudbrain_operate"}}
-
-
+ + {{range .Tasks}}
- + -
- {{.VersionCount}} +
+ {{.VersionCount}}
@@ -122,12 +122,12 @@ {{TimeSinceUnix .Cloudbrain.CreatedUnix $.Lang}}
-
- {{.TrainJobDuration}} +
+ {{.TrainJobDuration}}
- {{.ComputeResource}} + {{.ComputeResource}}
@@ -188,21 +188,21 @@
-{{template "base/footer" .}} \ No newline at end of file +{{template "base/footer" .}} diff --git a/templates/repo/modelarts/trainjob/new.tmpl b/templates/repo/modelarts/trainjob/new.tmpl index 0854f487c..afa09cf29 100755 --- a/templates/repo/modelarts/trainjob/new.tmpl +++ b/templates/repo/modelarts/trainjob/new.tmpl @@ -81,9 +81,9 @@
- 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 + {{.i18n.Tr "cloudbrain.job_name_rule"}}
- +
@@ -91,7 +91,7 @@

{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:

- +
@@ -147,22 +147,22 @@ - 查看样例 + {{.i18n.Tr "cloudbrain.view_sample"}}
- {{if $.uuid}} {{end}} {{range .attachments}} - + {{end}} - 数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。 + {{.i18n.Tr "cloudbrain.dataset_path_rule"}}
- +
{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}} @@ -223,24 +223,24 @@
- +
- +
- +
{{.i18n.Tr "repo.cloudbrain.cancel"}}
- + - +
@@ -272,9 +272,9 @@ // 参数增加、删除、修改、保存 function Add_parameter(i){ value = '
' + - '
' + - ' ' + - '
' + + '
' + + ' ' + + '
' + '
' + '' + '
'+ @@ -284,7 +284,7 @@ '' + '
' $(".dynamic.field").append(value) - } + } $('#add_run_para').click(function(){ var len = $(".dynamic.field .two.fields").length @@ -310,7 +310,7 @@ $(this).find('input').each(function(){ parameters.push($(this).text()) }) - + }); $('.ui.parameter.modal') .modal('hide'); @@ -353,9 +353,9 @@ onChange: function(){ if ($('.ui.save.checkbox').checkbox('is checked')){ $('#save_para').removeClass("disabled") - + }else{ - $('#save_para').addClass("disabled") + $('#save_para').addClass("disabled") } } }); @@ -421,7 +421,7 @@ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" }, - onFailure: function(e){ + onFailure: function(e){ return false; } }) @@ -453,6 +453,6 @@ $('.ui.create_train_job.green.button').click(function(e) { get_name() send_run_para() - validate() + validate() }) - \ No newline at end of file + diff --git a/templates/repo/modelarts/trainjob/para_manage.tmpl b/templates/repo/modelarts/trainjob/para_manage.tmpl index e7e48f13b..64e769fa0 100755 --- a/templates/repo/modelarts/trainjob/para_manage.tmpl +++ b/templates/repo/modelarts/trainjob/para_manage.tmpl @@ -2,11 +2,11 @@
{{template "repo/header" .}} -
+
- {{template "repo/modelarts/navbar" .}} + {{template "repo/modelarts/navbar" .}} -
+

{{.i18n.Tr "repo.modelarts.train_job_para_admin"}}

@@ -29,7 +29,7 @@
- +
{{range .Tasks}} @@ -38,12 +38,12 @@ - - + +
{{.Status}}
@@ -59,7 +59,7 @@ 编辑
- +
@@ -69,7 +69,7 @@
- +
{{end}} {{template "base/paginate" .}} @@ -78,7 +78,7 @@
-
+
@@ -86,18 +86,18 @@
@@ -105,7 +105,7 @@
{{template "base/footer" .}} - \ No newline at end of file + diff --git a/templates/repo/modelarts/trainjob/version_new.tmpl b/templates/repo/modelarts/trainjob/version_new.tmpl index 0af0778ba..b7fcd36ad 100644 --- a/templates/repo/modelarts/trainjob/version_new.tmpl +++ b/templates/repo/modelarts/trainjob/version_new.tmpl @@ -97,7 +97,7 @@ {{end}} - +
@@ -105,7 +105,7 @@

{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:

- +
@@ -119,7 +119,7 @@ {{end}} {{end}} - +
@@ -160,24 +160,24 @@ - 查看样例 + {{.i18n.Tr "cloudbrain.view_sample"}}
- {{if .dataset_name}} {{end}} {{range .attachments}} - + {{if ne $.uuid .UUID}} {{end}} {{end}} - 数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。 + {{.i18n.Tr "cloudbrain.dataset_path_rule"}}
- +
{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}} @@ -243,24 +243,24 @@
- +
- +
- +
{{.i18n.Tr "repo.cloudbrain.cancel"}}
- + - + @@ -298,9 +298,9 @@ // 参数增加、删除、修改、保存 function Add_parameter(i){ value = '
' + - '
' + - ' ' + - '
' + + '
' + + ' ' + + '
' + '
' + '' + '
'+ @@ -310,7 +310,7 @@ '' + '
' $(".dynamic.field").append(value) - } + } $('#add_run_para').click(function(){ var len = $(".dynamic.field .two.fields").length @@ -336,7 +336,7 @@ $(this).find('input').each(function(){ parameters.push($(this).text()) }) - + }); $('.ui.parameter.modal') .modal('hide'); @@ -379,9 +379,9 @@ onChange: function(){ if ($('.ui.save.checkbox').checkbox('is checked')){ $('#save_para').removeClass("disabled") - + }else{ - $('#save_para').addClass("disabled") + $('#save_para').addClass("disabled") } } }); @@ -535,7 +535,7 @@ // $('.ui.page.dimmer').dimmer('show') document.getElementById("mask").style.display = "block" }, - onFailure: function(e){ + onFailure: function(e){ return false; } }) @@ -569,6 +569,6 @@ $('.ui.create_train_job.green.button').click(function(e) { get_name() send_run_para() - validate() + validate() }) - \ No newline at end of file + diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index 66d66ef16..73baa6c93 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -38,7 +38,7 @@
训练任务:您还没创建过训练任务,请先创建训练任务
{{end}}
使用说明:可以参考启智AI协作平台小白训练营课程。
- +
@@ -79,10 +79,10 @@
- 取消操作 + {{.i18n.Tr "cloudbrain.operate_cancel"}}
- 确定操作 + {{.i18n.Tr "cloudbrain.operate_confirm"}}
@@ -99,7 +99,7 @@ -
+
@@ -149,8 +149,8 @@
- - + + @@ -179,7 +179,7 @@ $("#job-name").empty() createModelName() loadTrainList() - + }, onHide:function(){ document.getElementById("formId").reset(); @@ -188,7 +188,7 @@ $('.ui.dimmer').css({"background-color":""}) $('.ui.error.message').text() $('.ui.error.message').css('display','none') - + } }) .modal('show') @@ -221,7 +221,7 @@ } function loadTrainList(){ $.get(`${repolink}/modelmanage/query_train_job?repoId=${repoId}`, (data) => { - console.log(data) + const n_length = data.length let train_html='' for (let i=0;i diff --git a/web_src/js/components/ProAnalysis.vue b/web_src/js/components/ProAnalysis.vue index 88ea67d94..d92eb6df9 100755 --- a/web_src/js/components/ProAnalysis.vue +++ b/web_src/js/components/ProAnalysis.vue @@ -148,6 +148,31 @@ prop="contributor" label="贡献者数" align="center"> + + + + + + + + + @@ -1140,6 +1165,17 @@ return " " +value.user+ "" } + }, + transformTimestamp(timestamp){ + let a = new Date(timestamp*1000); + const date = new Date(a); + const Y = date.getFullYear() + '/'; + const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '/'; + const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '; + const h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'; + const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()); + const dateString = Y + M + D + h + m ;//+ s; + return dateString; }, }, diff --git a/web_src/js/features/cloudrbanin.js b/web_src/js/features/cloudrbanin.js index d069c6840..216226e14 100644 --- a/web_src/js/features/cloudrbanin.js +++ b/web_src/js/features/cloudrbanin.js @@ -1,4 +1,6 @@ export default async function initCloudrain() { + let debug_button = $('.cloudbrain_debug').data('debug') + let debug_again_button = $('.cloudbrain_debug').data('debug-again') let timeid = window.setInterval(loadJobStatus, 15000); $(document).ready(loadJobStatus); function loadJobStatus() { @@ -24,7 +26,7 @@ export default async function initCloudrain() { finalState.includes(status) && $('#' + ID + '-stop').removeClass('blue').addClass('disabled') } if(status==="RUNNING"){ - $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text('调试').css("margin","0 1rem") + $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text(debug_button).css("margin","0 1rem") $('#model-image-'+ID).removeClass('disabled').addClass('blue') } if(status!=="RUNNING"){ @@ -36,7 +38,7 @@ export default async function initCloudrain() { $('#ai-debug-'+ID).removeClass('blue').addClass('disabled') } if(['STOPPED','FAILED','START_FAILED','CREATE_FAILED','SUCCEEDED'].includes(status)){ - $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text('再次调试').css("margin","0") + $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text(debug_again_button).css("margin","0") } if(["RUNNING","WAITING"].includes(status)){ $('#ai-stop-'+ID).removeClass('disabled').addClass('blue') @@ -114,7 +116,7 @@ export default async function initCloudrain() { $('#' + ID+'-icon').removeClass().addClass(res.status) $('#' + ID+ '-text').text(res.status) if(res.status==="STOPPED"){ - $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text("再次调试").css("margin","0") + $('#ai-debug-'+ID).removeClass('disabled').addClass('blue').text(debug_again_button).css("margin","0") $('#ai-image-'+ID).removeClass('blue').addClass('disabled') $('#ai-model-debug-'+ID).removeClass('blue').addClass('disabled') $('#ai-delete-'+ID).removeClass('disabled').addClass('blue') @@ -214,7 +216,7 @@ export default async function initCloudrain() { $('#' + ID+ '-text').text(res.status) $('#ai-debug-'+ID).removeClass('blue').addClass('disabled') $('#ai-delete-'+ID).removeClass('blue').addClass('disabled') - $('#ai-debug-'+ID).text("调试").css("margin","0 1rem") + $('#ai-debug-'+ID).text(debug_button).css("margin","0 1rem") } }else{ $('.alert').html(res.error_msg).removeClass('alert-success').addClass('alert-danger').show().delay(2000).fadeOut(); diff --git a/web_src/js/index.js b/web_src/js/index.js index 30143bfc1..5602dad90 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3667,7 +3667,6 @@ function initVueDataset() { let link=$('#square-link').data('link') let repolink = $('.dataset-repolink').data('repolink') let cloudbrainType = $('.dataset-repolink').data('cloudranin-type') - console.log("-------",repolink,cloudbrainType) const clearBtn = document.getElementsByClassName("clear_dataset_value"); const params = new URLSearchParams(location.search) for (let i = 0; i < clearBtn.length; i++) { @@ -3699,7 +3698,7 @@ function initVueDataset() { ruleForm.id = $this.data('edit-id')|| '' ruleForm._csrf = csrf } - console.log(ruleForm) + const starItems = [] const starActives = [] $('#datasets-square-range-value').find('.item').each(function(){ @@ -3852,12 +3851,10 @@ function initVueDataset() { this.descfile = dataset_file_desc this.repolink = repolink this.cloudbrainType = cloudbrainType - console.log(this.starItems,this.starActives,this.zipStatus) }, methods:{ handleCurrentChange(val) { this.page = val - console.log(val) switch(this.activeName){ case 'first': this.getCurrentRepoDataset(this.repolink,this.cloudbrainType) @@ -3908,7 +3905,6 @@ function initVueDataset() { } } else{ - console.log(attachment) location.href = `${AppSubUrl}${attachment}/datasets` } @@ -3918,7 +3914,6 @@ function initVueDataset() { location.href = `${AppSubUrl}${repolink}/datasets/attachments/upload?datasetId=${datsetId}` }, gotoDataset(datsetUrl){ - console.log(datsetUrl) location.href = datsetUrl }, gotoAnnotate(repolink,uuid,type){ @@ -3933,7 +3928,6 @@ function initVueDataset() { setPrivate(uuid,privateFlag,index){ const params = {_csrf:csrf,file:uuid,is_private:privateFlag} this.$axios.post('/attachments/private',this.qs.stringify(params)).then((res)=>{ - console.log(res) this.$set(this.privates,index,privateFlag) }).catch(error=>{ console.log(error) @@ -3947,7 +3941,6 @@ function initVueDataset() { closable: false, onApprove() { _this.$axios.post('/attachments/delete',_this.qs.stringify(params)).then((res)=>{ - console.log(res) // $('#'+uuid).hide() location.reload() }).catch(error=>{ @@ -3970,9 +3963,7 @@ function initVueDataset() { // }, editDataset(formName,id){ let _this = this - console.log(this.url) this.url = this.url.split(`/${id}`)[0] - console.log(this.url) this.$refs[formName].validate((valid)=>{ if(valid){ document.getElementById("mask").style.display = "block" @@ -3995,10 +3986,8 @@ function initVueDataset() { }, editDatasetFile(id,backurl){ - console.log(id,backurl) let url = '/attachments/edit' const params={id:id,description:this.descfile,_csrf:csrf} - console.log(this.qs.stringify(params)) // document.getElementById("mask").style.display = "block" this.$axios.post(url,this.qs.stringify(params)).then((res)=>{ if(res.data.Code===0){ @@ -4011,11 +4000,9 @@ function initVueDataset() { }) }, postStar(id,link){ - console.log(id,link) if(this.star_active){ let url = link+'/'+ id + '/unstar' this.$axios.put(url).then((res)=>{ - console.log(res) if(res.data.Code===0){ this.star_active = false this.num_stars = this.num_stars -1 @@ -4024,7 +4011,6 @@ function initVueDataset() { }else{ let url = link+'/'+ id + '/star' this.$axios.put(url).then((res)=>{ - console.log(res) if(res.data.Code===0){ this.star_active = true this.num_stars = this.num_stars + 1 @@ -4033,12 +4019,9 @@ function initVueDataset() { } }, postSquareStar(id,link,index){ - console.log(id,link,index) - console.log(this.starItems,this.starActives) if(this.starActives[index]){ let url = link+'/'+ id + '/unstar' this.$axios.put(url).then((res)=>{ - console.log(res) if(res.data.Code===0){ this.$set(this.starActives,index,false) this.$set(this.starItems,index,this.starItems[index]-1) @@ -4047,7 +4030,6 @@ function initVueDataset() { }else{ let url = link+'/'+ id + '/star' this.$axios.put(url).then((res)=>{ - console.log(res) if(res.data.Code===0){ this.$set(this.starActives,index,true) this.$set(this.starItems,index,this.starItems[index]+1) @@ -4058,18 +4040,14 @@ function initVueDataset() { }, getTypeList(){ const params = new URLSearchParams(window.location.search) - console.log("init---",window.location.search && params.has('type')) if( window.location.search && params.has('type')){ if(params.get('type')==0){ - console.log(0) this.datasetType = '0' } if(params.get('type')==1){ - console.log(1) this.datasetType = '1' } if(params.get('type')==-1){ - console.log(-1) this.datasetType = '-1' } }else { @@ -4077,13 +4055,10 @@ function initVueDataset() { } }, changeDatasetType(val){ - console.log("---change",val) const searchParams = new URLSearchParams(window.location.search) - console.log("-----change--",window.location.search,) if (!window.location.search) { window.location.href = window.location.href + '?type='+val } else if (searchParams.has('type')) { - console.log("=========",window.location.href.replace(/type=([0-9]|-[0-9])/g,'type='+val)) window.location.href = window.location.href.replace(/type=([0-9]|-[0-9])/g,'type='+val) } else { window.location.href=window.location.href+'&type='+val @@ -4096,7 +4071,6 @@ function initVueDataset() { }, handleClick(repoLink, tabName,type) { - console.log(repoLink, tabName,type) if(tabName=="first"){ this.page=1 this.searchDataItem='' @@ -4120,7 +4094,6 @@ function initVueDataset() { } }, polling (checkStatuDataset,repoLink) { - console.log("===polling===checkStatuDataset===",checkStatuDataset,repoLink) this.timer = window.setInterval(() => { setTimeout(() => { this.getDatasetStatus(checkStatuDataset,repoLink) @@ -4132,18 +4105,13 @@ function initVueDataset() { getDatasetStatus(checkStatuDataset,repoLink){ const getmap = checkStatuDataset.map((item)=>{ let url = `${AppSubUrl}${repolink}/datasets/status/${item.UUID}` - console.log("map item",item,url) return this.$axios.get(url) }) - console.log(getmap) this.$axios.all(getmap) .then((res)=>{ - console.log(res,this.timer) let flag = res.some((item)=>{ - console.log(item.data) return item.data.AttachmentStatus == 1 }) - console.log(flag) flag && clearInterval(this.timer) flag && this.refreshStatusDataset() @@ -4152,7 +4120,6 @@ function initVueDataset() { }, refreshStatusDataset(){ - console.log("refresh") switch(this.activeName){ case 'first': this.getCurrentRepoDataset(this.repolink,this.cloudbrainType) @@ -4179,12 +4146,8 @@ function initVueDataset() { q:this.searchDataItem } }).then((res)=>{ - console.log(res) - console.log(JSON.parse(res.data.data)) - console.log(res.data.count) this.currentRepoDataset = JSON.parse(res.data.data) const checkStatuDataset = this.currentRepoDataset.filter(item=>item.DecompressState===2) - console.log("=========checkStatuDataset",checkStatuDataset,repoLink) if(checkStatuDataset.length>0){ this.polling(checkStatuDataset,repoLink) } @@ -4203,11 +4166,8 @@ function initVueDataset() { q:this.searchDataItem } }).then((res)=>{ - console.log(res) - console.log(JSON.parse(res.data.data)) this.myDataset = JSON.parse(res.data.data) const checkStatuDataset = this.myDataset.filter(item=>item.DecompressState===2) - console.log("=========checkStatuDataset",checkStatuDataset,repoLink) if(checkStatuDataset.length>0){ this.polling(checkStatuDataset,repoLink) } @@ -4227,11 +4187,8 @@ function initVueDataset() { q:this.searchDataItem } }).then((res)=>{ - console.log(res) - console.log(JSON.parse(res.data.data)) this.publicDataset = JSON.parse(res.data.data) const checkStatuDataset = this.publicDataset.filter(item=>item.DecompressState===2) - console.log("=========checkStatuDataset",checkStatuDataset,repoLink) if(checkStatuDataset.length>0){ this.polling(checkStatuDataset,repoLink) } @@ -4251,11 +4208,8 @@ function initVueDataset() { q:this.searchDataItem } }).then((res)=>{ - console.log(res) - console.log(JSON.parse(res.data.data)) this.myFavoriteDataset = JSON.parse(res.data.data) const checkStatuDataset = this.myFavoriteDataset.filter(item=>item.DecompressState===2) - console.log("=========checkStatuDataset",checkStatuDataset,repoLink) if(checkStatuDataset.length>0){ this.polling(checkStatuDataset,repoLink) } @@ -4265,13 +4219,11 @@ function initVueDataset() { }, selectDataset(uuid,name){ - console.log(uuid) this.dataset_uuid = uuid this.dataset_name = name this.dialogVisible = false }, searchDataset(){ - console.log("click search") switch(this.activeName){ case 'first': this.page = 1