Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/1888 Reviewed-by: wangjr <wangjr@pcl.ac.cn> Reviewed-by: lewis <747342561@qq.com>tags/v1.22.4.1^2
| @@ -326,6 +326,7 @@ type CloudbrainsOptions struct { | |||
| IsLatestVersion string | |||
| JobTypeNot bool | |||
| NeedRepoInfo bool | |||
| RepoIDList []int64 | |||
| } | |||
| type TaskPod struct { | |||
| @@ -1206,6 +1207,12 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
| ) | |||
| } | |||
| } | |||
| if len(opts.RepoIDList) > 0 { | |||
| cond = cond.And( | |||
| builder.In("cloudbrain.repo_id", opts.RepoIDList), | |||
| ) | |||
| } | |||
| var count int64 | |||
| var err error | |||
| @@ -955,6 +955,8 @@ images.delete_task = Delete image | |||
| images.task_delete_confirm = Are you sure you want to delete this image? Once this image is deleted, it cannot be recovered. | |||
| cloudbrain=Cloudbrain | |||
| cloudbrain.task = Cloudbrain Task | |||
| cloudbrain.search = Seach Task Name | |||
| cloudbrain.new=New cloudbrain | |||
| cloudbrain.desc=Cloudbrain | |||
| cloudbrain.cancel=Cancel | |||
| @@ -2972,3 +2974,11 @@ gpu_num = GPU | |||
| cpu_num = CPU | |||
| memory = Memory | |||
| shared_memory = Shared Memory | |||
| DEBUG = DEBUG | |||
| SNN4IMAGENET = SNN4IMAGENET | |||
| BRAINSCORE = BRAINSCORE | |||
| TRAIN = TRAIN | |||
| INFERENCE = INFERENCE | |||
| BENCHMARK = BENCHMARK | |||
| @@ -955,6 +955,8 @@ images.delete_task = 删除镜像 | |||
| images.task_delete_confirm = 你确认删除该镜像么?此镜像一旦删除不可恢复。 | |||
| cloudbrain=云脑 | |||
| cloudbrain.task = 云脑任务 | |||
| cloudbrain.search = 搜索任务名称 | |||
| cloudbrain.new=新建任务 | |||
| cloudbrain.desc=云脑功能 | |||
| cloudbrain.cancel=取消 | |||
| @@ -2982,3 +2984,10 @@ cpu_num = CPU数 | |||
| memory = 内存 | |||
| shared_memory = 共享内存 | |||
| DEBUG = 调试任务 | |||
| SNN4IMAGENET = 调试任务-脉冲神经网络图片分类测评 | |||
| BRAINSCORE = 调试任务-神经相似性测评 | |||
| TRAIN = 训练任务 | |||
| INFERENCE = 推理任务 | |||
| BENCHMARK = 评测任务 | |||
| @@ -912,8 +912,11 @@ func CloudBrainDel(ctx *context.Context) { | |||
| } | |||
| var isAdminPage = ctx.Query("isadminpage") | |||
| var isHomePage = ctx.Query("ishomepage") | |||
| if ctx.IsUserSiteAdmin() && isAdminPage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") | |||
| } else if isHomePage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/cloudbrains") | |||
| } else { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) | |||
| } | |||
| @@ -1925,8 +1928,11 @@ func BenchmarkDel(ctx *context.Context) { | |||
| } | |||
| var isAdminPage = ctx.Query("isadminpage") | |||
| var isHomePage = ctx.Query("ishomepage") | |||
| if ctx.IsUserSiteAdmin() && isAdminPage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") | |||
| } else if isHomePage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/cloudbrains") | |||
| } else { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") | |||
| } | |||
| @@ -1979,8 +1985,11 @@ func CloudBrainTrainJobDel(ctx *context.Context) { | |||
| } | |||
| var isAdminPage = ctx.Query("isadminpage") | |||
| var isHomePage = ctx.Query("ishomepage") | |||
| if ctx.IsUserSiteAdmin() && isAdminPage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") | |||
| } else if isHomePage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/cloudbrains") | |||
| } else { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job?listType=" + listType) | |||
| } | |||
| @@ -534,8 +534,11 @@ func NotebookDel(ctx *context.Context) { | |||
| } | |||
| var isAdminPage = ctx.Query("isadminpage") | |||
| var isHomePage = ctx.Query("ishomepage") | |||
| if ctx.IsUserSiteAdmin() && isAdminPage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") | |||
| } else if isHomePage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/cloudbrains") | |||
| } else { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/debugjob?debugListType=" + listType) | |||
| } | |||
| @@ -1689,8 +1692,11 @@ func TrainJobDel(ctx *context.Context) { | |||
| } | |||
| var isAdminPage = ctx.Query("isadminpage") | |||
| var isHomePage = ctx.Query("ishomepage") | |||
| if ctx.IsUserSiteAdmin() && isAdminPage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/admin" + "/cloudbrains") | |||
| } else if isHomePage == "true" { | |||
| ctx.Redirect(setting.AppSubURL + "/cloudbrains") | |||
| } else { | |||
| ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/modelarts/train-job?listType=" + listType) | |||
| } | |||
| @@ -349,6 +349,7 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
| Post(bindIgnErr(auth.InstallForm{}), routers.InstallPost) | |||
| m.Get("/^:type(issues|pulls)$", reqSignIn, user.Issues) | |||
| m.Get("/milestones", reqSignIn, reqMilestonesDashboardPageEnabled, user.Milestones) | |||
| m.Get("/cloudbrains", reqSignIn, user.Cloudbrains) | |||
| // ***** START: User ***** | |||
| m.Group("/user", func() { | |||
| @@ -20,6 +20,7 @@ import ( | |||
| issue_indexer "code.gitea.io/gitea/modules/indexer/issues" | |||
| "code.gitea.io/gitea/modules/log" | |||
| "code.gitea.io/gitea/modules/markup/markdown" | |||
| "code.gitea.io/gitea/modules/modelarts" | |||
| "code.gitea.io/gitea/modules/setting" | |||
| "code.gitea.io/gitea/modules/util" | |||
| issue_service "code.gitea.io/gitea/services/issue" | |||
| @@ -31,10 +32,11 @@ import ( | |||
| ) | |||
| const ( | |||
| tplDashboard base.TplName = "user/dashboard/dashboard" | |||
| tplIssues base.TplName = "user/dashboard/issues" | |||
| tplMilestones base.TplName = "user/dashboard/milestones" | |||
| tplProfile base.TplName = "user/profile" | |||
| tplDashboard base.TplName = "user/dashboard/dashboard" | |||
| tplIssues base.TplName = "user/dashboard/issues" | |||
| tplMilestones base.TplName = "user/dashboard/milestones" | |||
| tplProfile base.TplName = "user/profile" | |||
| tplCloudbrains base.TplName = "user/dashboard/cloudbrains" | |||
| ) | |||
| // getDashboardContextUser finds out dashboard is viewing as which context user. | |||
| @@ -751,3 +753,111 @@ func Email2User(ctx *context.Context) { | |||
| } | |||
| ctx.Redirect(setting.AppSubURL + "/user/" + u.Name) | |||
| } | |||
| func Cloudbrains(ctx *context.Context) { | |||
| ctx.Data["Title"] = ctx.Tr("user.cloudbrains") | |||
| listType := ctx.Query("listType") | |||
| jobType := ctx.Query("jobType") | |||
| jobStatus := ctx.Query("jobStatus") | |||
| ctx.Data["ListType"] = listType | |||
| ctx.Data["JobType"] = jobType | |||
| ctx.Data["JobStatus"] = jobStatus | |||
| page := ctx.QueryInt("page") | |||
| if page <= 0 { | |||
| page = 1 | |||
| } | |||
| debugType := models.TypeCloudBrainAll | |||
| if listType == models.GPUResource { | |||
| debugType = models.TypeCloudBrainOne | |||
| } else if listType == models.NPUResource { | |||
| debugType = models.TypeCloudBrainTwo | |||
| } | |||
| var jobTypes []string | |||
| jobTypeNot := false | |||
| if jobType == string(models.JobTypeDebug) { | |||
| jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) | |||
| } else if jobType != "all" && jobType != "" { | |||
| jobTypes = append(jobTypes, jobType) | |||
| } | |||
| var jobStatuses []string | |||
| jobStatusNot := false | |||
| if jobStatus == "other" { | |||
| jobStatusNot = true | |||
| jobStatuses = append(jobStatuses, string(models.ModelArtsTrainJobWaiting), string(models.ModelArtsTrainJobFailed), string(models.ModelArtsRunning), string(models.ModelArtsTrainJobCompleted), | |||
| string(models.ModelArtsStarting), string(models.ModelArtsRestarting), string(models.ModelArtsStartFailed), | |||
| string(models.ModelArtsStopping), string(models.ModelArtsStopped), string(models.JobSucceeded)) | |||
| } else if jobStatus != "all" && jobStatus != "" { | |||
| jobStatuses = append(jobStatuses, jobStatus) | |||
| } | |||
| keyword := strings.Trim(ctx.Query("q"), " ") | |||
| ctxUser := getDashboardContextUser(ctx) | |||
| if ctx.Written() { | |||
| return | |||
| } | |||
| repos, _, err := models.SearchRepository(&models.SearchRepoOptions{ | |||
| Actor: ctx.User, | |||
| OwnerID: ctxUser.ID, | |||
| }) | |||
| if err != nil { | |||
| ctx.ServerError("SearchRepository", err) | |||
| return | |||
| } | |||
| var repoIDList []int64 | |||
| for i, _ := range repos { | |||
| repoIDList = append(repoIDList, repos[i].ID) | |||
| } | |||
| ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ | |||
| ListOptions: models.ListOptions{ | |||
| Page: page, | |||
| PageSize: setting.UI.IssuePagingNum, | |||
| }, | |||
| Keyword: keyword, | |||
| UserID: ctxUser.ID, | |||
| Type: debugType, | |||
| JobTypeNot: jobTypeNot, | |||
| JobStatusNot: jobStatusNot, | |||
| JobStatus: jobStatuses, | |||
| JobTypes: jobTypes, | |||
| NeedRepoInfo: true, | |||
| IsLatestVersion: modelarts.IsLatestVersion, | |||
| RepoIDList: repoIDList, | |||
| }) | |||
| if err != nil { | |||
| ctx.ServerError("Get job failed:", err) | |||
| return | |||
| } | |||
| for i, task := range ciTasks { | |||
| ciTasks[i].CanDebug = true | |||
| ciTasks[i].CanDel = true | |||
| ciTasks[i].Cloudbrain.ComputeResource = task.ComputeResource | |||
| } | |||
| pager := context.NewPagination(int(count), setting.UI.IssuePagingNum, page, getTotalPage(count, setting.UI.IssuePagingNum)) | |||
| pager.SetDefaultParams(ctx) | |||
| pager.AddParam(ctx, "listType", "ListType") | |||
| ctx.Data["Page"] = pager | |||
| ctx.Data["PageIsUserCloudBrain"] = true | |||
| ctx.Data["Tasks"] = ciTasks | |||
| ctx.Data["CanCreate"] = true | |||
| ctx.Data["Keyword"] = keyword | |||
| ctx.HTML(200, tplCloudbrains) | |||
| } | |||
| func getTotalPage(total int64, pageSize int) int { | |||
| another := 0 | |||
| if int(total)%pageSize != 0 { | |||
| another = 1 | |||
| } | |||
| return int(total)/pageSize + another | |||
| } | |||
| @@ -12,6 +12,7 @@ | |||
| <!-- 提示框 --> | |||
| <div class="alert"></div> | |||
| <div class="admin user"> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" data-debug-again="{{$.i18n.Tr "repo.debug_again"}}"></div> | |||
| {{template "admin/navbar" .}} | |||
| <div class="ui container" style="width: 80%;"> | |||
| {{template "base/alert" .}} | |||
| @@ -0,0 +1,66 @@ | |||
| <style> | |||
| .ui.green.button, .ui.green.buttons .button{ | |||
| background-color: #5BB973; | |||
| } | |||
| </style> | |||
| <div class="repos--seach"> | |||
| <div class="ui container"> | |||
| <div class="ui two column centered grid"> | |||
| <form class="fourteen wide mobile ten wide tablet ten wide computer column ui form ignore-dirty" style="margin-top:1.2rem"> | |||
| <div class="ui fluid action input"> | |||
| <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.cloudbrain.search"}}..." autofocus> | |||
| <button class="ui green button">{{.i18n.Tr "explore.search"}}</button> | |||
| </div> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <div class="ui container" style="width: 80%;"> | |||
| <div class="ui grid"> | |||
| <div class="row"> | |||
| <div class="ui {{if $.PageIsUserCloudBrain}}sixteen{{else}}six{{end}} wide column" style="margin: 1rem 0;" id="adminCloud"> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| <div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "admin.cloudbrain.all_task_types"}}</div> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu"> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value='{{.i18n.Tr "admin.cloudbrain.all_task_types"}}'>{{.i18n.Tr "admin.cloudbrain.all_task_types"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=DEBUG&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="DEBUG">{{.i18n.Tr "cloudbrain.DEBUG"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=TRAIN&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="TRAIN">{{.i18n.Tr "cloudbrain.TRAIN"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=INFERENCE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="INFERENCE">{{.i18n.Tr "cloudbrain.INFERENCE"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BENCHMARK&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.BENCHMARK"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.SNN4IMAGENET"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}" data-value="BENCHMARK">{{.i18n.Tr "cloudbrain.BRAINSCORE"}}</a> | |||
| </div> | |||
| </div> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| <div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}</div> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu"> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType=&jobStatus={{$.JobStatus}}" data-value='{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}'>{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType=CPU/GPU&jobStatus={{$.JobStatus}}" data-value="CPU/GPU">CPU/GPU</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType=NPU&jobStatus={{$.JobStatus}}" data-value="NPU">NPU</a> | |||
| </div> | |||
| </div> | |||
| <div class="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;"> | |||
| <div class="default text" style="color: rgba(0,0,0,.87);">{{.i18n.Tr "admin.cloudbrain.all_status"}}</div> | |||
| <i class="dropdown icon"></i> | |||
| <div class="menu"> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=" data-value='{{.i18n.Tr "admin.cloudbrain.all_status"}}'>{{.i18n.Tr "admin.cloudbrain.all_status"}}</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STARTING" data-value="STARTING">STARTING</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RUNNING" data-value="RUNNING">RUNNING</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=RESTARTING" data-value="RESTARTING">RESTARTING </a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=START_FAILED" data-value="START_FAILED">START_FAILED</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPING" data-value="STOPPING">STOPPING</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=STOPPED" data-value="STOPPED">STOPPED</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=WAITING" data-value="WAITING">WAITING</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=COMPLETED" data-value="COMPLETED">COMPLETED</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=SUCCEEDED" data-value="SUCCEEDED">SUCCEEDED</a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=FAILED" data-value="FAILED">FAILED </a> | |||
| <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType={{$.JobType}}&listType={{$.ListType}}&jobStatus=other" data-value="OTHER">OTHER</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -15,7 +15,7 @@ | |||
| {{.i18n.Tr "admin.datasets"}} | |||
| </a> | |||
| <a class="{{if .PageIsAdminCloudBrains}}active{{end}} item" href="{{AppSubUrl}}/admin/cloudbrains"> | |||
| 云脑任务 | |||
| {{.i18n.Tr "repo.cloudbrain.task"}} | |||
| </a> | |||
| <a class="{{if .PageIsAdminImages}}active{{end}} item" href="{{AppSubUrl}}/admin/images"> | |||
| {{.i18n.Tr "explore.images"}} | |||
| @@ -23,10 +23,11 @@ | |||
| {{.i18n.Tr "index"}} <i class="dropdown icon mglf" ></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -53,10 +54,11 @@ | |||
| {{.i18n.Tr "home"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -23,10 +23,11 @@ | |||
| {{.i18n.Tr "index"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -52,10 +53,11 @@ | |||
| {{.i18n.Tr "home"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -15,10 +15,11 @@ | |||
| {{.i18n.Tr "index"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -44,10 +45,11 @@ | |||
| {{.i18n.Tr "home"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000; white-space: nowrap;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -24,10 +24,11 @@ | |||
| {{.i18n.Tr "index"}} <i class="dropdown icon mglf"></i> | |||
| </a> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px;min-width: max-content;"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/issues">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000;white-space: nowrap;" class=" item" href="{{AppSubUrl}}/pulls">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/milestones">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -57,7 +58,8 @@ | |||
| <div class="dropdown-content" style="min-width: 110px;border-radius:4px"> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "issues"}}</a> | |||
| <a style="border: none;color: #000;white-space: nowrap;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "pull_requests"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/user/login">{{.i18n.Tr "milestones"}}</a> | |||
| <a style="border: none;color: #000;" class=" item" href="{{AppSubUrl}}/cloudbrains">{{.i18n.Tr "repo.cloudbrain.task"}}</a> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -102,7 +102,7 @@ | |||
| <!-- 任务名 --> | |||
| <div class="three wide column padding0"> | |||
| <a class="title" href="{{$.Link}}/{{.Cloudbrain.ID}}" title="{{.Cloudbrain.ID}}" style="font-size: 14px;"> | |||
| <a class="title" href="{{$.Link}}/{{.Cloudbrain.ID}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| </div> | |||
| @@ -177,14 +177,6 @@ | |||
| </div> | |||
| </div> | |||
| {{end}} | |||
| <!-- | |||
| <div class="" style="margin-top: 3.0em;"> | |||
| <img class="ui middle aligned tiny image" src="/img/ranking_list.jpg"> | |||
| <a class="ui blue" href="{{$.RepoLink}}/cloudbrain/123/rate?isObjectDetcionAll=true" target="_blank">目标检测算法排行榜</a> | |||
| </div> | |||
| --> | |||
| <div id="app" style="margin-top: 2rem;"> | |||
| <div class="center"> | |||
| <el-pagination | |||
| @@ -176,7 +176,7 @@ td, th { | |||
| <h4 class="ui header" id="vertical-segment"> | |||
| <div class="ui breadcrumb"> | |||
| <a class="section" href="{{.RepoLink}}/debugjob?debugListType=all"> | |||
| {{.i18n.Tr "repo.cloudbrain"}} | |||
| {{$.i18n.Tr "repo.cloudbrain"}} | |||
| </a> | |||
| <div class="divider"> / </div> | |||
| <a class="section" href="{{$.RepoLink}}/cloudbrain/benchmark"> | |||
| @@ -413,18 +413,18 @@ td, th { | |||
| <div id="deletemodel"> | |||
| <div class="ui basic modal"> | |||
| <div class="ui icon header"> | |||
| <i class="trash icon"></i> {{.i18n.Tr "cloudbrain.delete_task"}} | |||
| <i class="trash icon"></i> {{$.i18n.Tr "cloudbrain.delete_task"}} | |||
| </div> | |||
| <div class="content"> | |||
| <p>{{.i18n.Tr "cloudbrain.task_delete_confirm"}}</p> | |||
| <p>{{$.i18n.Tr "cloudbrain.task_delete_confirm"}}</p> | |||
| </div> | |||
| <div class="actions"> | |||
| <div class="ui red basic inverted cancel button"> | |||
| <i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}} | |||
| <i class="remove icon"></i> {{$.i18n.Tr "cloudbrain.operate_cancel"}} | |||
| </div> | |||
| <div class="ui green basic inverted ok button"> | |||
| <i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}} | |||
| <i class="checkmark icon"></i> {{$.i18n.Tr "cloudbrain.operate_confirm"}} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -0,0 +1,328 @@ | |||
| {{template "base/head" .}} | |||
| <!-- 弹窗 --> | |||
| <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 class="alert"></div> | |||
| <div class="explore users"> | |||
| <div class="cloudbrain_debug" style="display: none;" data-debug="{{$.i18n.Tr "repo.debug"}}" data-debug-again="{{$.i18n.Tr "repo.debug_again"}}"></div> | |||
| {{template "admin/cloudbrain/search_dashboard" .}} | |||
| <div class="ui container" style="width: 80%;"> | |||
| {{template "base/alert" .}} | |||
| <div class="ui grid" > | |||
| <div class="row" > | |||
| <div class="ui sixteen wide column"> | |||
| <!-- 任务展示 --> | |||
| <div class="dataset list"> | |||
| <!-- 表头 --> | |||
| <div class="ui grid stackable" style="background: #f0f0f0;;"> | |||
| <div class="row"> | |||
| <div class="three wide column nowrap" style="width:15%"> | |||
| <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task"}}</span> | |||
| </div> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.status"}}</span> | |||
| </div> | |||
| <div class="one wide column text center nowrap" style="width:10%"> | |||
| <span style="margin:0 6px">{{$.i18n.Tr "repo.cloudbrain_task_type"}}</span> | |||
| </div> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.createtime"}}</span> | |||
| </div> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span>{{$.i18n.Tr "repo.cloudbrain_status_runtime"}}</span> | |||
| </div> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span>{{$.i18n.Tr "repo.modelarts.computing_resources"}}</span> | |||
| </div> | |||
| <div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
| <span>{{$.i18n.Tr "repository"}}</span> | |||
| </div> | |||
| <div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
| <span>{{$.i18n.Tr "repo.cloudbrain_operate"}}</span> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{range .Tasks}} | |||
| {{if .Repo}} | |||
| <div class="ui grid stackable item"> | |||
| <div class="row"> | |||
| <!-- 任务名 --> | |||
| {{$JobID := '0'}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||
| {{$JobID = .Cloudbrain.ID}} | |||
| {{else}} | |||
| {{$JobID = .JobID}} | |||
| {{end}} | |||
| <!-- {{$JobID}} --> | |||
| <div class="three wide column nowrap" style="width:15%"> | |||
| {{if or (eq .JobType "DEBUG") (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}} | |||
| <a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain/{{$JobID}}{{else}}/modelarts/notebook/{{$JobID}}{{end}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "INFERENCE"}} | |||
| <a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "TRAIN"}} | |||
| <a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .ComputeResource "NPU"}}modelarts{{else}}cloudbrain{{end}}/train-job/{{$JobID}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "BENCHMARK"}} | |||
| <a class="title" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{end}} | |||
| </div> | |||
| <!-- 任务状态 --> | |||
| <div class="two wide column text center nowrap" style="padding-left: 2.2rem !important; width: 11% !important;"> | |||
| <span class="job-status" id="{{$JobID}}" data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "DEBUG"}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{else if eq .JobType "INFERENCE"}}/modelarts/inference-job{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}/modelarts/train-job{{else}}/cloudbrain/train-job{{end}}{{else if eq .JobType "BENCHMARK"}}/cloudbrain{{end}}' data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| <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> | |||
| </div> | |||
| <!-- 任务类型 --> | |||
| {{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
| <div class="one wide column text center nowrap" style="width:10%"> | |||
| <span style="font-size: 12px;" title="{{$JobType}}">{{$JobType}}</span> | |||
| </div> | |||
| <!-- 任务创建时间 --> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| <span style="font-size: 12px;" class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
| </div> | |||
| <!-- 任务运行时间 --> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span style="font-size: 12px;" id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 计算资源 --> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 项目 --> | |||
| <div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
| <a href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}" title="{{.Repo.OwnerName}}/{{.Repo.Alias}}">{{.Repo.OwnerName}}/{{.Repo.Alias}}</a> | |||
| </div> | |||
| <div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| <div class="ui compact buttons"> | |||
| <form id="debugAgainForm-{{$JobID}}"> | |||
| {{$.CsrfTokenHtml}} | |||
| {{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} | |||
| <a style="margin: 0 1rem;" id="ai-debug-{{$JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}}disabled {{else}}blue {{end}}button' data-jobid="{{$JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{$JobID}}/'> | |||
| {{$.i18n.Tr "repo.debug"}} | |||
| </a> | |||
| {{else}} | |||
| <a id="ai-debug-{{$JobID}}" class='ui basic ai_debug {{if eq .Status "CREATING" "STOPPING" "WAITING" "STARTING"}} disabled {{else}}blue {{end}}button' data-jobid="{{$JobID}}" data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}/{{$JobID}}/'> | |||
| {{$.i18n.Tr "repo.debug_again"}} | |||
| </a> | |||
| {{end}} | |||
| </form> | |||
| </div> | |||
| {{end}} | |||
| <!-- 停止任务 --> | |||
| <div class="ui compact buttons"> | |||
| {{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' data-jobid="{{$JobID}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}modelarts/inference-job{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}modelarts/train-job{{else}}cloudbrain/train-job{{end}}{{end}}' data-jobid="{{$JobID}}" data-version="{{.VersionName}}" > | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| {{end}} | |||
| </div> | |||
| <!-- 删除任务 --> | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .ComputeResource "NPU"}}/modelarts/train-job{{else}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true' method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?ishomepage=true" data-version="{{.VersionName}}" class="ui basic ai_delete blue button" style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{else}} | |||
| {{$JobID := '0'}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||
| {{$JobID = .Cloudbrain.ID}} | |||
| {{else}} | |||
| {{$JobID = .JobID}} | |||
| {{end}} | |||
| <div class="ui grid stackable item"> | |||
| <div class="row"> | |||
| <!-- 任务名 --> | |||
| <div class="three wide column nowrap" style="width:15%"> | |||
| {{if eq .JobType "DEBUG"}} | |||
| <a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "INFERENCE"}} | |||
| <a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "TRAIN"}} | |||
| <a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "BENCHMARK"}} | |||
| <a class="title" href="" title="{{.DisplayJobName}}" style="font-size: 14px;"> | |||
| <span class="fitted" style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{end}} | |||
| </div> | |||
| <!-- 任务状态 --> | |||
| <div class="two wide column text center nowrap" style="padding-left: 2.2rem !important; width: 11% !important;"> | |||
| <span class="job-status" id="{{$JobID}}" data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| <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> | |||
| </div> | |||
| <!-- 任务类型 --> | |||
| {{$JobType := $.i18n.Tr (printf "cloudbrain.%s" .JobType)}} | |||
| <div class="one wide column text center nowrap" style="width:10%"> | |||
| <span style="font-size: 12px;" title="{{$JobType}}">{{$JobType}}</span> | |||
| </div> | |||
| <!-- 任务创建时间 --> | |||
| <div class="two wide column text center nowrap" style="width: 11% !important;"> | |||
| <span style="font-size: 12px;" class="">{{TimeSinceUnix1 .Cloudbrain.CreatedUnix}}</span> | |||
| </div> | |||
| <!-- 任务运行时间 --> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span style="font-size: 12px;" id="duration-{{$JobID}}">{{if .TrainJobDuration}}{{.TrainJobDuration}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 计算资源 --> | |||
| <div class="one wide column text center nowrap" style="width:8.5% !important;"> | |||
| <span style="font-size: 12px;">{{if .ComputeResource}}{{.ComputeResource}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 创建者 --> | |||
| <!-- 项目 --> | |||
| <div class="two wide column text center nowrap" style="width: 14.5%!important;"> | |||
| <a href="" title="">--</a> | |||
| </div> | |||
| <div class="three wide column text center nowrap" style="width: 21.5%!important;"> | |||
| {{if eq .JobType "DEBUG"}} | |||
| <div class="ui compact buttons"> | |||
| <form id="debugAgainForm-{{$JobID}}"> | |||
| {{$.CsrfTokenHtml}} | |||
| {{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} | |||
| <a style="margin: 0 1rem;" id="ai-debug-{{$JobID}}" class='ui basic disabled button' > | |||
| {{$.i18n.Tr "repo.debug"}} | |||
| </a> | |||
| {{else}} | |||
| <a id="ai-debug-{{$JobID}}" class='ui basic disabled button' > | |||
| {{$.i18n.Tr "repo.debug_again"}} | |||
| </a> | |||
| {{end}} | |||
| </form> | |||
| </div> | |||
| {{end}} | |||
| <!-- 停止任务 --> | |||
| <div class="ui compact buttons"> | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" class="ui basic disabled button" data-jobid="{{$JobID}}" data-version="{{.VersionName}}" > | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </div> | |||
| <!-- 删除任务 --> | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" action='' method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" class="ui basic disabled button" style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{end}} | |||
| {{end}} | |||
| <div id="app" style="margin-top: 2rem;"> | |||
| <div class="center"> | |||
| <el-pagination | |||
| background | |||
| @current-change="handleCurrentChange" | |||
| :current-page="page" | |||
| :page-sizes="[10]" | |||
| :page-size="10" | |||
| layout="total, sizes, prev, pager, next, jumper" | |||
| :total="{{.Page.Paginater.Total}}"> | |||
| </el-pagination> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| <!-- 确认模态框 --> | |||
| <div id="deletemodel"> | |||
| <div class="ui basic modal"> | |||
| <div class="ui icon header"> | |||
| <i class="trash icon"></i> {{.i18n.Tr "cloudbrain.delete_task"}} | |||
| </div> | |||
| <div class="content"> | |||
| <p>{{.i18n.Tr "cloudbrain.task_delete_confirm"}}</p> | |||
| </div> | |||
| <div class="actions"> | |||
| <div class="ui red basic inverted cancel button"> | |||
| <i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}} | |||
| </div> | |||
| <div class="ui green basic inverted ok button"> | |||
| <i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| {{template "base/footer" .}} | |||
| <script> | |||
| function getParams(){ | |||
| const params = new URLSearchParams(window.location.search) | |||
| params.get('jobType') | |||
| let jobType | |||
| if(!params.get('jobType')){ | |||
| jobType = '{{.i18n.Tr "admin.cloudbrain.all_task_types"}}' | |||
| }else{ | |||
| if(params.get('jobType') === 'DEBUG'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.DEBUG")}}' | |||
| }else if(params.get('jobType') === 'TRAIN'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.TRAIN")}}' | |||
| } | |||
| else if(params.get('jobType') === 'INFERENCE'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.INFERENCE")}}' | |||
| } | |||
| else if(params.get('jobType') === 'SNN4IMAGENET'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.SNN4IMAGENET")}}' | |||
| }else if(params.get('jobType') === 'BENCHMARK'){ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.BENCHMARK")}}' | |||
| } | |||
| else{ | |||
| jobType = '{{$.i18n.Tr (printf "cloudbrain.BRAINSCORE")}}' | |||
| } | |||
| } | |||
| let listType = !params.get('listType')? '{{.i18n.Tr "admin.cloudbrain.all_computing_resources"}}' : params.get('listType') | |||
| let jobStatus = !params.get('jobStatus')? '{{.i18n.Tr "admin.cloudbrain.all_status"}}' : params.get('jobStatus').toUpperCase() | |||
| const dropdownValueArray = [jobType,listType,jobStatus] | |||
| $('#adminCloud .default.text ').each(function(index,e){ | |||
| $(e).text(dropdownValueArray[index]) | |||
| }) | |||
| } | |||
| getParams() | |||
| </script> | |||
| @@ -20,6 +20,7 @@ export default async function initCloudrain() { | |||
| const status = data.JobStatus | |||
| const duration = data.JobDuration | |||
| $('#duration-'+ID).text(duration) | |||
| console.log(status,["STOPPED"].includes(status)) | |||
| if (status != status_text) { | |||
| $('#' + ID+'-icon').removeClass().addClass(status) | |||
| $('#' + ID+ '-text').text(status) | |||
| @@ -38,12 +39,12 @@ 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(debug_again_button).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') | |||
| } | |||
| if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED","SUCCEEDED","COMPLETED"].includes(status)){ | |||
| if(["CREATING","STOPPING","STARTING","STOPPED","FAILED","START_FAILED","SUCCEEDED","COMPLETED","CREATE_FAILED"].includes(status)){ | |||
| $('#ai-stop-'+ID).removeClass('blue').addClass('disabled') | |||
| } | |||
| @@ -162,6 +163,9 @@ export default async function initCloudrain() { | |||
| $(`#${ID}-icon`).attr("class",data.JobStatus) | |||
| // detail status and duration | |||
| $(`#${ID}-text`).text(data.JobStatus) | |||
| if(["STOPPED","FAILED","START_FAILED","KILLED","COMPLETED","SUCCEEDED"].includes(data.JobStatus)){ | |||
| $('#ai-delete-'+ID).removeClass('disabled').addClass('blue') | |||
| } | |||
| }).fail(function(err) { | |||
| console.log(err); | |||
| }); | |||
| @@ -242,7 +242,7 @@ 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;} | |||
| .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;} | |||
| .FAILED,.START_FAILED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -532px -52px;} | |||
| .FAILED,.START_FAILED,.CREATE_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-used{background-position: -514px -52px;} | |||
| .icon-bind{background-position: -550px -52px;} | |||