Browse Source

Merge remote-tracking branch 'origin/V20221228' into fix-3313

pull/3487/head
chenshihai 2 years ago
parent
commit
60a0699875
85 changed files with 1961 additions and 1194 deletions
  1. +1
    -0
      .gitignore
  2. BIN
      custom/public/img/home-banner-02-1.jpg
  3. BIN
      custom/public/img/home-banner-02-2.png
  4. +45
    -0
      custom/public/img/logo-w-origin.svg
  5. +1
    -45
      custom/public/img/logo-w.svg
  6. +11
    -0
      models/attachment.go
  7. +70
    -33
      models/cloudbrain.go
  8. +6
    -1
      models/user.go
  9. +16
    -0
      models/user_analysis_for_activity.go
  10. +70
    -0
      models/user_business_analysis.go
  11. +3
    -3
      models/user_business_struct.go
  12. +1
    -0
      modules/auth/modelarts.go
  13. +7
    -20
      modules/cloudbrain/cloudbrain.go
  14. +3
    -3
      modules/convert/cloudbrain.go
  15. +0
    -1
      modules/grampus/resty.go
  16. +3
    -4
      modules/modelarts/modelarts.go
  17. +3
    -0
      modules/repository/repo.go
  18. +15
    -0
      modules/setting/setting.go
  19. +20
    -4
      modules/storage/obs.go
  20. +27
    -27
      modules/structs/cloudbrain.go
  21. +8
    -2
      modules/templates/helper.go
  22. +18
    -3
      options/locale/locale_en-US.ini
  23. +19
    -4
      options/locale/locale_zh-CN.ini
  24. +34
    -65
      package-lock.json
  25. BIN
      public/img/login_bg_default.png
  26. +1
    -1
      routers/admin/cloudbrains.go
  27. +2
    -0
      routers/api/v1/api.go
  28. +45
    -0
      routers/api/v1/repo/attachments.go
  29. +46
    -17
      routers/api/v1/repo/cloudbrain_dashboard.go
  30. +20
    -0
      routers/api/v1/user/repo.go
  31. +85
    -31
      routers/repo/cloudbrain.go
  32. +1
    -0
      routers/repo/dataset.go
  33. +23
    -1
      routers/repo/grampus.go
  34. +33
    -10
      routers/repo/modelarts.go
  35. +6
    -4
      routers/routes/routes.go
  36. +14
    -0
      routers/user/auth.go
  37. +1
    -1
      routers/user/home.go
  38. +14
    -14
      services/cloudbrain/clear.go
  39. +2
    -2
      services/cloudbrain/cloudbrainTask/count.go
  40. +35
    -7
      services/cloudbrain/cloudbrainTask/notebook.go
  41. +6
    -6
      templates/admin/cloudbrain/list.tmpl
  42. +1
    -0
      templates/admin/cloudbrain/search.tmpl
  43. +10
    -0
      templates/base/footer_content.tmpl
  44. +39
    -1
      templates/custom/home/home_top.tmpl
  45. +2
    -2
      templates/custom/task_wait_count.tmpl
  46. +1
    -0
      templates/explore/images.tmpl
  47. +125
    -259
      templates/repo/cloudbrain/benchmark/new.tmpl
  48. +30
    -21
      templates/repo/cloudbrain/benchmark/show.tmpl
  49. +1
    -1
      templates/repo/cloudbrain/inference/new.tmpl
  50. +12
    -4
      templates/repo/cloudbrain/inference/show.tmpl
  51. +2
    -1
      templates/repo/cloudbrain/new.tmpl
  52. +3
    -0
      templates/repo/cloudbrain/show.tmpl
  53. +1
    -1
      templates/repo/cloudbrain/trainjob/new.tmpl
  54. +22
    -3
      templates/repo/cloudbrain/trainjob/show.tmpl
  55. +2
    -3
      templates/repo/grampus/notebook/gpu/new.tmpl
  56. +16
    -3
      templates/repo/grampus/notebook/npu/new.tmpl
  57. +23
    -4
      templates/repo/grampus/trainjob/show.tmpl
  58. +5
    -5
      templates/repo/home.tmpl
  59. +12
    -4
      templates/repo/modelarts/inferencejob/show.tmpl
  60. +16
    -3
      templates/repo/modelarts/notebook/new.tmpl
  61. +2
    -1
      templates/repo/modelarts/trainjob/para_manage.tmpl
  62. +24
    -4
      templates/repo/modelarts/trainjob/show.tmpl
  63. +9
    -4
      templates/repo/modelmanage/convertshowinfo.tmpl
  64. +2
    -35
      templates/repo/modelsafety/new.tmpl
  65. +46
    -4
      templates/user/auth/signin.tmpl
  66. +43
    -4
      templates/user/auth/signin_cloud_brain.tmpl
  67. +1
    -1
      templates/user/auth/signin_navbar.tmpl
  68. +97
    -59
      templates/user/auth/signin_phone.tmpl
  69. +45
    -0
      templates/user/auth/signin_up_img_default.tmpl
  70. +136
    -97
      templates/user/auth/signup_inner.tmpl
  71. +5
    -5
      templates/user/dashboard/cloudbrains.tmpl
  72. +3
    -2
      web_src/js/components/Contributors.vue
  73. +8
    -7
      web_src/js/components/EditAboutInfo.vue
  74. +6
    -6
      web_src/js/components/EditTopics.vue
  75. +2
    -2
      web_src/js/components/Model.vue
  76. +3
    -2
      web_src/js/components/basic/editDialog.vue
  77. +29
    -0
      web_src/js/components/dataset/selectDataset.vue
  78. +61
    -60
      web_src/js/components/images/Images.vue
  79. +28
    -27
      web_src/js/components/images/adminImages.vue
  80. +11
    -206
      web_src/js/features/cloudbrainShow.js
  81. +4
    -41
      web_src/js/features/cloudrbanin.js
  82. +108
    -0
      web_src/js/features/i18nVue.js
  83. +245
    -1
      web_src/js/standalone/cloudbrainNew.js
  84. +3
    -1
      web_src/less/openi.less
  85. +2
    -1
      web_src/vuepages/pages/notebook/debug/index.vue

+ 1
- 0
.gitignore View File

@@ -56,6 +56,7 @@ coverage.all
/custom/conf/app.ini /custom/conf/app.ini
!/custom/conf/app.ini.sample !/custom/conf/app.ini.sample
/custom/public/kanban /custom/public/kanban
/custom/public/annual-report
/data /data
/indexers /indexers
/log /log


BIN
custom/public/img/home-banner-02-1.jpg View File

Before After
Width: 1920  |  Height: 548  |  Size: 156 kB

BIN
custom/public/img/home-banner-02-2.png View File

Before After
Width: 790  |  Height: 315  |  Size: 253 kB

+ 45
- 0
custom/public/img/logo-w-origin.svg View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 26.3.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 160 64" style="enable-background:new 0 0 160 64;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
.st1{display:none;fill:#FFFFFF;}
</style>
<g>
<path class="st0" d="M105.3,33.3H87.1c-2.6,0.1-4,1.3-4,3.8v8.3c0.1,2.2,1.5,3.3,4,3.5h18c2.5-0.1,3.8-1.3,3.9-3.6v-8.2
c0.1-2-1.4-3.6-3.4-3.8C105.6,33.3,105.4,33.3,105.3,33.3z M104.6,43.9c-0.1,1-0.7,1.5-1.9,1.7H89.3c-1.3-0.3-1.8-0.7-1.9-1.7v-5.4
c0-1,0.8-1.9,1.8-1.9c0,0,0.1,0,0.1,0h13.1c1.1,0,2,0.8,2.1,2L104.6,43.9z"/>
<path class="st0" d="M81,25.3v-4.7c0-1.1,0.9-2.1,2.1-2.1h19c1.4-0.1,2.1,0.5,2.1,1.8v3.3c0,1.1-0.7,1.7-1.9,1.7H82.8v3.2H105
c2.3,0,3.6-1.1,3.6-3.2v-6.4c0.2-1.8-1.1-3.4-2.8-3.6c-0.3,0-0.5,0-0.8,0h-9.7v-2.6h-4.6v2.6H80.3c-2.6,0-3.9,1.2-3.9,3.9v12.3
c0,5.8-0.9,11.6-2.6,17.1l4.3,0.8c1.8-5.5,2.7-11.3,2.8-17.1v-7.2H81z"/>
<path class="st0" d="M116.2,30.4l4.4,2.4c2.6-1.9,4.4-4.6,5.1-7.6h7.8v-3.2h-7.1c0.2-1.3,0.3-2.6,0.3-3.9h6.6v-3.2h-12.3v-2h-4.6
V18h5.8c0,1.3-0.1,2.6-0.3,3.9h-6.7v3.3h5.8C120.4,27.5,118.6,29.4,116.2,30.4z"/>
<path class="st0" d="M126.5,26.7c1.2,1.8,2.1,3.8,2.9,5.8h4.9c-0.8-2-1.8-4-2.9-5.8H126.5z"/>
<path class="st0" d="M145.4,33.5h-24.7c-2.4,0.3-3.8,1.4-3.9,3.5v6.2h28.4v1.3c0,1.1-0.7,1.7-2.1,1.7h-19.7c-1.3,0-1.9-0.5-1.9-1.5
h-4.5V46c0,1.9,1.6,3.5,3.5,3.6h25.1c2.6-0.1,4-1.3,4-3.5v-9C149.2,35,147.5,33.5,145.4,33.5z M145,39.9h-23.7v-1.1
c0-1,0.8-1.9,1.8-1.9c0,0,0.1,0,0.1,0H143c1.3,0,2.1,0.7,2.1,1.9L145,39.9z"/>
<path class="st0" d="M147.3,14h-8.2c-2.2,0.1-3.5,1.1-3.8,2.9v11.7c0.1,1.6,1.4,2.9,3.1,2.9h8.7c1.9-0.1,3.1-1.1,3.1-2.9V17
C150.4,15.4,149.4,14.3,147.3,14z M146,26.2c0,1.4-0.7,2.1-1.9,2.1h-2.4c-1,0-1.8-0.8-1.8-1.8c0-0.1,0-0.1,0-0.2v-7
c0-1,0.8-1.9,1.8-1.9c0,0,0.1,0,0.1,0h2c1.1,0,2.1,0.8,2.1,1.9l0,0L146,26.2z"/>
</g>
<path class="st1" d="M67.2,44.1V20c0-2.6-1.4-5.1-3.7-6.4l-20.9-12c-2.3-1.3-5.1-1.3-7.4,0l-20.9,12c-2.3,1.3-3.7,3.8-3.7,6.4v24.1
c0,2.6,1.4,5.1,3.7,6.4l20.9,12c2.3,1.3,5.1,1.3,7.4,0l20.9-12C65.8,49.2,67.2,46.7,67.2,44.1z"/>
<path class="st0" d="M61.9,15.4L42,3.9c-1.9-1.1-4.3-1.1-6.2,0L15.9,15.4c-1.9,1.1-3.1,3.2-3.1,5.4v22.9c0,2.2,1.2,4.3,3.1,5.4
l3.8,2c0.8,0.4,0.8,1,0.8,1.9c0,0,0,0.1,0,0.1c0.1,1.6,1.8,3.5,4.2,3.5c2.3,0,4.3-1.9,4.4-4.2c0-1.6-0.8-3.1-2.3-3.9
c-0.6-0.3-1.7-0.5-2.9-0.4c-0.9,0.1-1,0.6-2.8-0.5l-2.8-1.6c-0.8-0.5-1.7-1.3-1.6-2.3V22c0-1.8,0.8-2.8,2.1-3.5L37,7.8
C38.1,7,40.2,7.2,41.5,8l16.4,9.5c2.9,1.6,3,3,3,4v19.7c0,2.3-1.5,4-2.3,4.5l-15.1,8.5C42.8,54.5,42,54,42,53.3l0-2.5
c0-0.1,0-0.3,0-0.4v-2.5c0-0.8,0.4-1.6,1.1-2l8.8-5.7c1.4-0.9,2-1.7,2-3.8L53.7,28c0-1,0.4-1.9,1.2-2.5c1.5-1.3,2-3.7,0.8-5.6
c-0.8-1.4-2.4-2.2-4-2c-1.6,0.1-2.8,1-3.5,2.4c-0.5,1-0.6,2.2-0.3,3.3c0.2,0.8,0.7,1.4,1.3,2c0.7,0.6,1.2,1.5,1.2,2.5v7.2
c0,1.1-0.5,2.1-1.5,2.7l-5.5,2.8c-0.7,0.5-1.6,0-1.6-0.8l-0.2-17.1c0-1,0.5-1.9,1.2-2.5c0.4-0.3,0.7-0.8,1-1.3
c0.7-1.3,0.7-2.9-0.1-4.3c-0.8-1.4-2.5-2.2-4.1-2.1c-2.9,0.3-4.6,3.1-3.8,5.7c0.2,0.8,0.7,1.4,1.3,2c0.7,0.6,1.2,1.5,1.2,2.5v9.9
c0,0.8-0.8,1.3-1.5,0.9L34,32.5c-0.7-0.4-1.2-1.2-1.2-2.1v-2.2c0-1,0.4-1.9,1.2-2.5c1.5-1.3,2-3.7,0.8-5.6c-0.8-1.3-2.4-2.1-4-2
c-2.9,0.2-4.7,3.1-3.8,5.7c0.2,0.8,0.7,1.5,1.3,2c0.7,0.6,1.2,1.5,1.2,2.5l0,3.5c0,1,0,2,1.6,3.1l5.5,3c0.7,0.4,1.2,1.2,1.2,2.1v4.5
c0,0.8-0.8,1.3-1.5,0.9L26.6,41c-0.7-0.4-1.2-1.2-1.2-2.1l-0.2-6.1c0-1,0.4-1.8,1.1-2.5c1.4-1.3,1.9-3.4,0.9-5.3
c-0.8-1.4-2.4-2.3-4-2.2c-2.9,0.2-4.6,3-3.8,5.6c0.2,0.7,0.7,1.4,1.2,1.9c0.7,0.6,1.1,1.5,1.1,2.5l-0.5,6.8c0,1.9,0.3,2.8,1.8,3.5
l11.8,6.3c1,0.6,1.6,1.7,1.6,2.8l0,3.1c0,3.1,4.3,5.7,8.7,3.3l16.4-9.8c1.9-1,3.2-3,3.4-5.2V20.7C65,18.5,63.8,16.5,61.9,15.4z
M24.2,50.7c1.1,0,2,0.9,2,2c0,1.1-0.9,2-2,2c-1.1,0-2-0.9-2-2C22.2,51.7,23.1,50.7,24.2,50.7z M48.7,21.5c0-1.1,0.9-2,2-2
s2,0.9,2,2c0,1.1-0.9,2-2,2S48.7,22.6,48.7,21.5z M30.6,23.8c-1.1,0-2-0.9-2-2s0.9-2,2-2c1.1,0,2,0.9,2,2S31.8,23.8,30.6,23.8z
M22.2,26.4c0-1.1,0.9-2,2-2c1.1,0,2,0.9,2,2s-0.9,2-2,2C23.1,28.4,22.2,27.5,22.2,26.4z M40,17.9c-1.1,0-2-0.9-2-2c0-1.1,0.9-2,2-2
c1.1,0,2,0.9,2,2C42,17,41.1,17.9,40,17.9z"/>
</svg>

+ 1
- 45
custom/public/img/logo-w.svg
File diff suppressed because it is too large
View File


+ 11
- 0
models/attachment.go View File

@@ -259,6 +259,17 @@ func GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error) {
return getAttachmentsByCommentID(x, commentID) return getAttachmentsByCommentID(x, commentID)
} }


func GetAttachmentByDatasetIdFileName(fileName string, datasetId int64) (*Attachment, error) {
attach := &Attachment{DatasetID: datasetId, Name: fileName}
has, err := x.Get(attach)
if err != nil {
return nil, err
} else if !has {
return nil, err
}
return attach, nil
}

func getAttachmentsByCommentID(e Engine, commentID int64) ([]*Attachment, error) { func getAttachmentsByCommentID(e Engine, commentID int64) ([]*Attachment, error) {
attachments := make([]*Attachment, 0, 10) attachments := make([]*Attachment, 0, 10)
return attachments, e.Where("comment_id=?", commentID).Find(&attachments) return attachments, e.Where("comment_id=?", commentID).Find(&attachments)


+ 70
- 33
models/cloudbrain.go View File

@@ -60,6 +60,7 @@ const (
JobTypeModelSafety JobType = "MODELSAFETY" JobTypeModelSafety JobType = "MODELSAFETY"
JobTypeSnn4imagenet JobType = "SNN4IMAGENET" JobTypeSnn4imagenet JobType = "SNN4IMAGENET"
JobTypeBrainScore JobType = "BRAINSCORE" JobTypeBrainScore JobType = "BRAINSCORE"
JobTypeSnn4Ecoset JobType = "SNN4ECOSET"
JobTypeTrain JobType = "TRAIN" JobTypeTrain JobType = "TRAIN"
JobTypeInference JobType = "INFERENCE" JobTypeInference JobType = "INFERENCE"


@@ -179,14 +180,14 @@ type Cloudbrain struct {
AiCenter string //grampus ai center: center_id+center_name AiCenter string //grampus ai center: center_id+center_name


TrainUrl string //输出模型的obs路径 TrainUrl string //输出模型的obs路径
BranchName string //分支名称
BranchName string `xorm:"varchar(2550)"` //分支名称
Parameters string //传给modelarts的param参数 Parameters string //传给modelarts的param参数
BootFile string //启动文件
BootFile string `xorm:"varchar(2550)"` //启动文件
DataUrl string `xorm:"varchar(3500)"` //数据集的obs路径 DataUrl string `xorm:"varchar(3500)"` //数据集的obs路径
LogUrl string //日志输出的obs路径 LogUrl string //日志输出的obs路径
PreVersionId int64 //父版本的版本id PreVersionId int64 //父版本的版本id
FlavorCode string //modelarts上的规格id FlavorCode string //modelarts上的规格id
Description string `xorm:"varchar(256)"` //描述
Description string `xorm:"varchar(2550)"` //描述
WorkServerNumber int //节点数 WorkServerNumber int //节点数
FlavorName string //规格名称 FlavorName string //规格名称
EngineName string //引擎名称 EngineName string //引擎名称
@@ -335,6 +336,9 @@ func IsModelArtsDebugJobTerminal(status string) bool {
func IsCloudBrainOneDebugJobTerminal(status string) bool { func IsCloudBrainOneDebugJobTerminal(status string) bool {
return status == string(JobStopped) || status == string(JobFailed) || status == string(JobSucceeded) return status == string(JobStopped) || status == string(JobFailed) || status == string(JobSucceeded)
} }
func IsModelBenchMarkJobType(jobType string) bool {
return jobType == string(JobTypeSnn4imagenet) || jobType == string(JobTypeBrainScore) || jobType == string(JobTypeSnn4Ecoset)
}


func ParseAndSetDurationFromCloudBrainOne(result JobResultPayload, task *Cloudbrain) { func ParseAndSetDurationFromCloudBrainOne(result JobResultPayload, task *Cloudbrain) {
isActivated := result.JobStatus.CreatedTime > 0 isActivated := result.JobStatus.CreatedTime > 0
@@ -449,29 +453,32 @@ type GetImagesPayload struct {


type CloudbrainsOptions struct { type CloudbrainsOptions struct {
ListOptions ListOptions
RepoID int64 // include all repos if empty
UserID int64
JobID string
SortType string
CloudbrainIDs []int64
JobStatus []string
JobStatusNot bool
Keyword string
Type int
JobTypes []string
VersionName string
IsLatestVersion string
JobTypeNot bool
NeedRepoInfo bool
RepoIDList []int64
BeginTime time.Time
EndTime time.Time
ComputeResource string
BeginTimeUnix int64
EndTimeUnix int64
AiCenter string
NeedDeleteInfo string
Cluster string
RepoID int64 // include all repos if empty
UserID int64
JobID string
SortType string
CloudbrainIDs []int64
JobStatus []string
JobStatusNot bool
Keyword string
Type int
JobTypes []string
VersionName string
IsLatestVersion string
JobTypeNot bool
NeedRepoInfo bool
RepoIDList []int64
BeginTime time.Time
EndTime time.Time
ComputeResource string
BeginTimeUnix int64
EndTimeUnix int64
AiCenter string
NeedDeleteInfo string
Cluster string
AccCardType string
AccCardsNum int
WorkServerNumber int
} }


type TaskPod struct { type TaskPod struct {
@@ -1559,7 +1566,8 @@ type CreateGrampusJobResponse struct {


type GetGrampusJobResponse struct { type GetGrampusJobResponse struct {
GrampusResult GrampusResult
JobInfo GrampusJobInfo `json:"otJob"`
JobInfo GrampusJobInfo `json:"otJob"`
ExitDiagnostics string `json:"exitDiagnostics"`
} }


type GrampusNotebookResponse struct { type GrampusNotebookResponse struct {
@@ -2168,7 +2176,7 @@ func GetCloudBrainUnStoppedJob() ([]*Cloudbrain, error) {
Find(&cloudbrains) Find(&cloudbrains)
} }


func GetCloudBrainOneStoppedNotDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) {
func GetGPUStoppedNotDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) {
cloudbrains := make([]*Cloudbrain, 0, 10) cloudbrains := make([]*Cloudbrain, 0, 10)
endTimeBefore := time.Now().Unix() - int64(days)*24*3600 endTimeBefore := time.Now().Unix() - int64(days)*24*3600
missEndTimeBefore := endTimeBefore - 24*3600 missEndTimeBefore := endTimeBefore - 24*3600
@@ -2177,7 +2185,7 @@ func GetCloudBrainOneStoppedNotDebugJobDaysAgo(days int, limit int) ([]*Cloudbra
JobStopped, JobSucceeded, JobFailed, ModelArtsCreateFailed, ModelArtsStartFailed, ModelArtsUnavailable, ModelArtsResizFailed, ModelArtsDeleted, JobStopped, JobSucceeded, JobFailed, ModelArtsCreateFailed, ModelArtsStartFailed, ModelArtsUnavailable, ModelArtsResizFailed, ModelArtsDeleted,
ModelArtsStopped, ModelArtsTrainJobCanceled, ModelArtsTrainJobCheckFailed, ModelArtsTrainJobCompleted, ModelArtsTrainJobDeleteFailed, ModelArtsTrainJobDeployServiceFailed, ModelArtsStopped, ModelArtsTrainJobCanceled, ModelArtsTrainJobCheckFailed, ModelArtsTrainJobCompleted, ModelArtsTrainJobDeleteFailed, ModelArtsTrainJobDeployServiceFailed,
ModelArtsTrainJobFailed, ModelArtsTrainJobImageFailed, ModelArtsTrainJobKilled, ModelArtsTrainJobLost, ModelArtsTrainJobSubmitFailed, ModelArtsTrainJobSubmitModelFailed). ModelArtsTrainJobFailed, ModelArtsTrainJobImageFailed, ModelArtsTrainJobKilled, ModelArtsTrainJobLost, ModelArtsTrainJobSubmitFailed, ModelArtsTrainJobSubmitModelFailed).
Where("(((end_time is null or end_time=0) and updated_unix<? and updated_unix != 0 ) or (end_time<? and end_time != 0)) and cleared=false and type=0 and job_type != 'DEBUG'", missEndTimeBefore, endTimeBefore).
Where("(((end_time is null or end_time=0) and updated_unix<? and updated_unix != 0 ) or (end_time<? and end_time != 0)) and cleared=false and (type=0 or (type =2 and compute_resource='CPU/GPU')) and job_type != 'DEBUG'", missEndTimeBefore, endTimeBefore).
Limit(limit). Limit(limit).
Find(&cloudbrains) Find(&cloudbrains)
} }
@@ -2185,14 +2193,14 @@ func GetCloudBrainOneStoppedNotDebugJobDaysAgo(days int, limit int) ([]*Cloudbra
/** /**
本方法考虑了再次调试的情况,多次调试取最后一次的任务的结束时间 本方法考虑了再次调试的情况,多次调试取最后一次的任务的结束时间
*/ */
func GetCloudBrainOneStoppedDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) {
func GetGPUStoppedDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) {
cloudbrains := make([]*Cloudbrain, 0, 10) cloudbrains := make([]*Cloudbrain, 0, 10)
endTimeBefore := time.Now().Unix() - int64(days)*24*3600 endTimeBefore := time.Now().Unix() - int64(days)*24*3600
missEndTimeBefore := endTimeBefore - 24*3600 missEndTimeBefore := endTimeBefore - 24*3600
sql := `SELECT id,job_name,job_id from (SELECT DISTINCT ON (job_name) sql := `SELECT id,job_name,job_id from (SELECT DISTINCT ON (job_name)
id, job_name, job_id,status,end_time,updated_unix,cleared id, job_name, job_id,status,end_time,updated_unix,cleared
FROM cloudbrain FROM cloudbrain
where type=0 and job_type='DEBUG'
where (type=0 or (type =2 and compute_resource='CPU/GPU')) and job_type='DEBUG'
ORDER BY job_name, updated_unix DESC) a ORDER BY job_name, updated_unix DESC) a
where status in ('STOPPED','SUCCEEDED','FAILED') and (((end_time is null or end_time=0) and updated_unix<? and updated_unix != 0 ) or (end_time<? and end_time != 0)) and cleared=false` where status in ('STOPPED','SUCCEEDED','FAILED') and (((end_time is null or end_time=0) and updated_unix<? and updated_unix != 0 ) or (end_time<? and end_time != 0)) and cleared=false`


@@ -2431,18 +2439,44 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
) )
} }


if opts.WorkServerNumber > 0 {
if opts.WorkServerNumber == 1 {
cond = cond.And(builder.Or(
builder.Eq{"cloudbrain.work_server_number": 0},
builder.Eq{"cloudbrain.work_server_number": 1},
builder.IsNull{"cloudbrain.work_server_number"},
))
} else {
cond = cond.And(
builder.Eq{"cloudbrain.work_server_number": opts.WorkServerNumber},
)
}
}

if opts.AccCardType != "" {
cond = cond.And(builder.Eq{"cloudbrain_spec.acc_card_type": opts.AccCardType})
}
if opts.AccCardsNum >= 0 {
cond = cond.And(builder.Eq{"cloudbrain_spec.acc_cards_num": opts.AccCardsNum})
}

var count int64 var count int64
var err error var err error
condition := "cloudbrain.user_id = `user`.id" condition := "cloudbrain.user_id = `user`.id"
if len(opts.Keyword) == 0 { if len(opts.Keyword) == 0 {
count, err = sess.Unscoped().Where(cond).Count(new(Cloudbrain))
count, err = sess.Table(&Cloudbrain{}).Unscoped().Where(cond).
Join("left", "`user`", condition).
Join("left", "cloudbrain_spec", "cloudbrain.id = cloudbrain_spec.cloudbrain_id").
Count(new(CloudbrainInfo))
} else { } else {
lowerKeyWord := strings.ToLower(opts.Keyword) lowerKeyWord := strings.ToLower(opts.Keyword)


cond = cond.And(builder.Or(builder.Like{"LOWER(cloudbrain.job_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})) builder.Like{"LOWER(cloudbrain.display_job_name)", lowerKeyWord}, builder.Like{"`user`.lower_name", lowerKeyWord}))
count, err = sess.Table(&Cloudbrain{}).Unscoped().Where(cond). count, err = sess.Table(&Cloudbrain{}).Unscoped().Where(cond).
Join("left", "`user`", condition).Count(new(CloudbrainInfo))
Join("left", "`user`", condition).
Join("left", "cloudbrain_spec", "cloudbrain.id = cloudbrain_spec.cloudbrain_id").
Count(new(CloudbrainInfo))


} }


@@ -2464,6 +2498,7 @@ func CloudbrainAll(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) {
cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum) cloudbrains := make([]*CloudbrainInfo, 0, setting.UI.IssuePagingNum)
if err := sess.Table(&Cloudbrain{}).Unscoped().Where(cond). if err := sess.Table(&Cloudbrain{}).Unscoped().Where(cond).
Join("left", "`user`", condition). Join("left", "`user`", condition).
Join("left", "cloudbrain_spec", "cloudbrain.id = cloudbrain_spec.cloudbrain_id").
Find(&cloudbrains); err != nil { Find(&cloudbrains); err != nil {
return nil, 0, fmt.Errorf("Find: %v", err) return nil, 0, fmt.Errorf("Find: %v", err)
} }
@@ -2618,6 +2653,7 @@ type DatasetInfo struct {
DataLocalPath string DataLocalPath string
Name string Name string
FullName string FullName string
Size int
} }


func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) { func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) {
@@ -2673,6 +2709,7 @@ func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetIn
DataLocalPath: dataLocalPath, DataLocalPath: dataLocalPath,
Name: fileName, Name: fileName,
FullName: attach.Name, FullName: attach.Name,
Size: int(attach.Size),
} }
if i == 0 { if i == 0 {
datasetNames = attach.Name datasetNames = attach.Name


+ 6
- 1
models/user.go View File

@@ -16,6 +16,7 @@ import (
"fmt" "fmt"
_ "image/jpeg" // Needed for jpeg support _ "image/jpeg" // Needed for jpeg support
"image/png" "image/png"
"math/rand"
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
@@ -495,7 +496,11 @@ func (u *User) RealSizedAvatarLink(size int) string {
// may either be a sub-URL to this site, or a full URL to an external avatar // may either be a sub-URL to this site, or a full URL to an external avatar
// service. // service.
func (u *User) RelAvatarLink() string { func (u *User) RelAvatarLink() string {
return u.SizedRelAvatarLink(base.DefaultAvatarSize)
append := ""
if u.UseCustomAvatar {
append = "?" + fmt.Sprint(rand.Intn(100))
}
return u.SizedRelAvatarLink(base.DefaultAvatarSize) + append
} }


// AvatarLink returns user avatar absolute link. // AvatarLink returns user avatar absolute link.


+ 16
- 0
models/user_analysis_for_activity.go View File

@@ -1,6 +1,7 @@
package models package models


import ( import (
"encoding/json"
"fmt" "fmt"
"time" "time"


@@ -450,15 +451,30 @@ func QueryUserLoginInfo(userIds []int64) []*UserLoginLog {
return loginList return loginList
} }


var WeekBonusData = make(map[int64][]int)

func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear { func QueryUserAnnualReport(userId int64) *UserSummaryCurrentYear {
statictisSess := xStatistic.NewSession() statictisSess := xStatistic.NewSession()
defer statictisSess.Close() defer statictisSess.Close()
log.Info("userId=" + fmt.Sprint(userId)) log.Info("userId=" + fmt.Sprint(userId))
if len(WeekBonusData) == 0 {
WeekBonusData = getBonusWeekDataMap()
}


reList := make([]*UserSummaryCurrentYear, 0) reList := make([]*UserSummaryCurrentYear, 0)
err := statictisSess.Select("*").Table(new(UserSummaryCurrentYear)).Where("id=" + fmt.Sprint(userId)).Find(&reList) err := statictisSess.Select("*").Table(new(UserSummaryCurrentYear)).Where("id=" + fmt.Sprint(userId)).Find(&reList)
if err == nil { if err == nil {
if len(reList) > 0 { if len(reList) > 0 {
record, ok := WeekBonusData[userId]
if ok {
bonusInfo := make(map[string]int)
bonusInfo["order"] = record[0]
bonusInfo["money"] = record[1]
bonusInfo["week"] = record[2]
bonusInfo["num"] = record[3]
bonusInfoJson, _ := json.Marshal(bonusInfo)
reList[0].WeekBonusData = string(bonusInfoJson)
}
return reList[0] return reList[0]
} }
} else { } else {


+ 70
- 0
models/user_business_analysis.go View File

@@ -880,6 +880,68 @@ func isUserYearData(tableName string) bool {
return false return false
} }


func getBonusWeekDataMap() map[int64][]int {
bonusMap := make(map[int64][]int)
url := setting.RecommentRepoAddr + "bonus/weekdata/record.txt"
content, err := GetContentFromPromote(url)
if err == nil {
filenames := strings.Split(content, "\n")
for i := 0; i < len(filenames); i++ {
url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i]
csvContent, err1 := GetContentFromPromote(url)
if err1 == nil {
//read csv
lines := strings.Split(csvContent, "\n")
for j := 1; j < len(lines); j++ {
aLine := strings.Split(lines[j], ",")
if len(aLine) < 4 {
continue
}
userId := getInt64Value(aLine[0])
order := getIntValue(aLine[2])
money := getIntValue(aLine[3])
week, num := getWeekAndNum(filenames[i])
//email := lines[2]
record, ok := bonusMap[userId]
if !ok {
record = make([]int, 4)
record[0] = order
record[1] = money
record[2] = week
record[3] = num
bonusMap[userId] = record
} else {
if record[0] > order {
record[0] = order
record[1] = money
record[2] = week
record[3] = num
} else {
if record[0] == order && record[1] < money {
record[1] = money
record[2] = week
record[3] = num
}
}
}
}
}
}
}
return bonusMap
}

func getWeekAndNum(name string) (int, int) {
name = name[0 : len(name)-4]
tmp := strings.Split(name, "_")
if len(tmp) == 2 {
week := getIntValue(tmp[0])
num := getIntValue(tmp[1])
return week, num
}
return 0, 0
}

func getBonusMap() map[string]map[string]int { func getBonusMap() map[string]map[string]int {
bonusMap := make(map[string]map[string]int) bonusMap := make(map[string]map[string]int)
url := setting.RecommentRepoAddr + "bonus/record.txt" url := setting.RecommentRepoAddr + "bonus/record.txt"
@@ -923,6 +985,14 @@ func getIntValue(val string) int {
return 0 return 0
} }


func getInt64Value(val string) int64 {
i, err := strconv.ParseInt(val, 10, 64)
if err == nil {
return i
}
return 0
}

func getPlayARoll(bonusMap map[string]map[string]int, userName string, scoreMap map[string]float64) string { func getPlayARoll(bonusMap map[string]map[string]int, userName string, scoreMap map[string]float64) string {
bonusInfo := make(map[string]string) bonusInfo := make(map[string]string)
record, ok := bonusMap[userName] record, ok := bonusMap[userName]


+ 3
- 3
models/user_business_struct.go View File

@@ -18,9 +18,9 @@ type UserSummaryCurrentYear struct {
CodeInfo string `xorm:"varchar(500)"` //代码提交次数,提交总代码行数,最晚的提交时间 CodeInfo string `xorm:"varchar(500)"` //代码提交次数,提交总代码行数,最晚的提交时间
CloudBrainInfo string `xorm:"varchar(1000)"` //,创建了XX 个云脑任务,调试任务XX 个,训练任务XX 个,推理任务XX 个,累计运行了XXXX 卡时,累计节省xxxxx 元 CloudBrainInfo string `xorm:"varchar(1000)"` //,创建了XX 个云脑任务,调试任务XX 个,训练任务XX 个,推理任务XX 个,累计运行了XXXX 卡时,累计节省xxxxx 元
//这些免费的算力资源分别有,XX% 来自鹏城云脑1,XX% 来自鹏城云脑2,XX% 来自智算网络 //这些免费的算力资源分别有,XX% 来自鹏城云脑1,XX% 来自鹏城云脑2,XX% 来自智算网络
PlayARoll string `xorm:"varchar(500)"` //你参加了XX 次“我为开源打榜狂”活动,累计上榜XX 次,总共获得了社区XXX 元的激励
Label string `xorm:"varchar(500)"`
PlayARoll string `xorm:"varchar(500)"` //你参加了XX 次“我为开源打榜狂”活动,累计上榜XX 次,总共获得了社区XXX 元的激励
WeekBonusData string `xorm:"-"`
Label string `xorm:"varchar(500)"`
} }


type UserBusinessAnalysisCurrentYear struct { type UserBusinessAnalysisCurrentYear struct {


+ 1
- 0
modules/auth/modelarts.go View File

@@ -28,6 +28,7 @@ type CreateModelArtsNotebookForm struct {
LabelName string `form:"label_names"` LabelName string `form:"label_names"`
PreTrainModelUrl string `form:"pre_train_model_url"` PreTrainModelUrl string `form:"pre_train_model_url"`
SpecId int64 `form:"spec_id" binding:"Required"` SpecId int64 `form:"spec_id" binding:"Required"`
DatasetName string `form:"dataset_name"`
} }


func (f *CreateModelArtsNotebookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { func (f *CreateModelArtsNotebookForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {


+ 7
- 20
modules/cloudbrain/cloudbrain.go View File

@@ -32,10 +32,10 @@ const (
Snn4imagenetMountPath = "/snn4imagenet" Snn4imagenetMountPath = "/snn4imagenet"
BrainScoreMountPath = "/brainscore" BrainScoreMountPath = "/brainscore"
TaskInfoName = "/taskInfo" TaskInfoName = "/taskInfo"
Snn4imagenetCommand = `/opt/conda/bin/python /snn4imagenet/testSNN_script.py --modelname '%s' --modelpath '/dataset' --modeldescription '%s' >/model/benchmark-log.txt`
BrainScoreCommand = `bash /brainscore/brainscore_test_par4shSrcipt.sh -b '%s' -n '%s' -p '/dataset' -d '%s' >/model/benchmark-log.txt`
SubTaskName = "task1"
Snn4imagenetCommand = `/opt/conda/bin/python /benchmark/testSNN_script.py --modelname '%s' --modelpath '/pretrainmodel/%s' --modeldescription '%s' >/model/benchmark-log.txt`
BrainScoreCommand = `bash /benchmark/brainscore_test_par4shSrcipt.sh -b '%s' -n '%s' -p '/pretrainmodel/%s' -d '%s' >/model/benchmark-log.txt`
Snn4EcosetCommand = `/opt/conda/bin/python /benchmark/testSNN_script.py --datapath '/dataset' --modelname '%s' --modelpath '/pretrainmodel/%s' --modeldescription '%s' >/model/benchmark-log.txt`
SubTaskName = "task1"


Success = "S000" Success = "S000"


@@ -259,20 +259,6 @@ func GenerateTask(req GenerateCloudBrainTaskReq) (string, error) {
}, },
{ {
HostPath: models.StHostPath{ HostPath: models.StHostPath{
Path: req.Snn4ImageNetPath,
MountPath: Snn4imagenetMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.BrainScorePath,
MountPath: BrainScoreMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.ResultPath, Path: req.ResultPath,
MountPath: ResultPath, MountPath: ResultPath,
ReadOnly: false, ReadOnly: false,
@@ -406,7 +392,7 @@ func GenerateTask(req GenerateCloudBrainTaskReq) (string, error) {
} }


func IsBenchmarkJob(jobType string) bool { func IsBenchmarkJob(jobType string) bool {
return string(models.JobTypeModelSafety) == jobType || string(models.JobTypeBenchmark) == jobType || string(models.JobTypeBrainScore) == jobType || string(models.JobTypeSnn4imagenet) == jobType
return string(models.JobTypeModelSafety) == jobType || string(models.JobTypeBenchmark) == jobType || string(models.JobTypeBrainScore) == jobType || string(models.JobTypeSnn4imagenet) == jobType || string(models.JobTypeSnn4Ecoset) == jobType
} }


func GetWaitingCloudbrainCount(cloudbrainType int, computeResource string, jobTypes ...models.JobType) int64 { func GetWaitingCloudbrainCount(cloudbrainType int, computeResource string, jobTypes ...models.JobType) int64 {
@@ -675,6 +661,7 @@ func IsElementExist(s []string, str string) bool {
return false return false
} }



func GetCloudBrainByIdOrJobId(id string, initialQuery string) (*models.Cloudbrain, error) { func GetCloudBrainByIdOrJobId(id string, initialQuery string) (*models.Cloudbrain, error) {
_, err := strconv.ParseInt(id, 10, 64) _, err := strconv.ParseInt(id, 10, 64)
var job *models.Cloudbrain var job *models.Cloudbrain
@@ -709,7 +696,7 @@ type GenerateModelArtsNotebookReq struct {


ImageId string ImageId string
AutoStopDurationMs int64 AutoStopDurationMs int64
BranchName string
BranchName string


Spec *models.Specification Spec *models.Specification
ModelName string ModelName string


+ 3
- 3
modules/convert/cloudbrain.go View File

@@ -28,9 +28,9 @@ func ToCloudBrain(task *models.Cloudbrain) *api.Cloudbrain {
BootFile: task.BootFile, BootFile: task.BootFile,
Description: task.Description, Description: task.Description,
ModelName: task.ModelName, ModelName: task.ModelName,
ModelVersion: task.ModelVersion,
CkptName: task.CkptName,
VersionName: task.VersionName,
ModelVersion: task.ModelVersion,
CkptName: task.CkptName,


StartTime: int64(task.StartTime), StartTime: int64(task.StartTime),
EndTime: int64(task.EndTime), EndTime: int64(task.EndTime),


+ 0
- 1
modules/grampus/resty.go View File

@@ -198,7 +198,6 @@ sendjob:
SetAuthToken(TOKEN). SetAuthToken(TOKEN).
SetResult(&result). SetResult(&result).
Get(HOST + urlTrainJob + "/" + jobID) Get(HOST + urlTrainJob + "/" + jobID)

if err != nil { if err != nil {
return nil, fmt.Errorf("resty GetJob: %v", err) return nil, fmt.Errorf("resty GetJob: %v", err)
} }


+ 3
- 4
modules/modelarts/modelarts.go View File

@@ -22,9 +22,9 @@ import (
const ( const (
//notebook //notebook


storageTypeOBS = "obs"
autoStopDuration = 4 * 60 * 60
AutoStopDurationMs = 4 * 60 * 60 * 1000
storageTypeOBS = "obs"
autoStopDuration = 4 * 60 * 60
AutoStopDurationMs = 4 * 60 * 60 * 1000


CodePath = "/code/" CodePath = "/code/"
OutputPath = "/output/" OutputPath = "/output/"
@@ -168,7 +168,6 @@ type OrgMultiNode struct {
Node []int `json:"node"` Node []int `json:"node"`
} }



type Parameters struct { type Parameters struct {
Parameter []struct { Parameter []struct {
Label string `json:"label"` Label string `json:"label"`


+ 3
- 0
modules/repository/repo.go View File

@@ -139,6 +139,9 @@ func MigrateRepositoryGitData(doer, u *models.User, repo *models.Repository, opt
} }


repo.IsMirror = true repo.IsMirror = true
if repo.Description == "" {
repo.Description = opts.Description
}
err = models.UpdateRepository(repo, false) err = models.UpdateRepository(repo, false)
} else { } else {
repo, err = CleanUpMigrateInfo(repo) repo, err = CleanUpMigrateInfo(repo)


+ 15
- 0
modules/setting/setting.go View File

@@ -518,6 +518,7 @@ var (
MaxDatasetNum int MaxDatasetNum int
CullIdleTimeout string CullIdleTimeout string
CullInterval string CullInterval string
DebugAttachSize int


//benchmark config //benchmark config
IsBenchmarkEnabled bool IsBenchmarkEnabled bool
@@ -543,6 +544,12 @@ var (
BrainScoreName string BrainScoreName string
BrainScoreServerHost string BrainScoreServerHost string


IsSnn4EcosetEnabled bool
Snn4EcosetOwner string
Snn4EcosetName string
Snn4EcosetServerHost string
Snn4AttachmentName string

//blockchain config //blockchain config
BlockChainHost string BlockChainHost string
CommitValidDate string CommitValidDate string
@@ -1497,6 +1504,7 @@ func NewContext() {
MaxDatasetNum = sec.Key("MAX_DATASET_NUM").MustInt(5) MaxDatasetNum = sec.Key("MAX_DATASET_NUM").MustInt(5)
CullIdleTimeout = sec.Key("CULL_IDLE_TIMEOUT").MustString("900") CullIdleTimeout = sec.Key("CULL_IDLE_TIMEOUT").MustString("900")
CullInterval = sec.Key("CULL_INTERVAL").MustString("60") CullInterval = sec.Key("CULL_INTERVAL").MustString("60")
DebugAttachSize = sec.Key("DEBUG_ATTACH_SIZE").MustInt(20)


sec = Cfg.Section("benchmark") sec = Cfg.Section("benchmark")
IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false)
@@ -1522,6 +1530,13 @@ func NewContext() {
BrainScoreName = sec.Key("NAME").MustString("") BrainScoreName = sec.Key("NAME").MustString("")
BrainScoreServerHost = sec.Key("HOST").MustString("") BrainScoreServerHost = sec.Key("HOST").MustString("")


sec = Cfg.Section("snn4ecoset")
IsSnn4EcosetEnabled = sec.Key("ENABLED").MustBool(false)
Snn4EcosetOwner = sec.Key("OWNER").MustString("")
Snn4EcosetName = sec.Key("NAME").MustString("")
Snn4EcosetServerHost = sec.Key("HOST").MustString("")
Snn4AttachmentName = sec.Key("DATASET").MustString("")

sec = Cfg.Section("blockchain") sec = Cfg.Section("blockchain")
BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/") BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/")
CommitValidDate = sec.Key("COMMIT_VALID_DATE").MustString("2021-01-15") CommitValidDate = sec.Key("COMMIT_VALID_DATE").MustString("2021-01-15")


+ 20
- 4
modules/storage/obs.go View File

@@ -614,7 +614,7 @@ func ObsCreateObject(path string) error {
return nil return nil
} }


func GetObsLogFileName(prefix string) (string, error) {
func GetObsLogFileName(prefix string) ([]FileInfo, error) {
input := &obs.ListObjectsInput{} input := &obs.ListObjectsInput{}
input.Bucket = setting.Bucket input.Bucket = setting.Bucket
input.Prefix = prefix input.Prefix = prefix
@@ -622,10 +622,26 @@ func GetObsLogFileName(prefix string) (string, error) {
output, err := ObsCli.ListObjects(input) output, err := ObsCli.ListObjects(input)
if err != nil { if err != nil {
log.Error("PutObject failed:", err.Error()) log.Error("PutObject failed:", err.Error())
return "", err
return nil, err
} }
if output == nil || len(output.Contents) == 0 { if output == nil || len(output.Contents) == 0 {
return "", errors.New("obs log files not exist")
return nil, errors.New("obs log files not exist")
}
fileInfos := make([]FileInfo, 0)
for _, val := range output.Contents {
//result[num] = c.Key
if strings.HasSuffix(val.Key, ".log") {
log.Info("log fileName=" + val.Key)
fileInfo := FileInfo{
ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"),
FileName: val.Key[len(prefix)-3:], //加上 job
Size: val.Size,
IsDir: false,
ParenDir: prefix[0 : len(prefix)-3],
}
fileInfos = append(fileInfos, fileInfo)
}

} }
return output.Contents[0].Key, nil
return fileInfos, nil
} }

+ 27
- 27
modules/structs/cloudbrain.go View File

@@ -51,33 +51,33 @@ type CreateFileNotebookJobOption struct {
} }


type Cloudbrain struct { type Cloudbrain struct {
ID int64 `json:"id"`
JobID string `json:"job_id"`
JobType string `json:"job_type"`
Type int `json:"type"`
DisplayJobName string `json:"display_job_name"`
Status string `json:"status"`
CreatedUnix int64 `json:"created_unix"`
RepoID int64 `json:"repo_id"`
Duration int64 `json:"duration"` //运行时长 单位秒
TrainJobDuration string `json:"train_job_duration"`
ImageID string `json:"image_id"` //grampus image_id
Image string `json:"image"`
Uuid string `json:"uuid"` //数据集id
DatasetName string `json:"dataset_name"`
ComputeResource string `json:"compute_resource"` //计算资源,例如npu
AiCenter string `json:"ai_center"` //grampus ai center: center_id+center_name
BranchName string `json:"branch_name"` //分支名称
Parameters string `json:"parameters"` //传给modelarts的param参数
BootFile string `json:"boot_file"` //启动文件
Description string `json:"description"` //描述
ModelName string `json:"model_name"` //模型名称
ModelVersion string `json:"model_version"` //模型版本
CkptName string `json:"ckpt_name"` //权重文件名称
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
Spec *SpecificationShow `json:"spec"`
ID int64 `json:"id"`
JobID string `json:"job_id"`
JobType string `json:"job_type"`
Type int `json:"type"`
DisplayJobName string `json:"display_job_name"`
Status string `json:"status"`
CreatedUnix int64 `json:"created_unix"`
RepoID int64 `json:"repo_id"`
Duration int64 `json:"duration"` //运行时长 单位秒
TrainJobDuration string `json:"train_job_duration"`
ImageID string `json:"image_id"` //grampus image_id
Image string `json:"image"`
Uuid string `json:"uuid"` //数据集id
DatasetName string `json:"dataset_name"`
ComputeResource string `json:"compute_resource"` //计算资源,例如npu
AiCenter string `json:"ai_center"` //grampus ai center: center_id+center_name
BranchName string `json:"branch_name"` //分支名称
Parameters string `json:"parameters"` //传给modelarts的param参数
BootFile string `json:"boot_file"` //启动文件
Description string `json:"description"` //描述
ModelName string `json:"model_name"` //模型名称
ModelVersion string `json:"model_version"` //模型版本
CkptName string `json:"ckpt_name"` //权重文件名称
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
VersionName string `json:"version_name"`
Spec *SpecificationShow `json:"spec"`
} }


type SpecificationShow struct { type SpecificationShow struct {


+ 8
- 2
modules/templates/helper.go View File

@@ -98,11 +98,15 @@ func NewFuncMap() []template.FuncMap {
"AllowedReactions": func() []string { "AllowedReactions": func() []string {
return setting.UI.Reactions return setting.UI.Reactions
}, },
"DebugAttachSize": func() int {
return setting.DebugAttachSize * 1000 * 1000 * 1000
},
"AvatarLink": models.AvatarLink, "AvatarLink": models.AvatarLink,
"Safe": Safe, "Safe": Safe,
"SafeJS": SafeJS, "SafeJS": SafeJS,
"Str2html": Str2html, "Str2html": Str2html,
"subOne": subOne, "subOne": subOne,
"addOne": addOne,
"TimeStampNow": timeutil.TimeStampNow, "TimeStampNow": timeutil.TimeStampNow,
"TimeSince": timeutil.TimeSince, "TimeSince": timeutil.TimeSince,
"TimeSinceUnix": timeutil.TimeSinceUnix, "TimeSinceUnix": timeutil.TimeSinceUnix,
@@ -154,7 +158,7 @@ func NewFuncMap() []template.FuncMap {
"EscapePound": func(str string) string { "EscapePound": func(str string) string {
return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str) return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str)
}, },
"IpynbBool":func(str string) bool{
"IpynbBool": func(str string) bool {
return strings.Contains(str, ".ipynb") return strings.Contains(str, ".ipynb")
}, },
"nl2br": func(text string) template.HTML { "nl2br": func(text string) template.HTML {
@@ -472,7 +476,9 @@ func Str2html(raw string) template.HTML {
func subOne(length int) int { func subOne(length int) int {
return length - 1 return length - 1
} }

func addOne(length int64) int64 {
return length + 1
}
// Escape escapes a HTML string // Escape escapes a HTML string
func Escape(raw string) string { func Escape(raw string) string {
return html.EscapeString(raw) return html.EscapeString(raw)


+ 18
- 3
options/locale/locale_en-US.ini View File

@@ -406,6 +406,8 @@ sspi_auth_failed = SSPI authentication failed
change_email = Change email change_email = Change email
change_email_address = Change email address change_email_address = Change email address
new_email_address = New email address new_email_address = New email address
openi_community_really_awesome = OpenI, Really Awesome!

[phone] [phone]
format_err=The format of phone number is wrong. format_err=The format of phone number is wrong.
query_err=Fail to query phone number, please try again later. query_err=Fail to query phone number, please try again later.
@@ -1061,8 +1063,12 @@ model_rename=Duplicate model name, please modify model name.


notebook_file_not_exist=Notebook file does not exist. notebook_file_not_exist=Notebook file does not exist.
notebook_select_wrong=Please select a Notebook(.ipynb) file first. notebook_select_wrong=Please select a Notebook(.ipynb) file first.
notebook_path_too_long=The total length of selected file or files path exceed 255 characters, please select a shorter path file or change the file path.
notebook_branch_name_too_long=The total length of branch or branches name exceed 255 characters, please select a file in other branch.
notebook_file_no_right=You have no right to access the Notebook(.ipynb) file. notebook_file_no_right=You have no right to access the Notebook(.ipynb) file.
notebook_repo_conflict=The files in different branches of the same repository can not run together. notebook_repo_conflict=The files in different branches of the same repository can not run together.
debug_again_fail=Fail to restart debug task, please try again later.
debug_again_fail_forever=The task was scheduled failed last time, can not restart.


date=Date date=Date
repo_add=Project Increment repo_add=Project Increment
@@ -1080,6 +1086,7 @@ delete=Delete
more=More more=More
gpu_type_all=All gpu_type_all=All
model_download=Model Download model_download=Model Download
all_result_download=All result download
submit_image=Submit Image submit_image=Submit Image
modify_image=Modify Image modify_image=Modify Image
image_exist=Image name has been used, please use a new one. image_exist=Image name has been used, please use a new one.
@@ -1092,8 +1099,8 @@ image_delete_fail=Failed to delete image, please try again later.
image_overwrite=You had submitted the same name image before, are you sure to overwrite the original image? image_overwrite=You had submitted the same name image before, are you sure to overwrite the original image?
download=Download download=Download
score=Score score=Score
wait_count_start = There are currently
wait_count_end = tasks queued
wait_count_start = Your current queue position is
wait_count_end =
file_limit_100 = Display up to 100 files or folders in a single directory file_limit_100 = Display up to 100 files or folders in a single directory
images.name = Image Tag images.name = Image Tag
images.name_placerholder = Please enter the image name images.name_placerholder = Please enter the image name
@@ -1258,6 +1265,13 @@ modelarts.fullscreen_log_file = View in full screen
modelarts.exit_full_screen = Exit fullscreen modelarts.exit_full_screen = Exit fullscreen
modelarts.no_node_right = The value of 'Amount of Compute Node' is wrong, you have no right to use the current value of 'Amount of Compute Node'. modelarts.no_node_right = The value of 'Amount of Compute Node' is wrong, you have no right to use the current value of 'Amount of Compute Node'.


scrolled_logs_top = You have scrolled to the top of the log
scrolled_logs_top_pls_retry = You have scrolled to the top of the log, please try again later!
scrolled_logs_bottom = You have scrolled to the bottom of the log
scrolled_logs_bottom_pls_retry = You have scrolled to the bottom of the log, please try again later!

canceled_operation = You have canceled the operation
successfully_deleted = Successfully deleted


debug_task_not_created = Debug task has not been created debug_task_not_created = Debug task has not been created
train_task_not_created = Train task has not been created train_task_not_created = Train task has not been created
@@ -1471,7 +1485,7 @@ blame = Blame
normal_view = Normal View normal_view = Normal View
line = line line = line
lines = lines lines = lines
notebook_open = Open in Notebook
notebook_open = Run Online


editor.new_file = New File editor.new_file = New File
editor.upload_file = Upload File editor.upload_file = Upload File
@@ -3292,6 +3306,7 @@ point_hr = Point/hr
DEBUG = DEBUG DEBUG = DEBUG
SNN4IMAGENET = BENCHMARK SNN4IMAGENET = BENCHMARK
BRAINSCORE = BENCHMARK BRAINSCORE = BENCHMARK
SNN4ECOSET = BENCHMARK
MODELSAFETY = BENCHMARK MODELSAFETY = BENCHMARK
TRAIN = TRAIN TRAIN = TRAIN
INFERENCE = INFERENCE INFERENCE = INFERENCE


+ 19
- 4
options/locale/locale_zh-CN.ini View File

@@ -409,6 +409,8 @@ sspi_auth_failed=SSPI 认证失败
change_email=修改邮箱 change_email=修改邮箱
change_email_address=修改邮箱地址 change_email_address=修改邮箱地址
new_email_address=新邮箱地址 new_email_address=新邮箱地址
openi_community_really_awesome=启智社区 确实给力

[phone] [phone]
format_err=手机号格式错误。 format_err=手机号格式错误。
query_err=查询手机号失败,请稍后再试。 query_err=查询手机号失败,请稍后再试。
@@ -1060,8 +1062,12 @@ model_rename=模型名称重复,请修改模型名称


notebook_file_not_exist=Notebook文件不存在。 notebook_file_not_exist=Notebook文件不存在。
notebook_select_wrong=请先选择Notebook(.ipynb)文件。 notebook_select_wrong=请先选择Notebook(.ipynb)文件。
notebook_path_too_long=选择的一个或多个Notebook文件路径总长度超过255个字符,请选择路径较短的文件或调整文件路径。
notebook_branch_name_too_long=选择的一个或多个Notebook文件分支名总长度超过255个字符,请选择其他分支的文件。
notebook_file_no_right=您没有这个Notebook文件的读权限。 notebook_file_no_right=您没有这个Notebook文件的读权限。
notebook_repo_conflict=同一个仓库的不同分支文件不能同时运行。 notebook_repo_conflict=同一个仓库的不同分支文件不能同时运行。
debug_again_fail=再次调试失败,请稍后再试。
debug_again_fail_forever=这个任务之前没有调度成功,不能再次调试。


date=日期 date=日期
repo_add=新增项目 repo_add=新增项目
@@ -1079,6 +1085,7 @@ delete=删除
more=更多 more=更多
gpu_type_all=全部 gpu_type_all=全部
model_download=结果下载 model_download=结果下载
all_result_download=全部结果下载
submit_image=提交镜像 submit_image=提交镜像
modify_image=修改镜像 modify_image=修改镜像
image_exist=镜像Tag已被使用,请修改镜像Tag。 image_exist=镜像Tag已被使用,请修改镜像Tag。
@@ -1091,8 +1098,8 @@ image_delete_fail=删除镜像失败,请稍后再试。
image_overwrite=您已经提交过相同名称的镜像,您确定要覆盖原来提交的镜像吗? image_overwrite=您已经提交过相同名称的镜像,您确定要覆盖原来提交的镜像吗?
download=模型下载 download=模型下载
score=评分 score=评分
wait_count_start = 当前有
wait_count_end = 个任务正在排队
wait_count_start = 您当前排队位置是第
wait_count_end =
file_limit_100 = 单目录下最多显示100个文件或文件夹 file_limit_100 = 单目录下最多显示100个文件或文件夹
images.name = 镜像Tag images.name = 镜像Tag
images.name_placerholder = 请输入镜像Tag images.name_placerholder = 请输入镜像Tag
@@ -1270,6 +1277,13 @@ modelarts.fullscreen_log_file=全屏查看
modelarts.exit_full_screen=退出全屏 modelarts.exit_full_screen=退出全屏
modelarts.no_node_right = 计算节点数的值配置错误,您没有权限使用当前配置的计算节点数。 modelarts.no_node_right = 计算节点数的值配置错误,您没有权限使用当前配置的计算节点数。


scrolled_logs_top = 您已翻阅至日志顶部
scrolled_logs_top_pls_retry = 您已翻阅至日志顶部,请稍后再试!
scrolled_logs_bottom = 您已翻阅至日志底部
scrolled_logs_bottom_pls_retry = 您已翻阅至日志底部,请稍后再试!

canceled_operation = 您已取消操作
successfully_deleted = 删除成功


debug_task_not_created = 未创建过调试任务 debug_task_not_created = 未创建过调试任务
train_task_not_created = 未创建过训练任务 train_task_not_created = 未创建过训练任务
@@ -1489,7 +1503,7 @@ normal_view=普通视图
line=行 line=行
lines=行 lines=行


notebook_open = 在Notebook中打开
notebook_open = 在线运行


editor.new_file=新建文件 editor.new_file=新建文件
editor.upload_file=上传文件 editor.upload_file=上传文件
@@ -3313,6 +3327,7 @@ point_hr = 积分/时
DEBUG = 调试任务 DEBUG = 调试任务
SNN4IMAGENET = 评测任务 SNN4IMAGENET = 评测任务
BRAINSCORE = 评测任务 BRAINSCORE = 评测任务
SNN4ECOSET = 评测任务
MODELSAFETY = 评测任务 MODELSAFETY = 评测任务
TRAIN = 训练任务 TRAIN = 训练任务
INFERENCE = 推理任务 INFERENCE = 推理任务
@@ -3326,7 +3341,7 @@ Stopped_failed=任务停止失败,请稍后再试。
Stopped_success_update_status_fail=任务停止成功,状态及运行时间更新失败。 Stopped_success_update_status_fail=任务停止成功,状态及运行时间更新失败。
load_code_failed=代码加载失败,请确认选择了正确的分支。 load_code_failed=代码加载失败,请确认选择了正确的分支。


error.debug_datasetsize = 数据集大小超过限制('%d'GB)
error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集 error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集
new_train_gpu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 new_train_gpu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。
new_debug_gpu_tooltips = 项目代码存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,选择的模型存储在 <strong style="color:#010101">%s</strong> 中,调试输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 new_debug_gpu_tooltips = 项目代码存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,选择的模型存储在 <strong style="color:#010101">%s</strong> 中,调试输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。


+ 34
- 65
package-lock.json View File

@@ -1982,28 +1982,6 @@
"object.assign": "^4.1.0" "object.assign": "^4.1.0"
} }
}, },
"babel-polyfill": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-polyfill/download/babel-polyfill-6.26.0.tgz",
"integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=",
"requires": {
"babel-runtime": "^6.26.0",
"core-js": "^2.5.0",
"regenerator-runtime": "^0.10.5"
},
"dependencies": {
"core-js": {
"version": "2.6.12",
"resolved": "https://registry.npm.taobao.org/core-js/download/core-js-2.6.12.tgz?cache=0&sync_timestamp=1611040749668&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcore-js%2Fdownload%2Fcore-js-2.6.12.tgz",
"integrity": "sha1-2TM9+nsGXjR8xWgiGdb2kIWcwuw="
},
"regenerator-runtime": {
"version": "0.10.5",
"resolved": "https://registry.npm.taobao.org/regenerator-runtime/download/regenerator-runtime-0.10.5.tgz",
"integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg="
}
}
},
"babel-runtime": { "babel-runtime": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
@@ -2194,9 +2172,9 @@
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
}, },
"blueimp-md5": { "blueimp-md5": {
"version": "2.18.0",
"resolved": "https://registry.npm.taobao.org/blueimp-md5/download/blueimp-md5-2.18.0.tgz",
"integrity": "sha1-EVK+EzXwxrORHtnjbbVPPmrFKTU="
"version": "2.19.0",
"resolved": "https://registry.npmjs.org/blueimp-md5/-/blueimp-md5-2.19.0.tgz",
"integrity": "sha512-DRQrD6gJyy8FbiE4s+bDoXS9hiW3Vbx5uCdwvcCf3zLHL+Iv7LtGHLpr+GZV8rHG8tK766FGYBwRbu8pELTt+w=="
}, },
"bn.js": { "bn.js": {
"version": "5.1.1", "version": "5.1.1",
@@ -3536,6 +3514,11 @@
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz",
"integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=" "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI="
}, },
"dayjs": {
"version": "1.10.7",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
"integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig=="
},
"de-indent": { "de-indent": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
@@ -4152,25 +4135,29 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
}, },
"esdk-obs-browserjs": { "esdk-obs-browserjs": {
"version": "3.20.7",
"resolved": "https://registry.npm.taobao.org/esdk-obs-browserjs/download/esdk-obs-browserjs-3.20.7.tgz",
"integrity": "sha1-vhziRlKEhW3PgZPl0DyX68bJI0s=",
"version": "3.22.3",
"resolved": "https://registry.npmjs.org/esdk-obs-browserjs/-/esdk-obs-browserjs-3.22.3.tgz",
"integrity": "sha512-MATZXp0FwjPtKG9tpdfURa3koUarR/ev+tbO0oUKgj0GRt0798ZxmfCvYvRpgNst4w1ht4E79ikD4H40UYLgPA==",
"requires": { "requires": {
"axios": "^0.19.0",
"babel-polyfill": "^6.26.0",
"blueimp-md5": "^2.10.0",
"js-base64": "^2.3.2",
"jssha": "^2.3.1",
"urijs": "^1.19.1"
"axios": "^0.26.1",
"blueimp-md5": "^2.18.0",
"js-base64": "^3.7.1",
"jssha": "^3.2.0",
"urijs": "^1.19.7"
}, },
"dependencies": { "dependencies": {
"axios": { "axios": {
"version": "0.19.2",
"resolved": "https://registry.npm.taobao.org/axios/download/axios-0.19.2.tgz?cache=0&sync_timestamp=1608609215811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faxios%2Fdownload%2Faxios-0.19.2.tgz",
"integrity": "sha1-PqNsXYgY0NX4qKl6bTa4bNwAyyc=",
"version": "0.26.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz",
"integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==",
"requires": { "requires": {
"follow-redirects": "1.5.10"
"follow-redirects": "^1.14.8"
} }
},
"js-base64": {
"version": "3.7.3",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.3.tgz",
"integrity": "sha512-PAr6Xg2jvd7MCR6Ld9Jg3BmTcjYsHEBx1VlwEwULb/qowPf5VD9kEMagj23Gm7JRnSvE/Da/57nChZjnvL8v6A=="
} }
} }
}, },
@@ -5382,27 +5369,9 @@
} }
}, },
"follow-redirects": { "follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npm.taobao.org/follow-redirects/download/follow-redirects-1.5.10.tgz?cache=0&sync_timestamp=1611606737937&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ffollow-redirects%2Fdownload%2Ffollow-redirects-1.5.10.tgz",
"integrity": "sha1-e3qfmuov3/NnhqlP9kPtB/T/Xio=",
"requires": {
"debug": "=3.1.0"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/debug/download/debug-3.1.0.tgz?cache=0&sync_timestamp=1607566533140&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdebug%2Fdownload%2Fdebug-3.1.0.tgz",
"integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz",
"integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA=="
}, },
"fomantic-ui": { "fomantic-ui": {
"version": "2.8.4", "version": "2.8.4",
@@ -7884,9 +7853,9 @@
} }
}, },
"jssha": { "jssha": {
"version": "2.4.2",
"resolved": "https://registry.npm.taobao.org/jssha/download/jssha-2.4.2.tgz",
"integrity": "sha1-2VCwlWNJKL1rK9odQtqaOnYtZek="
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/jssha/-/jssha-3.3.0.tgz",
"integrity": "sha512-w9OtT4ALL+fbbwG3gw7erAO0jvS5nfvrukGPMWIAoea359B26ALXGpzy4YJSp9yGnpUvuvOw1nSjSoHDfWSr1w=="
}, },
"just-debounce": { "just-debounce": {
"version": "1.0.0", "version": "1.0.0",
@@ -14400,9 +14369,9 @@
} }
}, },
"urijs": { "urijs": {
"version": "1.19.6",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.6.tgz",
"integrity": "sha512-eSXsXZ2jLvGWeLYlQA3Gh36BcjF+0amo92+wHPyN1mdR8Nxf75fuEuYTd9c0a+m/vhCjRK0ESlE9YNLW+E1VEw=="
"version": "1.19.11",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz",
"integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ=="
}, },
"urix": { "urix": {
"version": "0.1.0", "version": "0.1.0",


BIN
public/img/login_bg_default.png View File

Before After
Width: 1200  |  Height: 938  |  Size: 142 kB

+ 1
- 1
routers/admin/cloudbrains.go View File

@@ -53,7 +53,7 @@ func CloudBrains(ctx *context.Context) {
var jobTypes []string var jobTypes []string
jobTypeNot := false jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) { if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset))
} else if jobType != "all" && jobType != "" { } else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType) jobTypes = append(jobTypes, jobType)
} }


+ 2
- 0
routers/api/v1/api.go View File

@@ -549,6 +549,8 @@ func RegisterRoutes(m *macaron.Macaron) {


}, reqToken()) }, reqToken())


m.Get("/compute-nodes", reqToken(), user.GetComputeNodes)

// Notifications // Notifications
m.Group("/notifications", func() { m.Group("/notifications", func() {
m.Combo(""). m.Combo("").


+ 45
- 0
routers/api/v1/repo/attachments.go View File

@@ -1,22 +1,67 @@
package repo package repo


import ( import (
"net/http"

"code.gitea.io/gitea/modules/log"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
routeRepo "code.gitea.io/gitea/routers/repo" routeRepo "code.gitea.io/gitea/routers/repo"
) )


func GetSuccessChunks(ctx *context.APIContext) { func GetSuccessChunks(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}

routeRepo.GetSuccessChunks(ctx.Context) routeRepo.GetSuccessChunks(ctx.Context)
} }


func checkDatasetPermission(ctx *context.APIContext) string {
datasetId := ctx.QueryInt64("dataset_id")

dataset, err := models.GetDatasetByID(datasetId)
if err != nil {
log.Warn("can not find dataset", err)

return "dataset.query_dataset_fail"
}
repo, err := models.GetRepositoryByID(dataset.RepoID)
if err != nil {
log.Warn("can not find repo", err)
return "dataset.query_dataset_fail"
}

permission, err := models.GetUserRepoPermission(repo, ctx.User)
if err != nil {
log.Warn("can not find repo permission for user", err)
return "dataset.query_dataset_fail"
}
if !permission.CanWrite(models.UnitTypeDatasets) {

return "error.no_right"
}
return ""
}

func NewMultipart(ctx *context.APIContext) { func NewMultipart(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.NewMultipart(ctx.Context) routeRepo.NewMultipart(ctx.Context)
} }
func GetMultipartUploadUrl(ctx *context.APIContext) { func GetMultipartUploadUrl(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.GetMultipartUploadUrl(ctx.Context) routeRepo.GetMultipartUploadUrl(ctx.Context)
} }


func CompleteMultipart(ctx *context.APIContext) { func CompleteMultipart(ctx *context.APIContext) {
if errStr := checkDatasetPermission(ctx); errStr != "" {
ctx.JSON(http.StatusForbidden, ctx.Tr(errStr))
}
routeRepo.CompleteMultipart(ctx.Context) routeRepo.CompleteMultipart(ctx.Context)


} }


+ 46
- 17
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -623,7 +623,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) {
} }


jobTypeList := []string{string(models.JobTypeDebug), string(models.JobTypeTrain), string(models.JobTypeInference), string(models.JobTypeBenchmark), jobTypeList := []string{string(models.JobTypeDebug), string(models.JobTypeTrain), string(models.JobTypeInference), string(models.JobTypeBenchmark),
string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)}
string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset)}
for _, v := range jobTypeList { for _, v := range jobTypeList {
if _, ok := cloudOneJobTypeRes[v]; !ok { if _, ok := cloudOneJobTypeRes[v]; !ok {
cloudOneJobTypeRes[v] = 0 cloudOneJobTypeRes[v] = 0
@@ -645,7 +645,7 @@ func GetAllCloudbrainsPeriodDistribution(ctx *context.Context) {
} }
} }


ComputeResourceList := []string{"CPU/GPU", "NPU"}
ComputeResourceList := []string{"CPU/GPU", "NPU", "GCU"}
for _, v := range ComputeResourceList { for _, v := range ComputeResourceList {
if _, ok := cloudBrainComputeResource[v]; !ok { if _, ok := cloudBrainComputeResource[v]; !ok {
cloudBrainComputeResource[v] = 0 cloudBrainComputeResource[v] = 0
@@ -687,7 +687,6 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
return return
} }
recordBeginTime := recordCloudbrain[0].Cloudbrain.CreatedUnix recordBeginTime := recordCloudbrain[0].Cloudbrain.CreatedUnix
endTime := time.Now()
listType := ctx.Query("listType") listType := ctx.Query("listType")
jobType := ctx.Query("jobType") jobType := ctx.Query("jobType")
jobStatus := ctx.Query("jobStatus") jobStatus := ctx.Query("jobStatus")
@@ -695,6 +694,33 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
aiCenter := ctx.Query("aiCenter") aiCenter := ctx.Query("aiCenter")
needDeleteInfo := ctx.Query("needDeleteInfo") needDeleteInfo := ctx.Query("needDeleteInfo")


accCardType := ctx.Query("accCardType")
accCardsNum := ctx.QueryInt("accCardsNum")
workServerNumber := ctx.QueryInt("workServerNumber")
beginTimeStr := ctx.QueryTrim("beginTime")
endTimeStr := ctx.QueryTrim("endTime")
var beginTimeUnix int64
var endTimeUnix int64
if beginTimeStr == "" || endTimeStr == "" {
beginTimeUnix = int64(recordBeginTime)
endTimeUnix = time.Now().Unix()
} else {
beginTime, err := time.ParseInLocation("2006-01-02T15:04:05", beginTimeStr, time.Local)
if err != nil {
log.Error("Can not ParseInLocation.", err)
ctx.Error(http.StatusBadRequest, ctx.Tr("ParseInLocation_get_error"))
return
}
beginTimeUnix = beginTime.Unix()
endTime, err := time.ParseInLocation("2006-01-02T15:04:05", endTimeStr, time.Local)
if err != nil {
log.Error("Can not ParseInLocation.", err)
ctx.Error(http.StatusBadRequest, ctx.Tr("ParseInLocation_get_error"))
return
}
endTimeUnix = endTime.Unix()
}

if cloudBrainType == models.TypeCloudBrainOne && aiCenter == models.AICenterOfCloudBrainOne { if cloudBrainType == models.TypeCloudBrainOne && aiCenter == models.AICenterOfCloudBrainOne {
aiCenter = "" aiCenter = ""
} }
@@ -730,7 +756,7 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
var jobTypes []string var jobTypes []string
jobTypeNot := false jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) { if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset))
} else if jobType != "all" && jobType != "" { } else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType) jobTypes = append(jobTypes, jobType)
} }
@@ -753,18 +779,21 @@ func GetCloudbrainsDetailData(ctx *context.Context) {
Page: page, Page: page,
PageSize: pageSize, PageSize: pageSize,
}, },
Keyword: keyword,
Type: cloudBrainType,
ComputeResource: listType,
JobTypeNot: jobTypeNot,
JobStatusNot: jobStatusNot,
JobStatus: jobStatuses,
JobTypes: jobTypes,
NeedRepoInfo: true,
BeginTimeUnix: int64(recordBeginTime),
EndTimeUnix: endTime.Unix(),
AiCenter: aiCenter,
NeedDeleteInfo: needDeleteInfo,
Keyword: keyword,
Type: cloudBrainType,
ComputeResource: listType,
JobTypeNot: jobTypeNot,
JobStatusNot: jobStatusNot,
JobStatus: jobStatuses,
JobTypes: jobTypes,
NeedRepoInfo: true,
BeginTimeUnix: beginTimeUnix,
EndTimeUnix: endTimeUnix,
AiCenter: aiCenter,
NeedDeleteInfo: needDeleteInfo,
AccCardType: accCardType,
AccCardsNum: accCardsNum,
WorkServerNumber: workServerNumber,
}) })
if err != nil { if err != nil {
ctx.ServerError("Get job failed:", err) ctx.ServerError("Get job failed:", err)
@@ -1039,7 +1068,7 @@ func getCloudbrainCount(beginTime time.Time, endTime time.Time, cloudbrains []*m
} }
} }


ComputeResourceList := []string{"CPU/GPU", "NPU"}
ComputeResourceList := []string{"CPU/GPU", "NPU", "GCU"}
for _, v := range ComputeResourceList { for _, v := range ComputeResourceList {
if _, ok := cloudBrainComputeResource[v]; !ok { if _, ok := cloudBrainComputeResource[v]; !ok {
cloudBrainComputeResource[v] = 0 cloudBrainComputeResource[v] = 0


+ 20
- 0
routers/api/v1/user/repo.go View File

@@ -5,6 +5,7 @@
package user package user


import ( import (
"code.gitea.io/gitea/modules/modelarts"
"net/http" "net/http"


"code.gitea.io/gitea/models" "code.gitea.io/gitea/models"
@@ -146,3 +147,22 @@ func ListOrgRepos(ctx *context.APIContext) {


listUserRepos(ctx, ctx.Org.Organization, ctx.IsSigned) listUserRepos(ctx, ctx.Org.Organization, ctx.IsSigned)
} }

func GetComputeNodes(ctx *context.APIContext) {
taskeType := ctx.QueryInt("type")
if taskeType == 2 {
ctx.JSON(http.StatusOK, []int{1})
} else {
modelarts.InitMultiNode()
if modelarts.MultiNodeConfig != nil {
for _, info := range modelarts.MultiNodeConfig.Info {
if isInOrg, _ := models.IsOrganizationMemberByOrgName(info.Org, ctx.User.ID); isInOrg {
ctx.JSON(http.StatusOK, info.Node)
return
}
}
}
ctx.JSON(http.StatusOK, []int{1})
}

}

+ 85
- 31
routers/repo/cloudbrain.go View File

@@ -285,7 +285,7 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
} }
var datasetInfos map[string]models.DatasetInfo var datasetInfos map[string]models.DatasetInfo
var datasetNames string var datasetNames string
//var
var attachSize int
if uuids != "" { if uuids != "" {
datasetInfos, datasetNames, err = models.GetDatasetInfo(uuids) datasetInfos, datasetNames, err = models.GetDatasetInfo(uuids)
if err != nil { if err != nil {
@@ -294,6 +294,18 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.dataset_select"), tpl, &form) ctx.RenderWithErr(ctx.Tr("cloudbrain.error.dataset_select"), tpl, &form)
return return
} }

if jobType == string(models.JobTypeDebug) {
for _, infos := range datasetInfos {
attachSize += infos.Size
}
if attachSize > int(setting.DebugAttachSize*1000*1000*1000) {
log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) // GB
cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", int(setting.DebugAttachSize*1000*1000*1000)), tpl, &form)
return
}
}
} }


command := cloudbrain.GetCloudbrainDebugCommand() command := cloudbrain.GetCloudbrainDebugCommand()
@@ -387,7 +399,6 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {
req.ModelVersion = form.ModelVersion req.ModelVersion = form.ModelVersion
req.PreTrainModelPath = setting.Attachment.Minio.RealPath + form.PreTrainModelUrl req.PreTrainModelPath = setting.Attachment.Minio.RealPath + form.PreTrainModelUrl
req.PreTrainModelUrl = form.PreTrainModelUrl req.PreTrainModelUrl = form.PreTrainModelUrl

} }


_, err = cloudbrain.GenerateTask(req) _, err = cloudbrain.GenerateTask(req)
@@ -735,6 +746,7 @@ func CloudBrainRestart(ctx *context.Context) {
}) })
} }



func hasDatasetDeleted(task *models.Cloudbrain) bool { func hasDatasetDeleted(task *models.Cloudbrain) bool {
if task.Uuid == "" { if task.Uuid == "" {
return false return false
@@ -843,7 +855,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo


if task.JobType == string(models.JobTypeBenchmark) { if task.JobType == string(models.JobTypeBenchmark) {
task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm") task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm")
} else if task.JobType == string(models.JobTypeSnn4imagenet) || task.JobType == string(models.JobTypeBrainScore) {
} else if models.IsModelBenchMarkJobType(task.JobType) {
task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model") task.BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model")
task.BenchmarkTypeName = task.JobType task.BenchmarkTypeName = task.JobType
ctx.Data["BenchmarkTypeName"] = task.JobType ctx.Data["BenchmarkTypeName"] = task.JobType
@@ -1692,6 +1704,8 @@ func GetRate(ctx *context.Context) {
ctx.Redirect(setting.Snn4imagenetServerHost) ctx.Redirect(setting.Snn4imagenetServerHost)
} else if job.JobType == string(models.JobTypeBrainScore) { } else if job.JobType == string(models.JobTypeBrainScore) {
ctx.Redirect(setting.BrainScoreServerHost) ctx.Redirect(setting.BrainScoreServerHost)
} else if job.JobType == string(models.JobTypeSnn4Ecoset) {
ctx.Redirect(setting.Snn4EcosetServerHost)
} else { } else {
log.Error("JobType error:%s", job.JobType, ctx.Data["msgID"]) log.Error("JobType error:%s", job.JobType, ctx.Data["msgID"])
} }
@@ -2164,7 +2178,7 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
} }


var jobTypes []string var jobTypes []string
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeModelSafety))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset), string(models.JobTypeModelSafety))
ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{ ciTasks, count, err := models.Cloudbrains(&models.CloudbrainsOptions{
ListOptions: models.ListOptions{ ListOptions: models.ListOptions{
Page: page, Page: page,
@@ -2197,14 +2211,16 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) {
ciTasks[i].BenchmarkTypeName = "" ciTasks[i].BenchmarkTypeName = ""
if ciTasks[i].JobType == string(models.JobTypeBenchmark) { if ciTasks[i].JobType == string(models.JobTypeBenchmark) {
ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm") ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.algorithm")
} else if ciTasks[i].JobType == string(models.JobTypeSnn4imagenet) || ciTasks[i].JobType == string(models.JobTypeBrainScore) {
} else if models.IsModelBenchMarkJobType(ciTasks[i].JobType) {
ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model") ciTasks[i].BenchmarkType = ctx.Tr("repo.cloudbrain.benchmark.model")
ciTasks[i].BenchmarkTypeName = ciTasks[i].JobType ciTasks[i].BenchmarkTypeName = ciTasks[i].JobType


if ciTasks[i].JobType == string(models.JobTypeSnn4imagenet) { if ciTasks[i].JobType == string(models.JobTypeSnn4imagenet) {
ciTasks[i].BenchmarkTypeRankLink = setting.Snn4imagenetServerHost ciTasks[i].BenchmarkTypeRankLink = setting.Snn4imagenetServerHost
} else {
} else if ciTasks[i].JobType == string(models.JobTypeBrainScore) {
ciTasks[i].BenchmarkTypeRankLink = setting.BrainScoreServerHost ciTasks[i].BenchmarkTypeRankLink = setting.BrainScoreServerHost
} else {
ciTasks[i].BenchmarkTypeRankLink = setting.Snn4EcosetServerHost
} }


} }
@@ -2554,7 +2570,6 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
displayJobName := form.DisplayJobName displayJobName := form.DisplayJobName
jobName := util.ConvertDisplayJobNameToJobName(displayJobName) jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
image := form.Image image := form.Image
uuid := form.Attachment
jobType := form.JobType jobType := form.JobType
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath
branchName := cloudbrain.DefaultBranchName branchName := cloudbrain.DefaultBranchName
@@ -2596,7 +2611,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
return return
} }


if jobType != string(models.JobTypeSnn4imagenet) && jobType != string(models.JobTypeBrainScore) {
if !models.IsModelBenchMarkJobType(jobType) {
log.Error("jobtype error:", jobType, ctx.Data["MsgID"]) log.Error("jobtype error:", jobType, ctx.Data["MsgID"])
cloudBrainNewDataPrepare(ctx, jobType) cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr("jobtype error", tpl, &form) ctx.RenderWithErr("jobtype error", tpl, &form)
@@ -2625,29 +2640,41 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
mkModelPath(modelPath) mkModelPath(modelPath)
uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/") uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/")


snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath
benchmarkPath := setting.JobPath + jobName + cloudbrain.BenchMarkMountPath
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) { if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "", ctx.User.Name)
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description))
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, benchmarkPath, "", "", ctx.User.Name)
uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))


} }
benchmarkChildTypeID := 0 benchmarkChildTypeID := 0
brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath
if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) { if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) {
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "", ctx.User.Name)
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, benchmarkPath, "", "", ctx.User.Name)
uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/")
benchmarkChildTypeID = form.BenchmarkChildTypeID benchmarkChildTypeID = form.BenchmarkChildTypeID
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description))
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))
} }
var uuid string
var datasetInfos map[string]models.DatasetInfo
var datasetNames string
if setting.IsSnn4EcosetEnabled && jobType == string(models.JobTypeSnn4Ecoset) {
downloadRateCode(repo, jobName, setting.Snn4EcosetOwner, setting.Snn4EcosetName, benchmarkPath, "", "", ctx.User.Name)
uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4EcosetCommand, displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))

attachment, err := getEcosetAttachment()
if err != nil {
log.Error("load benchmark code failed", err)
cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain.morethanonejob"), tpl, &form)
return
}
uuid = attachment.UUID
datasetInfos, datasetNames, _ = models.GetDatasetInfo(uuid)


datasetInfos, datasetNames, err := models.GetDatasetInfo(uuid)
if err != nil {
log.Error("GetDatasetInfo failed: %v", err, ctx.Data["MsgID"])
cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.dataset_select"), tpl, &form)
return
} }

spec, err := resource.GetAndCheckSpec(ctx.User.ID, form.SpecId, models.FindSpecsOptions{ spec, err := resource.GetAndCheckSpec(ctx.User.ID, form.SpecId, models.FindSpecsOptions{
JobType: models.JobTypeBenchmark, JobType: models.JobTypeBenchmark,
ComputeResource: models.GPU, ComputeResource: models.GPU,
@@ -2679,8 +2706,6 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
CodePath: storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), CodePath: storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"),
ModelPath: storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), ModelPath: storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"),
BenchmarkPath: storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), BenchmarkPath: storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"),
Snn4ImageNetPath: storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"),
BrainScorePath: storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"),
JobType: jobType, JobType: jobType,
Description: form.Description, Description: form.Description,
BranchName: branchName, BranchName: branchName,
@@ -2692,6 +2717,14 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
ResultPath: storage.GetMinioPath(jobName, cloudbrain.ResultPath+"/"), ResultPath: storage.GetMinioPath(jobName, cloudbrain.ResultPath+"/"),
Spec: spec, Spec: spec,
} }
if form.ModelName != "" {
req.ModelName = form.ModelName
req.LabelName = form.LabelName
req.CkptName = form.CkptName
req.ModelVersion = form.ModelVersion
req.PreTrainModelPath = setting.Attachment.Minio.RealPath + form.PreTrainModelUrl
req.PreTrainModelUrl = form.PreTrainModelUrl
}


_, err = cloudbrain.GenerateTask(req) _, err = cloudbrain.GenerateTask(req)
if err != nil { if err != nil {
@@ -2703,6 +2736,21 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark") ctx.Redirect(setting.AppSubURL + ctx.Repo.RepoLink + "/cloudbrain/benchmark")
} }


func getEcosetAttachment() (*models.Attachment, error) {
ecosetRepo, err := models.GetRepositoryByOwnerAndName(setting.Snn4EcosetOwner, setting.Snn4EcosetName)
if err != nil {
return nil, err
}

datasetInfo, err := models.GetDatasetByRepo(ecosetRepo)
if err != nil {
return nil, err
}

return models.GetAttachmentByDatasetIdFileName(setting.Snn4AttachmentName, datasetInfo.ID)

}

func getBrainRegion(benchmarkChildTypeID int) string { func getBrainRegion(benchmarkChildTypeID int) string {
values := []string{"V1", "V2", "V4", "IT"} values := []string{"V1", "V2", "V4", "IT"}
return values[benchmarkChildTypeID] return values[benchmarkChildTypeID]
@@ -2763,18 +2811,24 @@ func InferenceCloudBrainJobShow(ctx *context.Context) {
cloudBrainShow(ctx, tplCloudBrainInferenceJobShow, models.JobTypeInference) cloudBrainShow(ctx, tplCloudBrainInferenceJobShow, models.JobTypeInference)
} }


func DownloadInferenceResultFile(ctx *context.Context) {
func DownloadGPUInferenceResultFile(ctx *context.Context) {
var jobID = ctx.Params(":jobid") var jobID = ctx.Params(":jobid")
var versionName = ctx.Query("version_name")
task, err := models.GetCloudbrainByJobIDAndVersionName(jobID, versionName)
task, err := models.GetCloudbrainByJobID(jobID)
if err != nil { if err != nil {
log.Error("GetCloudbrainByJobID(%s) failed:%v", task.JobName, err.Error()) log.Error("GetCloudbrainByJobID(%s) failed:%v", task.JobName, err.Error())
return return
} }

allFile, err := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, task.ResultUrl)
returnFileName := task.DisplayJobName + ".zip"
MinioDownloadManyFile(task.ResultUrl, ctx, returnFileName, allFile)
parentDir := ctx.Query("parentDir")
filePath := "jobs/" + task.JobName + "/result/" + parentDir
log.Info("prefix=" + filePath)
allFile, err := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, filePath)
if err == nil {
returnFileName := task.DisplayJobName + ".zip"
MinioDownloadManyFile(filePath, ctx, returnFileName, allFile)
} else {
log.Info("error,msg=" + err.Error())
ctx.ServerError("no file to download.", err)
}
} }


func getInferenceJobCommand(form auth.CreateCloudBrainInferencForm) (string, error) { func getInferenceJobCommand(form auth.CreateCloudBrainInferencForm) (string, error) {


+ 1
- 0
routers/repo/dataset.go View File

@@ -373,6 +373,7 @@ func datasetMultiple(ctx *context.Context, opts *models.SearchDatasetOptions) {
} }


data, err := json.Marshal(datasets) data, err := json.Marshal(datasets)
log.Info("datakey", string(data))
if err != nil { if err != nil {
log.Error("json.Marshal failed:", err.Error()) log.Error("json.Marshal failed:", err.Error())
ctx.JSON(200, map[string]string{ ctx.JSON(200, map[string]string{


+ 23
- 1
routers/repo/grampus.go View File

@@ -1239,7 +1239,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
return return
} }
task.ContainerIp = "" task.ContainerIp = ""
task.User, _ = models.GetUserByID(task.UserID)
if task.DeletedAt.IsZero() { //normal record if task.DeletedAt.IsZero() { //normal record
result, err := grampus.GetJob(task.JobID) result, err := grampus.GetJob(task.JobID)
if err != nil { if err != nil {
@@ -1308,6 +1308,7 @@ func GrampusTrainJobShow(ctx *context.Context) {
taskList := make([]*models.Cloudbrain, 0) taskList := make([]*models.Cloudbrain, 0)
taskList = append(taskList, task) taskList = append(taskList, task)
prepareSpec4Show(ctx, task) prepareSpec4Show(ctx, task)
ctx.Data["version_list_task"] = taskList ctx.Data["version_list_task"] = taskList
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task)
@@ -1358,6 +1359,23 @@ func GrampusGetLog(ctx *context.Context) {
}) })
return return
} }
result, err := grampus.GetJob(jobID)
if err != nil {
log.Error("GetJob(%s) failed:%v", job.JobName, err)
ctx.JSON(http.StatusOK, map[string]interface{}{
"JobName": job.JobName,
"Content": content,
"CanLogDownload": false,
})
return
}
if result != nil {
job.Status = grampus.TransTrainJobStatus(result.JobInfo.Status)
if job.Status == models.GrampusStatusFailed {
content = content + "\n" + result.ExitDiagnostics
}
}

canLogDownload := err == nil && job.IsUserHasRight(ctx.User) canLogDownload := err == nil && job.IsUserHasRight(ctx.User)
ctx.JSON(http.StatusOK, map[string]interface{}{ ctx.JSON(http.StatusOK, map[string]interface{}{
"JobName": job.JobName, "JobName": job.JobName,
@@ -1682,6 +1700,10 @@ func GrampusNotebookRestart(ctx *context.Context) {
if res.GrampusResult.ErrorCode != 0 || res.NewId == "" { if res.GrampusResult.ErrorCode != 0 || res.NewId == "" {
log.Error("ManageNotebook2 failed:" + res.GrampusResult.ErrorMsg) log.Error("ManageNotebook2 failed:" + res.GrampusResult.ErrorMsg)
errorMsg = ctx.Tr("repo.debug_again_fail") errorMsg = ctx.Tr("repo.debug_again_fail")
if res.GrampusResult.ErrorCode == 5005 {
errorMsg = ctx.Tr("repo.debug_again_fail_forever")
}

break break
} }




+ 33
- 10
routers/repo/modelarts.go View File

@@ -218,6 +218,22 @@ func Notebook2Create(ctx *context.Context, form auth.CreateModelArtsNotebookForm
return return
} }
} }

var datasetInfos map[string]models.DatasetInfo
var attachSize int
if uuid != "" {
datasetInfos, _, err = models.GetDatasetInfo(uuid)
for _, infos := range datasetInfos {
attachSize += infos.Size
}
if attachSize > int(setting.DebugAttachSize*1000*1000*1000) {
log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) //GB
notebookNewDataPrepare(ctx)
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", int(setting.DebugAttachSize*1000*1000*1000)), tplModelArtsNotebookNew, &form)
return
}
}

var aiCenterCode = models.AICenterOfCloudBrainTwo var aiCenterCode = models.AICenterOfCloudBrainTwo
if setting.ModelartsCD.Enabled { if setting.ModelartsCD.Enabled {
aiCenterCode = models.AICenterOfChengdu aiCenterCode = models.AICenterOfChengdu
@@ -467,7 +483,7 @@ func getFileUrl(url string, filename string) string {
} }
} }


return url + middle + filename
return url + middle + filename + "?reset"
} }


func NotebookRestart(ctx *context.Context) { func NotebookRestart(ctx *context.Context) {
@@ -2593,7 +2609,8 @@ func inferenceJobErrorNewDataPrepare(ctx *context.Context, form auth.CreateModel
ctx.Data["datasetType"] = models.TypeCloudBrainTwo ctx.Data["datasetType"] = models.TypeCloudBrainTwo
waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "") waitCount := cloudbrain.GetWaitingCloudbrainCount(models.TypeCloudBrainTwo, "")
ctx.Data["WaitCount"] = waitCount ctx.Data["WaitCount"] = waitCount

NotStopTaskCount, _ := cloudbrainTask.GetNotFinalStatusTaskCount(ctx.User.ID, models.TypeCloudBrainTwo, string(models.JobTypeInference))
ctx.Data["NotStopTaskCount"] = NotStopTaskCount
return nil return nil
} }
func InferenceJobShow(ctx *context.Context) { func InferenceJobShow(ctx *context.Context) {
@@ -2673,6 +2690,8 @@ func MultiModelDownload(ctx *context.Context) {


if task.ComputeResource == models.NPUResource { if task.ComputeResource == models.NPUResource {
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, setting.OutPutPath, versionName, parentDir), "/") path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, setting.OutPutPath, versionName, parentDir), "/")
path = strings.TrimSuffix(path, "/")
path += "/"
allFile, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, path) allFile, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, path)
if err == nil { if err == nil {
returnFileName := task.DisplayJobName + ".zip" returnFileName := task.DisplayJobName + ".zip"
@@ -2874,15 +2893,19 @@ func TrainJobDownloadLogFile(ctx *context.Context) {
ctx.ServerError("GetObsLogFileName", err) ctx.ServerError("GetObsLogFileName", err)
return return
} }

url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, key)
if err != nil {
log.Error("GetObsCreateSignedUrlByBucketAndKey failed: %v", err.Error(), ctx.Data["msgID"])
ctx.ServerError("GetObsCreateSignedUrlByBucketAndKey", err)
return
if len(key) > 1 {
ObsDownloadManyFile(prefix[0:len(prefix)-3], ctx, task.DisplayJobName+".zip", key)
} else {
url, err := storage.GetObsCreateSignedUrlByBucketAndKey(setting.Bucket, key[0].ParenDir+key[0].FileName)
if err != nil {
log.Error("GetObsCreateSignedUrlByBucketAndKey failed: %v", err.Error(), ctx.Data["msgID"])
ctx.ServerError("GetObsCreateSignedUrlByBucketAndKey", err)
return
}
ctx.Resp.Header().Set("Cache-Control", "max-age=0")
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusTemporaryRedirect)
} }
ctx.Resp.Header().Set("Cache-Control", "max-age=0")
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusTemporaryRedirect)

} }
func getDatasUrlListByUUIDS(uuidStr string) ([]models.Datasurl, string, string, bool, error) { func getDatasUrlListByUUIDS(uuidStr string) ([]models.Datasurl, string, string, bool, error) {
var isMultiDataset bool var isMultiDataset bool


+ 6
- 4
routers/routes/routes.go View File

@@ -1210,7 +1210,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainTrainJobDel) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainTrainJobDel)
//m.Get("/models", reqRepoCloudBrainReader, repo.CloudBrainShowModels) //m.Get("/models", reqRepoCloudBrainReader, repo.CloudBrainShowModels)
m.Get("/download_model", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainDownloadModel) m.Get("/download_model", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainDownloadModel)
m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDownloadMultiModel)
m.Get("/download_multi_model", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.CloudBrainDownloadMultiModel)
//m.Get("/get_log", cloudbrain.AdminOrJobCreaterRightForTrain, repo.GetLogFromModelDir) //m.Get("/get_log", cloudbrain.AdminOrJobCreaterRightForTrain, repo.GetLogFromModelDir)
//m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) //m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion)
m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.CloudBrainTrainJobVersionNew) m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.CloudBrainTrainJobVersionNew)
@@ -1223,8 +1223,8 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/:jobid", func() { m.Group("/:jobid", func() {
m.Get("", reqRepoCloudBrainReader, repo.InferenceCloudBrainJobShow) m.Get("", reqRepoCloudBrainReader, repo.InferenceCloudBrainJobShow)
m.Get("/result_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.CloudBrainDownloadInferenceResult) m.Get("/result_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.CloudBrainDownloadInferenceResult)
m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDownloadMultiModel)
m.Get("/downloadall", repo.DownloadInferenceResultFile)
m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRightForTrain, repo.CloudBrainDownloadMultiModel)
m.Get("/downloadall", cloudbrain.AdminOrJobCreaterRightForTrain, repo.DownloadGPUInferenceResultFile)
}) })
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceCloudBrainJobNew) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceCloudBrainJobNew)
m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainInferencForm{}), repo.CloudBrainInferenceJobCreate) m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainInferencForm{}), repo.CloudBrainInferenceJobCreate)
@@ -1250,6 +1250,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.GrampusStopJob) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.GrampusStopJob)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.GrampusTrainJobDel) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.GrampusTrainJobDel)
m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload) m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload)
m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRightForTrain, repo.MultiModelDownload)
m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.GrampusTrainJobVersionNew) m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, repo.GrampusTrainJobVersionNew)
m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateGrampusTrainJobForm{}), repo.GrampusTrainJobVersionCreate) m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateGrampusTrainJobForm{}), repo.GrampusTrainJobVersionCreate)
}) })
@@ -1335,6 +1336,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobStop) m.Post("/stop", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobStop)
m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobDel) m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRightForTrain, repo.TrainJobDel)
m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload) m.Get("/model_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ModelDownload)
m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRightForTrain, repo.MultiModelDownload)
m.Get("/download_log_file", cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobDownloadLogFile) m.Get("/download_log_file", cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobDownloadLogFile)
m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, context.PointAccount(), repo.TrainJobNewVersion) m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, context.PointAccount(), repo.TrainJobNewVersion)
m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion)
@@ -1350,7 +1352,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/:jobid", func() { m.Group("/:jobid", func() {
m.Get("", reqRepoCloudBrainReader, repo.InferenceJobShow) m.Get("", reqRepoCloudBrainReader, repo.InferenceJobShow)
m.Get("/result_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ResultDownload) m.Get("/result_download", cloudbrain.AdminOrJobCreaterRightForTrain, repo.ResultDownload)
m.Get("/downloadall", repo.DownloadMultiResultFile)
m.Get("/downloadall", cloudbrain.AdminOrJobCreaterRightForTrain, repo.DownloadMultiResultFile)
}) })
m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceJobNew) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceJobNew)
m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsInferenceJobForm{}), repo.InferenceJobCreate) m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsInferenceJobForm{}), repo.InferenceJobCreate)


+ 14
- 0
routers/user/auth.go View File

@@ -36,6 +36,7 @@ import (
"code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/externalaccount" "code.gitea.io/gitea/services/externalaccount"
"code.gitea.io/gitea/services/mailer" "code.gitea.io/gitea/services/mailer"
"code.gitea.io/gitea/services/repository"


"gitea.com/macaron/captcha" "gitea.com/macaron/captcha"
"github.com/markbates/goth" "github.com/markbates/goth"
@@ -145,6 +146,11 @@ func checkAutoLogin(ctx *context.Context) bool {
return false return false
} }


func getActivityTpl() string {
result, _ := repository.RecommendContentFromPromote(setting.RecommentRepoAddr + "/signin/activity_tpl")
return result
}

// SignIn render sign in page // SignIn render sign in page
func SignIn(ctx *context.Context) { func SignIn(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("sign_in") ctx.Data["Title"] = ctx.Tr("sign_in")
@@ -168,6 +174,7 @@ func SignIn(ctx *context.Context) {
ctx.Data["PageIsLogin"] = true ctx.Data["PageIsLogin"] = true
ctx.Data["EnableSSPI"] = models.IsSSPIEnabled() ctx.Data["EnableSSPI"] = models.IsSSPIEnabled()
ctx.Data["EnableCloudBrain"] = true ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()


ctx.HTML(200, tplSignIn) ctx.HTML(200, tplSignIn)
} }
@@ -185,6 +192,7 @@ func SignInCloudBrain(ctx *context.Context) {
ctx.Data["PageIsSignIn"] = true ctx.Data["PageIsSignIn"] = true
ctx.Data["PageIsCloudBrainLogin"] = true ctx.Data["PageIsCloudBrainLogin"] = true
ctx.Data["EnableCloudBrain"] = true ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()


ctx.HTML(200, tplSignInCloudBrain) ctx.HTML(200, tplSignInCloudBrain)
} }
@@ -197,6 +205,7 @@ func SignInPhone(ctx *context.Context) {
} }


ctx.Data["PageIsPhoneLogin"] = true ctx.Data["PageIsPhoneLogin"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()


ctx.HTML(200, tplSignInPhone) ctx.HTML(200, tplSignInPhone)
} }
@@ -206,6 +215,7 @@ func SignInPhonePost(ctx *context.Context, form auth.PhoneNumberCodeForm) {
ctx.Data["PageIsPhoneLogin"] = true ctx.Data["PageIsPhoneLogin"] = true
ctx.Data["IsCourse"] = ctx.QueryBool("course") ctx.Data["IsCourse"] = ctx.QueryBool("course")
ctx.Data["EnableCloudBrain"] = true ctx.Data["EnableCloudBrain"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()


if ctx.HasError() { if ctx.HasError() {
ctx.HTML(200, tplSignInPhone) ctx.HTML(200, tplSignInPhone)
@@ -356,6 +366,7 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) {
func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) { func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) {
ctx.Data["PageIsCloudBrainLogin"] = true ctx.Data["PageIsCloudBrainLogin"] = true
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login/cloud_brain" ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login/cloud_brain"
ctx.Data["ActivityTpl"] = getActivityTpl()
SignInPostCommon(ctx, form) SignInPostCommon(ctx, form)
} }


@@ -363,6 +374,7 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) {
func SignInPost(ctx *context.Context, form auth.SignInForm) { func SignInPost(ctx *context.Context, form auth.SignInForm) {
ctx.Data["PageIsLogin"] = true ctx.Data["PageIsLogin"] = true
ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login" ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login"
ctx.Data["ActivityTpl"] = getActivityTpl()
SignInPostCommon(ctx, form) SignInPostCommon(ctx, form)
} }


@@ -1257,6 +1269,7 @@ func SignUp(ctx *context.Context) {


//Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true //Show Disabled Registration message if DisableRegistration or AllowOnlyExternalRegistration options are true
ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration ctx.Data["DisableRegistration"] = setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration
ctx.Data["ActivityTpl"] = getActivityTpl()


ctx.HTML(200, tplSignUp) ctx.HTML(200, tplSignUp)
} }
@@ -1272,6 +1285,7 @@ func SignUpPost(ctx *context.Context, cpt *captcha.Captcha, form auth.RegisterFo
ctx.Data["CaptchaType"] = setting.Service.CaptchaType ctx.Data["CaptchaType"] = setting.Service.CaptchaType
ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey ctx.Data["RecaptchaSitekey"] = setting.Service.RecaptchaSitekey
ctx.Data["PageIsSignUp"] = true ctx.Data["PageIsSignUp"] = true
ctx.Data["ActivityTpl"] = getActivityTpl()


//Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true //Permission denied if DisableRegistration or AllowOnlyExternalRegistration options are true
if setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration { if setting.Service.DisableRegistration || setting.Service.AllowOnlyExternalRegistration {


+ 1
- 1
routers/user/home.go View File

@@ -779,7 +779,7 @@ func Cloudbrains(ctx *context.Context) {
var jobTypes []string var jobTypes []string
jobTypeNot := false jobTypeNot := false
if jobType == string(models.JobTypeBenchmark) { if jobType == string(models.JobTypeBenchmark) {
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet))
jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeModelSafety), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet), string(models.JobTypeSnn4Ecoset))
} else if jobType != "all" && jobType != "" { } else if jobType != "all" && jobType != "" {
jobTypes = append(jobTypes, jobType) jobTypes = append(jobTypes, jobType)
} }


+ 14
- 14
services/cloudbrain/clear.go View File

@@ -14,21 +14,21 @@ import (


func ClearCloudbrainResultSpace() { func ClearCloudbrainResultSpace() {
log.Info("clear cloudbrain one result space begin.") log.Info("clear cloudbrain one result space begin.")
if !setting.ClearStrategy.Enabled{
if !setting.ClearStrategy.Enabled {
return return
} }


tasks, err := models.GetCloudBrainOneStoppedNotDebugJobDaysAgo(setting.ClearStrategy.ResultSaveDays, setting.ClearStrategy.BatchSize)
tasks, err := models.GetGPUStoppedNotDebugJobDaysAgo(setting.ClearStrategy.ResultSaveDays, setting.ClearStrategy.BatchSize)
if err != nil { if err != nil {
log.Warn("Failed to get cloudbrain, clear result failed.", err) log.Warn("Failed to get cloudbrain, clear result failed.", err)
return return
} }
debugTasks, err := models.GetCloudBrainOneStoppedDebugJobDaysAgo(setting.ClearStrategy.ResultSaveDays, setting.ClearStrategy.DebugJobSize)
debugTasks, err := models.GetGPUStoppedDebugJobDaysAgo(setting.ClearStrategy.ResultSaveDays, setting.ClearStrategy.DebugJobSize)
if err != nil { if err != nil {
log.Warn("Failed to get debug cloudbrain.", err) log.Warn("Failed to get debug cloudbrain.", err)


} }
tasks=append(tasks,debugTasks...)
tasks = append(tasks, debugTasks...)


if err != nil { if err != nil {
log.Warn("Failed to get cloudbrain, clear result failed.", err) log.Warn("Failed to get cloudbrain, clear result failed.", err)
@@ -38,7 +38,7 @@ func ClearCloudbrainResultSpace() {
for _, task := range tasks { for _, task := range tasks {
err := DeleteCloudbrainOneJobStorage(task.JobName) err := DeleteCloudbrainOneJobStorage(task.JobName)
if err == nil { if err == nil {
log.Info("clear job in cloudbrain table:"+task.JobName)
log.Info("clear job in cloudbrain table:" + task.JobName)
ids = append(ids, task.ID) ids = append(ids, task.ID)
} }
} }
@@ -69,10 +69,10 @@ func clearMinioHistoryTrashFile() {
SortModTimeAscend(miniofiles) SortModTimeAscend(miniofiles)
for _, file := range miniofiles { for _, file := range miniofiles {


if file.Name()!="" && file.ModTime().Before(time.Now().AddDate(0, 0, -setting.ClearStrategy.TrashSaveDays)) {
if file.Name() != "" && file.ModTime().Before(time.Now().AddDate(0, 0, -setting.ClearStrategy.TrashSaveDays)) {


has,err:=models.IsCloudbrainExistByJobName(file.Name())
if err==nil && !has {
has, err := models.IsCloudbrainExistByJobName(file.Name())
if err == nil && !has {
dirPath := setting.CBCodePathPrefix + file.Name() + "/" dirPath := setting.CBCodePathPrefix + file.Name() + "/"
log.Info("clear job in minio trash:" + file.Name()) log.Info("clear job in minio trash:" + file.Name())
storage.Attachments.DeleteDir(dirPath) storage.Attachments.DeleteDir(dirPath)
@@ -90,7 +90,7 @@ func clearMinioHistoryTrashFile() {
} }
} }


func clearLocalHistoryTrashFile() {
func clearLocalHistoryTrashFile() {
files, err := ioutil.ReadDir(setting.JobPath) files, err := ioutil.ReadDir(setting.JobPath)
processCount := 0 processCount := 0
if err != nil { if err != nil {
@@ -99,11 +99,11 @@ func clearLocalHistoryTrashFile() {
SortModTimeAscend(files) SortModTimeAscend(files)
for _, file := range files { for _, file := range files {
//清理n天前的历史垃圾数据,清理job目录 //清理n天前的历史垃圾数据,清理job目录
if file.Name()!="" && file.ModTime().Before(time.Now().AddDate(0, 0, -setting.ClearStrategy.TrashSaveDays)) {
has,err:=models.IsCloudbrainExistByJobName(file.Name())
if err==nil && !has{
if file.Name() != "" && file.ModTime().Before(time.Now().AddDate(0, 0, -setting.ClearStrategy.TrashSaveDays)) {
has, err := models.IsCloudbrainExistByJobName(file.Name())
if err == nil && !has {
os.RemoveAll(setting.JobPath + file.Name()) os.RemoveAll(setting.JobPath + file.Name())
log.Info("clear job in local trash:"+file.Name())
log.Info("clear job in local trash:" + file.Name())
processCount++ processCount++
} }
if processCount == setting.ClearStrategy.BatchSize { if processCount == setting.ClearStrategy.BatchSize {
@@ -127,7 +127,7 @@ func SortModTimeAscend(files []os.FileInfo) {


func DeleteCloudbrainOneJobStorage(jobName string) error { func DeleteCloudbrainOneJobStorage(jobName string) error {


if jobName==""{
if jobName == "" {
return nil return nil
} }
//delete local //delete local


+ 2
- 2
services/cloudbrain/cloudbrainTask/count.go View File

@@ -34,7 +34,7 @@ var StatusInfoDict = map[string]StatusInfo{string(models.JobTypeDebug) + "-" + s
ComputeResource: models.GPUResource, ComputeResource: models.GPUResource,
}, string(models.JobTypeBenchmark) + "-" + strconv.Itoa(models.TypeCloudBrainOne): { }, string(models.JobTypeBenchmark) + "-" + strconv.Itoa(models.TypeCloudBrainOne): {
CloudBrainTypes: []int{models.TypeCloudBrainOne}, CloudBrainTypes: []int{models.TypeCloudBrainOne},
JobType: []models.JobType{models.JobTypeBenchmark, models.JobTypeBrainScore, models.JobTypeSnn4imagenet},
JobType: []models.JobType{models.JobTypeBenchmark, models.JobTypeBrainScore, models.JobTypeSnn4imagenet, models.JobTypeSnn4Ecoset},
NotFinalStatuses: CloudbrainOneNotFinalStatuses, NotFinalStatuses: CloudbrainOneNotFinalStatuses,
ComputeResource: models.GPUResource, ComputeResource: models.GPUResource,
}, string(models.JobTypeDebug) + "-" + strconv.Itoa(models.TypeCloudBrainTwo): { }, string(models.JobTypeDebug) + "-" + strconv.Itoa(models.TypeCloudBrainTwo): {
@@ -76,7 +76,7 @@ var StatusInfoDict = map[string]StatusInfo{string(models.JobTypeDebug) + "-" + s


func GetNotFinalStatusTaskCount(uid int64, cloudbrainType int, jobType string, computeResource ...string) (int, error) { func GetNotFinalStatusTaskCount(uid int64, cloudbrainType int, jobType string, computeResource ...string) (int, error) {
jobNewType := jobType jobNewType := jobType
if jobType == string(models.JobTypeSnn4imagenet) || jobType == string(models.JobTypeBrainScore) {
if models.IsModelBenchMarkJobType(jobType) {
jobNewType = string(models.JobTypeBenchmark) jobNewType = string(models.JobTypeBenchmark)
} }




+ 35
- 7
services/cloudbrain/cloudbrainTask/notebook.go View File

@@ -35,6 +35,7 @@ const NoteBookExtension = ".ipynb"
const CPUType = 0 const CPUType = 0
const GPUType = 1 const GPUType = 1
const NPUType = 2 const NPUType = 2
const CharacterLength = 2550


func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption) { func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption) {


@@ -46,6 +47,14 @@ func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOp
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_select_wrong"))) ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_select_wrong")))
return return
} }
if len(getBootFile(option.File, option.OwnerName, option.ProjectName)) > CharacterLength {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_path_too_long")))
return
}
if len(option.BranchName) > CharacterLength {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_branch_name_too_long")))
return
}


isNotebookFileExist, _ := isNoteBookFileExist(ctx, option) isNotebookFileExist, _ := isNoteBookFileExist(ctx, option)
if !isNotebookFileExist { if !isNotebookFileExist {
@@ -105,14 +114,29 @@ func FileNotebookCreate(ctx *context.Context, option api.CreateFileNotebookJobOp
err = downloadCode(sourceRepo, getCodePath(noteBook.JobName, sourceRepo), option.BranchName) err = downloadCode(sourceRepo, getCodePath(noteBook.JobName, sourceRepo), option.BranchName)
if err != nil { if err != nil {
log.Error("download code failed", err) log.Error("download code failed", err)
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("cloudbrain.load_code_failed")))
return
if !strings.Contains(err.Error(), "already exists and is not an empty directory") {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("cloudbrain.load_code_failed")))
return
}
} }
} }
if !isRepoFileMatch(option, noteBook) { if !isRepoFileMatch(option, noteBook) {
noteBook.BootFile += ";" + getBootFile(option.File, option.OwnerName, option.ProjectName)
noteBook.BranchName += ";" + option.BranchName
noteBook.Description += ";" + getDescription(option)
if len(noteBook.BootFile)+len(getBootFile(option.File, option.OwnerName, option.ProjectName))+1 <= CharacterLength {
noteBook.BootFile += ";" + getBootFile(option.File, option.OwnerName, option.ProjectName)
} else {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_path_too_long")))
return
}
if len(noteBook.BranchName)+len(option.BranchName)+1 <= CharacterLength {
noteBook.BranchName += ";" + option.BranchName
} else {
ctx.JSON(http.StatusOK, models.BaseErrorMessageApi(ctx.Tr("repo.notebook_branch_name_too_long")))
return
}

if len(noteBook.Description)+len(getDescription(option))+1 <= CharacterLength {
noteBook.Description += ";" + getDescription(option)
}


err := models.UpdateJob(noteBook) err := models.UpdateJob(noteBook)
if err != nil { if err != nil {
@@ -417,7 +441,7 @@ func cloudBrainFileNoteBookCreate(ctx *context.Context, option api.CreateFileNot
} }


func getCloudbrainType(optionType int) int { func getCloudbrainType(optionType int) int {
if optionType < 1 {
if optionType <= GPUType {
return models.TypeCloudBrainOne return models.TypeCloudBrainOne
} }
if setting.ModelartsCD.Enabled { if setting.ModelartsCD.Enabled {
@@ -431,7 +455,11 @@ func getCodePath(jobName string, repo *models.Repository) string {
} }


func getDescription(option api.CreateFileNotebookJobOption) string { func getDescription(option api.CreateFileNotebookJobOption) string {
return option.OwnerName + "/" + option.ProjectName + "/" + option.File
des := option.OwnerName + "/" + option.ProjectName + "/" + option.File
if len(des) <= CharacterLength {
return des
}
return ""
} }


func modelartsFileNoteBookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption, repo *models.Repository, sourceRepo *models.Repository) { func modelartsFileNoteBookCreate(ctx *context.Context, option api.CreateFileNotebookJobOption, repo *models.Repository, sourceRepo *models.Repository) {


+ 6
- 6
templates/admin/cloudbrain/list.tmpl View File

@@ -89,7 +89,7 @@
<div class="row"> <div class="row">
<!-- 任务名 --> <!-- 任务名 -->
{{$JobID := '0'}} {{$JobID := '0'}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY" "SNN4ECOSET"}}
{{$JobID = .Cloudbrain.ID}} {{$JobID = .Cloudbrain.ID}}
{{else}} {{else}}
{{$JobID = .JobID}} {{$JobID = .JobID}}
@@ -103,7 +103,7 @@
<span class="fitted" <span class="fitted"
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span>
</a> </a>
{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}
{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE") (eq .JobType "SNN4ECOSET")}}
<a class="title" <a class="title"
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}"
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px">
@@ -263,7 +263,7 @@
</a> </a>
</form> </form>
{{else}} {{else}}
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}}
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE" "SNN4ECOSET"}}
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> <form id="stopForm-{{$JobID}}" style="margin-left:-1px;">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}"
@@ -305,11 +305,11 @@
</form> </form>
{{else}} {{else}}
<form class="ui compact buttons" id="delForm-{{$JobID}}" <form class="ui compact buttons" id="delForm-{{$JobID}}"
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .Cloudbrain.Type 2}}/grampus/notebook{{else}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true'
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE") (eq .JobType "SNN4ECOSET")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .Cloudbrain.Type 2}}/grampus/notebook{{else}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?isadminpage=true'
method="post"> method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" <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-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?isadminpage=true"
data-version="{{.VersionName}}" class="ui basic ai_delete blue button" data-version="{{.VersionName}}" class="ui basic ai_delete blue button"
style="border-radius: .28571429rem;"> style="border-radius: .28571429rem;">
{{$.i18n.Tr "repo.delete"}} {{$.i18n.Tr "repo.delete"}}
@@ -321,7 +321,7 @@
</div> </div>
{{else}} {{else}}
{{$JobID := '0'}} {{$JobID := '0'}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "SNN4ECOSET"}}
{{$JobID = .Cloudbrain.ID}} {{$JobID = .Cloudbrain.ID}}
{{else}} {{else}}
{{$JobID = .JobID}} {{$JobID = .JobID}}


+ 1
- 0
templates/admin/cloudbrain/search.tmpl View File

@@ -35,6 +35,7 @@
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="SNN4IMAGENET">SNN4IMAGENET</a> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4IMAGENET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="SNN4IMAGENET">SNN4IMAGENET</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="BRAINSCORE">BRAINSCORE</a> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=BRAINSCORE&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="BRAINSCORE">BRAINSCORE</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=MODELSAFETY&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="MODELSAFETY">MODELSAFETY</a> <a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=MODELSAFETY&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="MODELSAFETY">MODELSAFETY</a>
<a class="item" href="{{$.Link}}?q={{$.Keyword}}&jobType=SNN4ECOSET&listType={{$.ListType}}&jobStatus={{$.JobStatus}}&cluster={{$.cluster}}&aiCenter={{$.aiCenter}}" data-value="MODELSAFETY">SNN4ECOSET</a>
</div> </div>
</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="ui selection dropdown" style="min-width: 10em;min-height:2.6em;border-radius: .28571429rem;margin-right: 1em;padding: .67em 3.2em .7em 1em;">


+ 10
- 0
templates/base/footer_content.tmpl View File

@@ -1,3 +1,13 @@
<style>
@media only screen and (max-width: 767px) {
.mobile-text-align-center {
text-align: center !important;
}
.mobile-justify-content-center {
justify-content: center !important;
}
}
</style>
<footer style="border-top:none;"> <footer style="border-top:none;">
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">


+ 39
- 1
templates/custom/home/home_top.tmpl View File

@@ -1786,8 +1786,40 @@
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: cover; background-size: cover;
padding: 45% 0; padding: 45% 0;
}
}
} }

._hm-pg-bg-4 {
background: url(/img/home-banner-02-1.jpg);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
._hm-pg-bg-4-content {
position: absolute;
margin: auto;
left: 0;
top: -10%;
right: 0;
bottom: 0;
display: block;
width: 790px;
height: 315px;
background: url(/img/home-banner-02-2.png);
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
@media only screen and (max-width: 767px) {
._hm-pg-bg-4 {
background-size: 200% 100%;
}
._hm-pg-bg-4-content {
top: -15%;
width: 90%;
height: 150px;
}
}
</style> </style>
<div class="_hm-bg-container"> <div class="_hm-bg-container">
<div class="_hm-pg _hm-pg-static"> <div class="_hm-pg _hm-pg-static">
@@ -2029,12 +2061,18 @@
<div class="_hm-big-btn-c"></div> <div class="_hm-big-btn-c"></div>
</div> </div>
</div> </div>
<div class="_hm-pg _hm-pg-bg-4">
<a target="_blank;" href="https://openi.org.cn/index.php?m=content&c=index&a=lists&catid=225">
<div class="_hm-pg-bg-4-content" style="animation:_hm-slide-in-left-once 0.5s"></div>
</a>
</div>
</div> </div>
<div class="_hm-slide-btn _hm-slide-btn-left"></div> <div class="_hm-slide-btn _hm-slide-btn-left"></div>
<div class="_hm-slide-btn _hm-slide-btn-right"></div> <div class="_hm-slide-btn _hm-slide-btn-right"></div>
<div class="_hm-slide-pagination-c"> <div class="_hm-slide-pagination-c">
<div class="_hm-slide-pagination-item _hm-slide-pagination-item-active"></div> <div class="_hm-slide-pagination-item _hm-slide-pagination-item-active"></div>
<div class="_hm-slide-pagination-item"></div> <div class="_hm-slide-pagination-item"></div>
<div class="_hm-slide-pagination-item"></div>
</div> </div>
</div> </div>
<div class="ui container _hm-container"> <div class="ui container _hm-container">


+ 2
- 2
templates/custom/task_wait_count.tmpl View File

@@ -1,7 +1,7 @@
<div style="display:inline-block;"> <div style="display:inline-block;">
<div style="display:flex;align-items:center;color:#f2711c;"> <div style="display:flex;align-items:center;color:#f2711c;">
<i class="ri-error-warning-line" style="margin-right: 0.5rem; font-size: 14px"></i> <i class="ri-error-warning-line" style="margin-right: 0.5rem; font-size: 14px"></i>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{.WaitCount}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
<span style="font-size: 12px">{{.i18n.Tr "repo.wait_count_start"}} <span class="__task_wait_count__">{{if not .WaitCount}}1{{else}}{{addOne .WaitCount}}{{end}}</span> {{.i18n.Tr "repo.wait_count_end"}}</span>
</div> </div>
</div> </div>
<script> <script>
@@ -12,7 +12,7 @@
var specsSelEl = $('select#__specs__'); var specsSelEl = $('select#__specs__');
var seldOption = specsSelEl.find('option:selected'); var seldOption = specsSelEl.find('option:selected');
var queueCode = seldOption.attr('queueCode'); var queueCode = seldOption.attr('queueCode');
$('span.__task_wait_count__').text(queuesDetail[queueCode] || 0);
$('span.__task_wait_count__').text((queuesDetail[queueCode] || 0) +1);
}; };
$('body').on('change', 'select#__specs__', function(e) { $('body').on('change', 'select#__specs__', function(e) {
changeSpecs(); changeSpecs();


+ 1
- 0
templates/explore/images.tmpl View File

@@ -1,4 +1,5 @@
{{template "base/head" .}} {{template "base/head" .}}
<div class="alert"></div>
<div id="images"></div> <div id="images"></div>
<!-- 确认模态框 --> <!-- 确认模态框 -->
<div id="deletemodel"> <div id="deletemodel">


+ 125
- 259
templates/repo/cloudbrain/benchmark/new.tmpl View File

@@ -1,37 +1,9 @@
{{template "base/head" .}} {{template "base/head" .}}
<style>
.unite {
font-family: SourceHanSansSC-medium !important;
color: rgba(16, 16, 16, 100) !important;
}

.title {
font-size: 16px !important;
padding-left: 3rem !important;
}

.min_title{
font-size: 14px !important;
margin-bottom: 2rem !important;
}

.width81 {
margin-left: 1.5rem;
width: 81% !important;
}

.width48 {
width: 48.5% !important;
}

.nowrapx {
white-space: nowrap !important;
}
</style>
{{template "custom/global_mask" .}} {{template "custom/global_mask" .}}
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-repo-link="{{.RepoLink}}" data-flag-model="true"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -54,7 +26,7 @@
<a class="active item model_benchmark" <a class="active item model_benchmark"
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
<a class="item aisafety_benchmark" <a class="item aisafety_benchmark"
href="{{.RepoLink}}/modelsafety/create_gpu">模型安全评测</a>
href="{{.RepoLink}}/modelsafety/create_gpu">{{.i18n.Tr "modelsafety.model_security_evaluation"}}</a>
</div> </div>
</div> </div>
<div> <div>
@@ -78,21 +50,12 @@
onkeydown="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)"
onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
</div> </div>

<!--<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
<select id="cloudbrain_gpu_type" class="ui search dropdown width48" placeholder="选择GPU类型"
name="gpu_type">
{{range .benchmark_gpu_types}}
<option value="{{.Queue}}">{{.Value}}</option>
{{end}}
</select>
</div>-->
<div class="required unite min_title two inline fields" style="margin-left: 80px;">
<div class="required min_title two inline fields" style="margin-left: 80px;">
<div class="required ten wide field" style="width: 26.5% !important;"> <div class="required ten wide field" style="width: 26.5% !important;">
<label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.task_type"}}</label>&nbsp; <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.task_type"}}</label>&nbsp;
<select id="cloudbrain_job_type" class="ui search dropdown job_type"
<select id="cloudbrain_job_type" class="ui search dropdown job_type"
placeholder="select {{.i18n.Tr "cloudbrain.task_type"}}" name="job_type"> placeholder="select {{.i18n.Tr "cloudbrain.task_type"}}" name="job_type">
<option value="SNN4ECOSET">SNN4ECOSET</option>
<option value="SNN4IMAGENET">SNN4IMAGENET</option> <option value="SNN4IMAGENET">SNN4IMAGENET</option>
<option value="BRAINSCORE">BRAINSCORE</option> <option value="BRAINSCORE">BRAINSCORE</option>
</select> </select>
@@ -116,22 +79,10 @@
<a id="benchmark_model_example" href="https://openi.pcl.ac.cn/BDIP/snn4imagenet" <a id="benchmark_model_example" href="https://openi.pcl.ac.cn/BDIP/snn4imagenet"
target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a> target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
</div> </div>
{{template "custom/select_model" .}}
<div id="images-new-cb"> <div id="images-new-cb">
</div> </div>
{{template "custom/select_dataset_train" .}}
<!--<div class="required min_title inline field" style="margin-top:2rem;">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="cloudbrain_resource_spec" class="ui search dropdown"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
name="resource_spec_id">
{{range .benchmark_resource_specs}}
<option name="resource_spec_id" value="{{.Id}}">
{{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}
</option>
{{end}}
</select>
</div>-->
<div class="required min_title inline field" style="margin-top:2rem;"> <div class="required min_title inline field" style="margin-top:2rem;">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48" <select id="__specs__" class="ui search dropdown width48"
@@ -156,7 +107,7 @@
<button class="ui create_train_job green button {{if eq .NotStopTaskCount 1}}disabled{{end}}"> <button class="ui create_train_job green button {{if eq .NotStopTaskCount 1}}disabled{{end}}">
{{.i18n.Tr "repo.cloudbrain.new"}} {{.i18n.Tr "repo.cloudbrain.new"}}
</button> </button>
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
<a class="ui button" href="{{.RepoLink}}/cloudbrain/benchmark">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>
@@ -173,7 +124,7 @@
<a class="item model_benchmark" <a class="item model_benchmark"
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a> href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
<a class="item aisafety_benchmark" <a class="item aisafety_benchmark"
href="{{.RepoLink}}/modelsafety/create_gpu">模型安全评测</a>
href="{{.RepoLink}}/modelsafety/create_gpu">{{.i18n.Tr "modelsafety.model_security_evaluation"}}</a>
</div> </div>
</div> </div>


@@ -199,20 +150,11 @@
onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
</div> </div>


<!--<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
<select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型"
style='width:385px' name="gpu_type">
{{range .benchmark_gpu_types}}
<option value="{{.Queue}}">{{.Value}}</option>
{{end}}
</select>
</div>-->
<div class="required unite inline min_title fields" style="width: 90%;margin-left: 5.7rem;">&nbsp;
<div class="required inline min_title fields" style="width: 90%;margin-left: 5.7rem;">&nbsp;
<div class="required eight wide field"> <div class="required eight wide field">
<label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</label> <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</label>


<select class="ui fluid selection search dropdown" id="benchmark_types_id"
<select class="ui fluid selection search dropdown benchmark_types_id"
name="benchmark_types_id"> name="benchmark_types_id">
{{range .benchmark_types}} {{range .benchmark_types}}
{{if eq .Id $.benchmarkTypeID}} {{if eq .Id $.benchmarkTypeID}}
@@ -226,26 +168,13 @@
<div class="eight wide field" id="engine_name"> <div class="eight wide field" id="engine_name">
<input type="hidden" id="benchmark_child_types_id_hidden" name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}"> <input type="hidden" id="benchmark_child_types_id_hidden" name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}">
<label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label> <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label>
<select class="ui fluid selection dropdown nowrapx" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id">
<select class="ui fluid selection dropdown " id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id">
</select> </select>
</div> </div>
</div> </div>
<div id="images-new-cb"> <div id="images-new-cb">
</div> </div>


<!--<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="cloudbrain_resource_spec" class="ui search dropdown"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px'
name="resource_spec_id">
{{range .benchmark_resource_specs}}
<option name="resource_spec_id" value="{{.Id}}">
{{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}
</option>
{{end}}
</select>
</div>-->

<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48" <select id="__specs__" class="ui search dropdown width48"
@@ -282,197 +211,134 @@
target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a> target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
</div> </div>



<div class="inline unite min_title field">
<label class="label-fix-width" style="font-weight: normal;"></label>
<button class="ui create_train_job green button {{if eq .NotStopTaskCount 1}}disabled{{end}}">
{{.i18n.Tr "repo.cloudbrain.new"}}
</button>
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
</div>
</div>
</form>
{{else if eq .benchmarkMode "aisafety"}}
<form id="form_id" class="ui form alogrithm_form" action="{{.Link}}?benchmarkMode=alogrithm" method="post">
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="update">
<input type="hidden" name="job_type" value="BENCHMARK">
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label>
<div class="ui blue small menu compact selectcloudbrain">
<a class="item alogrithm_benchmark"
href="{{.Link}}?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}}</a>
<a class="item model_benchmark"
href="{{.Link}}?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
<a class="active item aisafety_benchmark"
href="{{.RepoLink}}/modelsafety/create_gpu">模型安全评测</a>
</div>
</div>

<div>
<div class="min_title inline field" style="margin-top:-10px;">
<label class="label-fix-width" style="font-weight: normal;"></label>
{{template "custom/task_wait_count" .}}
</div>
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
<input style="width: 80%;" name="display_job_name" id="trainjob_job_name"
placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}"
tabindex="3" autofocus required maxlength="36">
<span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span>
</div>
<div class="min_title inline field">
<label class="label-fix-width" style="font-weight: normal;"
for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label>
<textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254"
placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}}
onchange="this.value=this.value.substring(0, 255)"
onkeydown="this.value=this.value.substring(0, 255)"
onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
</div>


<div id="images-new-cb">
</div>

<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
<select id="__specs__" class="ui search dropdown width48"
placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
name="spec_id">
</select>
<span><i class="question circle icon link"></i></span>
<a href="{{AppSubUrl}}/resource_desc" target="_blank">{{.i18n.Tr "custom.resource_description"}}</a>
</div>

<div class="inline min_title field required">
<label class="label-fix-width" style="font-weight: normal;">推理程序</label>
<input disabled="disabled" style="width: 33.5%;" name="test_file" id="test_file" value="test.py"
tabindex="3" autofocus required maxlength="254">
<a id="test_href_id" href="https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark"
target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
</div>


<div class="inline unite min_title field">
<div class="inline min_title field">
<label class="label-fix-width" style="font-weight: normal;"></label> <label class="label-fix-width" style="font-weight: normal;"></label>
<button class="ui create_train_job green button {{if eq .NotStopTaskCount 1}}disabled{{end}}"> <button class="ui create_train_job green button {{if eq .NotStopTaskCount 1}}disabled{{end}}">
{{.i18n.Tr "repo.cloudbrain.new"}} {{.i18n.Tr "repo.cloudbrain.new"}}
</button> </button>
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
<a class="ui button" href="{{.RepoLink}}/cloudbrain/benchmark">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
</div> </div>
</div> </div>
</form> </form>

{{end}} {{end}}
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}
<script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script> <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
<script src="{{StaticUrlPrefix}}/js/cloudbrainNew.js?v={{MD5 AppVer}}" type="text/javascript"></script>
<script> <script>
let form = document.getElementById('form_id');
let createFlag = false
form.onsubmit = function (e) {
if(createFlag) return false
createFlag = true
}
let repolink = {{.RepoLink }}
let url_href = window.location.pathname.split('create')[0]
$(".ui.button").attr('href', url_href)
$('.menu .item')
.tab();
$('#benchmark_types_id').change(function () {
setChildType();
})
$(document).ready(() => {
$('.ui.search.dropdown.job_type').dropdown({
onChange: function (value, text, $selectedItem) {
if (value === "BRAINSCORE") {
$('#brainscore_child_type').css('display', 'block')
$('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/similarity2brain_ann')
} else {
$('#brainscore_child_type').css('display', 'none')
$('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/snn4imagenet')
}
}
})
})
function setChildType() {
let type_id = $('#benchmark_types_id').val();
if (type_id == 3) {
$('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
$('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
} else {
$('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
$('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
}
let child_selected_id = $('#benchmark_child_types_id_hidden').val();
$.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => {
const n_length = data['child_types'].length
let html = ''
for (let i = 0; i < n_length; i++) {
if (child_selected_id == data['child_types'][i].id) {
html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`;
} else {
html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`;
}
}
document.getElementById("benchmark_child_types_id").innerHTML = html;
})
}
document.onreadystatechange = function () {
if (document.readyState === "complete") {
if ($('input[name=benchmarkMode]').val() === 'alogrithm' || $('input[name=benchmarkMode]').val() === '') {
setChildType();
}
}
}
var isValidate = false;
function validate() {
$('.ui.form')
.form({
on: 'blur',
fields: {
image: {
identifier: 'image',
rules: [
{
type: 'empty',
promt: ''
}
]
},
display_job_name: {
identifier: 'display_job_name',
rules: [
{
type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
promt: ''
}
]
},
spec_id: {
identifier: 'spec_id',
rules: [{ type: 'empty' }]
}
},
onSuccess: function () {
// $('.ui.page.dimmer').dimmer('show')
document.getElementById("mask").style.display = "block"
isValidate = true;
},
onFailure: function (e) {
isValidate = false;
return false;
}
})
}
// let repolink = {{.RepoLink }}
// $('#benchmark_types_id').change(function () {
// console.log("----")
// // setChildType();
// })
// $("#benchmark_types_id").dropdown({
// onChange:function (value, text, $selectedItem){
// console.log(value)
// }
// })
// $(document).ready(() => {
// $('.ui.search.dropdown.job_type').dropdown({
// onChange: function (value, text, $selectedItem) {
// console.log(value)
// if (value === "BRAINSCORE") {
// $('#brainscore_child_type').css('display', 'block')
// $('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/similarity2brain_ann')
// } else {
// $('#brainscore_child_type').css('display', 'none')
// $('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/snn4imagenet')
// }
// }
// })
// })
// function setChildType(type_id=1) {
// if (type_id == 3) {
// $('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
// $('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
// } else {
// $('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
// $('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
// }
// let child_selected_id = $('#benchmark_child_types_id_hidden').val();
// $.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => {
// const n_length = data['child_types'].length
// let html = ''
// for (let i = 0; i < n_length; i++) {
// if (child_selected_id == data['child_types'][i].id) {
// html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`;
// } else {
// html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`;
// }
// }
// document.getElementById("benchmark_child_types_id").innerHTML = html;
// })
// }
// $(document).ready(function (){
// console.log("00")
// $(".ui.selection.dropdown.benchmark_types_id").dropdown({
// onChange:function (value, text, $selectedItem){
// console.log(value)
// setChildType(value)
// }
// })
// })
// document.onreadystatechange = function () {
// if (document.readyState === "complete") {
// if ($('input[name=benchmarkMode]').val() === 'alogrithm' || $('input[name=benchmarkMode]').val() === '') {
// setChildType();
// }
// }
// }
// var isValidate = false;
// function validate() {
// $('.ui.form')
// .form({
// on: 'blur',
// fields: {
// image: {
// identifier: 'image',
// rules: [
// {
// type: 'empty',
// promt: ''
// }
// ]
// },
// display_job_name: {
// identifier: 'display_job_name',
// rules: [
// {
// type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
// promt: ''
// }
// ]
// },
// spec_id: {
// identifier: 'spec_id',
// rules: [{ type: 'empty' }]
// }
// },
// onSuccess: function () {
// // $('.ui.page.dimmer').dimmer('show')
// document.getElementById("mask").style.display = "block"
// isValidate = true;
// },
// onFailure: function (e) {
// isValidate = false;
// return false;
// }
// })
// }


validate()
$('.ui.create_train_job.green.button').click(function (e) {
validate()
})
// validate()
// $('.ui.create_train_job.green.button').click(function (e) {
// validate()
// })


;(function() { ;(function() {
var SPECS = {{ .benchmark_specs }}; var SPECS = {{ .benchmark_specs }};


+ 30
- 21
templates/repo/cloudbrain/benchmark/show.tmpl View File

@@ -206,7 +206,7 @@
<table class="ti-form"> <table class="ti-form">
<tbody class="ti-text-form"> <tbody class="ti-text-form">


{{if eq .JobType "BENCHMARK"}}
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}} {{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}
@@ -214,11 +214,7 @@


<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w"> <div class="text-span text-span-w">
{{if eq .JobType "BENCHMARK"}}
train.py train.py
{{else}}
--
{{end}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -228,16 +224,39 @@
</td> </td>


<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w">
{{if eq .JobType "BENCHMARK"}}
test.py test.py
{{else}}
--
{{end}}
</div> </div>
</td> </td>
</tr> </tr>
{{else}}
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.model_name"}}
</td>


<td class="ti-text-form-content">
<div class="text-span text-span-w">{{if .ModelName}}{{.ModelName}}{{else}}--{{end}}</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelconvert.modelversion"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w">{{if .ModelVersion}}{{.ModelVersion}}{{else}}--{{end}}</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.infer_job_model_file"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w">{{if .CkptName}}{{.CkptName}}{{else}}--{{end}}</div>
</td>
</tr>
{{end}}
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.description"}} {{$.i18n.Tr "repo.modelarts.train_job.description"}}
@@ -271,17 +290,7 @@
<div class="text-span text-span-w"></div> <div class="text-span text-span-w"></div>
</td> </td>
</tr> </tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.model_manager"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.DatasetName}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}} {{$.i18n.Tr "repo.cloudbrain_creator"}}


+ 1
- 1
templates/repo/cloudbrain/inference/new.tmpl View File

@@ -40,7 +40,7 @@
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
{{template "custom/alert_cb" .}} {{template "custom/alert_cb" .}}
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}"></div>
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "repo.modelarts.train_job.new_infer"}} {{.i18n.Tr "repo.modelarts.train_job.new_infer"}}
</h4> </h4>


+ 12
- 4
templates/repo/cloudbrain/inference/show.tmpl View File

@@ -371,10 +371,18 @@
<div class="ui tab" data-tab="four"> <div class="ui tab" data-tab="four">
<input type="hidden" name="model{{.VersionName}}" value="-1"> <input type="hidden" name="model{{.VersionName}}" value="-1">
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> <input type="hidden" name="modelback{{.VersionName}}" value="-1">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>

<div style="display: flex;justify-content: space-between;">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>
</div>
<a id="{{.VersionName}}-result-down" style="padding-right: 1%;display: none;"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}} file-info'
href="{{$.RepoLink}}/cloudbrain/inference-job/{{.JobID}}/downloadall?version_name={{.VersionName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.all_result_download"}}</span>
</a>
</div> </div>
<div id="dir_list{{.VersionName}}"> <div id="dir_list{{.VersionName}}">




+ 2
- 1
templates/repo/cloudbrain/new.tmpl View File

@@ -23,7 +23,7 @@
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}" data-flag-model="true"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-exceed-size="{{DebugAttachSize}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -38,6 +38,7 @@
<form id="form_id" class="ui form" action="{{.Link}}" method="post"> <form id="form_id" class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name='isBranches' value="{{.Branches}}"> <input type="hidden" name='isBranches' value="{{.Branches}}">
<input type="hidden" id="ai_image_name" value="{{.image}}">
<h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>


+ 3
- 0
templates/repo/cloudbrain/show.tmpl View File

@@ -111,7 +111,9 @@
<td class="ti-text-form-content"> <td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-code"> <div class="text-span text-span-w" id="{{.VersionName}}-code">
{{.BranchName}} {{.BranchName}}
{{if not .BootFile}}
<span style="margin-left:1rem" class="ui label">{{SubStr .CommitID 0 10}}</span> <span style="margin-left:1rem" class="ui label">{{SubStr .CommitID 0 10}}</span>
{{end}}
</div> </div>
</td> </td>
</tr> </tr>
@@ -376,6 +378,7 @@
{{template "base/footer" .}} {{template "base/footer" .}}
<script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script> <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
<script> <script>
$('.menu .item').tab() $('.menu .item').tab()
$(document).ready(function () { $(document).ready(function () {
$('.ui.accordion').accordion({ selector: { trigger: '.icon' } }); $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });


+ 1
- 1
templates/repo/cloudbrain/trainjob/new.tmpl View File

@@ -56,7 +56,7 @@
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}


+ 22
- 3
templates/repo/cloudbrain/trainjob/show.tmpl View File

@@ -123,7 +123,17 @@
</div> </div>
</td> </td>
</tr> </tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}}
</td>


<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.User.Name}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.start_time"}} {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
@@ -351,9 +361,18 @@
<div class="ui tab" data-tab="four{{$k}}"> <div class="ui tab" data-tab="four{{$k}}">
<input type="hidden" name="model{{.VersionName}}" value="-1"> <input type="hidden" name="model{{.VersionName}}" value="-1">
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> <input type="hidden" name="modelback{{.VersionName}}" value="-1">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">result</div>
<div class="divider"> / </div>
<div style="display: flex;justify-content: space-between;">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">result</div>
<div class="divider"> / </div>
</div>
<a id="{{.VersionName}}-result-down" style="padding-right: 1%;display: none;"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}} file-info'
href="{{$.RepoLink}}/cloudbrain/train-job/{{.JobID}}/download_multi_model?version_name={{.VersionName}}&jobName={{.JobName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.all_result_download"}}</span>
</a>
</div> </div>
<div id="dir_list{{.VersionName}}"> <div id="dir_list{{.VersionName}}">
</div> </div>


+ 2
- 3
templates/repo/grampus/notebook/gpu/new.tmpl View File

@@ -4,8 +4,7 @@
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}" data-flag-model="true"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-exceed-size="{{DebugAttachSize}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -20,8 +19,8 @@
<form id="form_id" class="ui form" action="{{.Link}}" method="post"> <form id="form_id" class="ui form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}} {{.CsrfTokenHtml}}
<input type="hidden" name="type" value="0"> <input type="hidden" name="type" value="0">
<input type="hidden" id="ai_image_name" value="{{.image}}">
<h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4> <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required min_title inline field"> <div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
<div class="ui blue mini menu compact selectcloudbrain"> <div class="ui blue mini menu compact selectcloudbrain">


+ 16
- 3
templates/repo/grampus/notebook/npu/new.tmpl View File

@@ -3,7 +3,7 @@
<div class="repository"> <div class="repository">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-exceed-size="{{DebugAttachSize}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -93,8 +93,21 @@
<div class="inline min_title required field"> <div class="inline min_title required field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label>
<select class="ui search dropdown cloudbrain_image width48" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" style='width:385px' name="image_id"> <select class="ui search dropdown cloudbrain_image width48" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" style='width:385px' name="image_id">
{{range .images}}
<option name="image_id" value="{{.ID}}">{{.Name}}</option>
{{if .image_id}}
{{range .images}}
{{if eq $.image_id .ID}}
<option value="{{.ID}}">{{.Name}}</option>
{{end}}
{{end}}
{{range .images}}
{{if ne $.image_id .ID}}
<option value="{{.ID}}">{{.Name}}</option>
{{end}}
{{end}}
{{else}}
{{range .images}}
<option name="image_id" value="{{.ID}}">{{.Name}}</option>
{{end}}
{{end}} {{end}}
</select> </select>
</div> </div>


+ 23
- 4
templates/repo/grampus/trainjob/show.tmpl View File

@@ -123,6 +123,17 @@
</tr> </tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.User.Name}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.run_version"}} {{$.i18n.Tr "repo.modelarts.run_version"}}
</td> </td>


@@ -386,10 +397,18 @@
<div class="ui tab" data-tab="third{{$k}}"> <div class="ui tab" data-tab="third{{$k}}">
<input type="hidden" name="model{{.VersionName}}" value="-1"> <input type="hidden" name="model{{.VersionName}}" value="-1">
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> <input type="hidden" name="modelback{{.VersionName}}" value="-1">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>

<div style="display: flex;justify-content: space-between;">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>
</div>
<a id="{{.VersionName}}-result-down" style="padding-right: 1%;display: none;"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}} file-info'
href="{{$.RepoLink}}/grampus/train-job/{{.JobID}}/download_multi_model?version_name={{.VersionName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.all_result_download"}}</span>
</a>
</div> </div>
<div id="dir_list{{.VersionName}}"> <div id="dir_list{{.VersionName}}">
</div> </div>


+ 5
- 5
templates/repo/home.tmpl View File

@@ -311,7 +311,7 @@
<div class="ui six wide tablet four wide computer column"> <div class="ui six wide tablet four wide computer column">
<div id="repo-desc" data-IsAdmin="{{.Permission.IsAdmin}}" <div id="repo-desc" data-IsAdmin="{{.Permission.IsAdmin}}"
data-IsArchived="{{.Repository.IsArchived}}"> data-IsArchived="{{.Repository.IsArchived}}">
<h4 id="about-desc" class="ui header">简介</h4>
<h4 id="about-desc" class="ui header"></h4>
<input type="hidden" id="edit-alias" value="{{.Repository.Alias}}"> <input type="hidden" id="edit-alias" value="{{.Repository.Alias}}">
<p> <p>
{{if .Repository.DescriptionHTML}} {{if .Repository.DescriptionHTML}}
@@ -363,15 +363,15 @@
<h4 class="ui header"> <h4 class="ui header">
{{$lenCon := len .ContributorInfo}} {{$lenCon := len .ContributorInfo}}
{{if lt $lenCon 25 }} {{if lt $lenCon 25 }}
<strong>贡献者 ({{len .ContributorInfo}})</strong>
<strong>{{.i18n.Tr "home.contributors"}} ({{len .ContributorInfo}})</strong>
{{else}} {{else}}
<strong>贡献者 ({{len .ContributorInfo}}+)</strong>
<strong>{{.i18n.Tr "home.contributors"}} ({{len .ContributorInfo}}+)</strong>
{{end}} {{end}}


<div class="ui right"> <div class="ui right">
<!-- <a class="membersmore text grey" href="{{.RepoLink}}/contributors">全部 {{svg "octicon-chevron-right" 16}}</a> -->
<!-- <a class="membersmore text grey" href="{{.RepoLink}}/contributors">{{.i18n.Tr "repo.computing.all"}} {{svg "octicon-chevron-right" 16}}</a> -->
<a class="membersmore text grey" <a class="membersmore text grey"
href="{{.RepoLink}}/contributors?type={{if .IsViewBranch}}branch{{else}}tag{{end}}&name={{.BranchName}}">全部
href="{{.RepoLink}}/contributors?type={{if .IsViewBranch}}branch{{else}}tag{{end}}&name={{.BranchName}}">{{.i18n.Tr "repo.computing.all"}}
{{svg "octicon-chevron-right" 16}}</a> {{svg "octicon-chevron-right" 16}}</a>
</div> </div>
</h4> </h4>


+ 12
- 4
templates/repo/modelarts/inferencejob/show.tmpl View File

@@ -353,10 +353,18 @@
<div class="ui tab" data-tab="third"> <div class="ui tab" data-tab="third">
<input type="hidden" name="model{{.VersionName}}" value="-1"> <input type="hidden" name="model{{.VersionName}}" value="-1">
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> <input type="hidden" name="modelback{{.VersionName}}" value="-1">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">result</div>
<div class="divider"> / </div>

<div style="display: flex;justify-content: space-between;">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">result</div>
<div class="divider"> / </div>
</div>
<a id="{{.VersionName}}-result-down" style="padding-right: 1%;display: none;"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}} file-info'
href="{{$.RepoLink}}/modelarts/inference-job/{{.JobID}}/downloadall?version_name={{.VersionName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.all_result_download"}}</span>
</a>
</div> </div>
<div id="dir_list{{.VersionName}}"> <div id="dir_list{{.VersionName}}">




+ 16
- 3
templates/repo/modelarts/notebook/new.tmpl View File

@@ -4,7 +4,7 @@
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true"></div>
<div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-exceed-size="{{DebugAttachSize}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -77,8 +77,21 @@
<div class="inline min_title required field"> <div class="inline min_title required field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label>
<select id="cloudbrain_image" class="ui search dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" name="image_id"> <select id="cloudbrain_image" class="ui search dropdown width48" placeholder="{{.i18n.Tr "cloudbrain.choose_mirror"}}" name="image_id">
{{range .images}}
<option name="image_id" value="{{.Id}}">{{.Value}}</option>
{{if .image_id}}
{{range .images}}
{{if eq $.image_id .Id}}
<option value="{{.Id}}">{{.Value}}</option>
{{end}}
{{end}}
{{range .images}}
{{if ne $.image_id .Id}}
<option value="{{.Id}}">{{.Value}}</option>
{{end}}
{{end}}
{{else}}
{{range .images}}
<option name="image_id" value="{{.Id}}">{{.Value}}</option>
{{end}}
{{end}} {{end}}
</select> </select>
</div> </div>


+ 2
- 1
templates/repo/modelarts/trainjob/para_manage.tmpl View File

@@ -107,6 +107,7 @@


<script> <script>
// 删除时用户确认 // 删除时用户确认
var lang_canceled_operation = {{.i18n.Tr "repo.canceled_operation"}};
function assertDelete(obj) { function assertDelete(obj) {
if (obj.style.color == "rgb(204, 204, 204)") { if (obj.style.color == "rgb(204, 204, 204)") {
return return
@@ -124,7 +125,7 @@
}, },
onHidden: function() { onHidden: function() {
if (flag == false) { if (flag == false) {
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
$('.alert').html(lang_canceled_operation).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
} }
} }
}) })


+ 24
- 4
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -159,6 +159,17 @@
</tr> </tr>
<tr class="ti-no-ng-animate"> <tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80"> <td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.User.Name}}
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.run_version"}} {{$.i18n.Tr "repo.modelarts.run_version"}}
</td> </td>


@@ -411,10 +422,19 @@
<div class="ui tab" data-tab="third{{$k}}"> <div class="ui tab" data-tab="third{{$k}}">
<input type="hidden" name="model{{.VersionName}}" value="-1"> <input type="hidden" name="model{{.VersionName}}" value="-1">
<input type="hidden" name="modelback{{.VersionName}}" value="-1"> <input type="hidden" name="modelback{{.VersionName}}" value="-1">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>

<div style="display: flex;justify-content: space-between;">
<div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
<div class="active section">{{.VersionName}}</div>
<div class="divider"> / </div>
</div>
<a id="{{.VersionName}}-result-down" style="padding-right: 1%;display: none;"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}} file-info'
href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/download_multi_model?version_name={{.VersionName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.all_result_download"}}</span>
</a>
</div> </div>
<div id="dir_list{{.VersionName}}" style="max-height: 500px;overflow:auto;"> <div id="dir_list{{.VersionName}}" style="max-height: 500px;overflow:auto;">




+ 9
- 4
templates/repo/modelmanage/convertshowinfo.tmpl View File

@@ -501,6 +501,11 @@ td, th {
let downlaodFlag = {{$.canDownload}} let downlaodFlag = {{$.canDownload}}
let taskID = {{$.task.ID}} let taskID = {{$.task.ID}}
let realJobName = {{$.task.ID}} let realJobName = {{$.task.ID}}
let lang_scrolled_logs_top = {{$.i18n.Tr "repo.scrolled_logs_top"}};
let lang_scrolled_logs_top_pls_retry = {{$.i18n.Tr "repo.scrolled_logs_top_pls_retry"}};
let lang_scrolled_logs_bottom = {{$.i18n.Tr "repo.scrolled_logs_bottom"}};
let lang_scrolled_logs_bottom_pls_retry = {{$.i18n.Tr "repo.scrolled_logs_bottom_pls_retry"}};

$(document).ready(function(){ $(document).ready(function(){
let url = window.location.href; let url = window.location.href;
let urlArr = url.split('/') let urlArr = url.split('/')
@@ -746,7 +751,7 @@ td, th {
let end_line = $(`#log_npu input[name=end_line]`).val() let end_line = $(`#log_npu input[name=end_line]`).val()
$.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${end_line}&lines=50&order=desc`, (data) => { $.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${end_line}&lines=50&order=desc`, (data) => {
if (data.Lines == 0){ if (data.Lines == 0){
$(`#log_npu_header`).text('您已翻阅至日志底部')
$(`#log_npu_header`).text(lang_scrolled_logs_bottom)
$(`#log_npu_message`).css('display', 'block') $(`#log_npu_message`).css('display', 'block')
setTimeout(function(){ setTimeout(function(){
$(`#log_npu_message`).css('display', 'none') $(`#log_npu_message`).css('display', 'none')
@@ -769,7 +774,7 @@ td, th {
let start_line = $(`#log_npu input[name=start_line]`).val() let start_line = $(`#log_npu input[name=start_line]`).val()
$.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${start_line}&lines=50&order=asc`, (data) => { $.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${start_line}&lines=50&order=asc`, (data) => {
if (data.Lines == 0){ if (data.Lines == 0){
$(`#log_npu_header`).text('您已翻阅至日志顶部')
$(`#log_npu_header`).text(lang_scrolled_logs_top)
$(`#log_npu_message`).css('display', 'block') $(`#log_npu_message`).css('display', 'block')
setTimeout(function(){ setTimeout(function(){
$(`#log_npu_message`).css('display', 'none') $(`#log_npu_message`).css('display', 'none')
@@ -812,7 +817,7 @@ td, th {
$(`#log_npu input[name=end_line]`).val(data.EndLine) //如果变动就改变所对应的值 $(`#log_npu input[name=end_line]`).val(data.EndLine) //如果变动就改变所对应的值
$(`#log_npu input[name=start_line]`).val(data.StartLine) $(`#log_npu input[name=start_line]`).val(data.StartLine)
$(`#log_npu`).prepend('<pre>' + data.Content) $(`#log_npu`).prepend('<pre>' + data.Content)
$(`#log_npu_header`).text('您已翻阅至日志顶部')
$(`#log_npu_header`).text(lang_scrolled_logs_top)
$(`#log_npu_message`).css('display', 'block') $(`#log_npu_message`).css('display', 'block')
setTimeout(function(){ setTimeout(function(){
$(`#log_npu_message`).css('display', 'none') $(`#log_npu_message`).css('display', 'none')
@@ -832,7 +837,7 @@ td, th {
$(`#log_npu`).append('<pre>' + data.Content) $(`#log_npu`).append('<pre>' + data.Content)
$.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${data.EndLine}&lines=50&order=desc`, (data) => { $.get(`/api/v1/repos/${userName}/${repoPath}/modelmanage/${taskID}/modelartlog?version_name=V0001&base_line=${data.EndLine}&lines=50&order=desc`, (data) => {
if (data.Lines == 0){ if (data.Lines == 0){
$(`#log_npu_header`).text('您已翻阅至日志底部')
$(`#log_npu_header`).text(lang_scrolled_logs_bottom)
$(`#log_npu_message`).css('display', 'block') $(`#log_npu_message`).css('display', 'block')
setTimeout(function(){ setTimeout(function(){
$(`#log_npu_message`).css('display', 'none') $(`#log_npu_message`).css('display', 'none')


+ 2
- 35
templates/repo/modelsafety/new.tmpl View File

@@ -49,7 +49,7 @@
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
{{$Grampus := (or (eq (index (SubJumpablePath .Link) 1) "create_grampus_gpu") (eq (index (SubJumpablePath .Link) 1) "create_grampus_npu"))}} {{$Grampus := (or (eq (index (SubJumpablePath .Link) 1) "create_grampus_gpu") (eq (index (SubJumpablePath .Link) 1) "create_grampus_npu"))}}
<div class="cloudbrain-type" style="display: none;" data-grampus="{{$Grampus}}" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
<div class="cloudbrain-type" style="display: none;" data-grampus="{{$Grampus}}" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}"></div>
{{if eq .NotStopTaskCount 0}} {{if eq .NotStopTaskCount 0}}
{{template "base/alert" .}} {{template "base/alert" .}}
{{end}} {{end}}
@@ -141,40 +141,7 @@
onkeydown="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)"
onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea> onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
</div> </div>
<input type="hidden" id="ai_model_version" name="model_version" value="{{$.model_version}}">
<div class="required inline min_title fields" style="width: 93.5%;">
<label class="label-fix-width label-required" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.infer_job.select_model"}}</label>
<div class="six wide field">
<div class="ui fluid selection dropdown" id="select_model">
<input type="hidden" name="model_name" required value="{{.model_name}}">
<div class="text"></div>
<i class="dropdown icon"></i>
<div class="menu" id="model_name">
</div>
</div>
</div>
<input type="hidden" name="pre_train_model_url" value="{{.train_url}}">
<div class="three wide field">
<div class="ui fluid selection dropdown" id="select_model_version">
<input type="hidden" name="train_url" required value="{{.train_url}}">
<div class="text"></div>
<i class="dropdown icon"></i>
<div class="menu" id="model_name_version"></div>
</div>
</div>
<div class="five wide field">
<div class="ui fluid selection dropdown" id="select_model_checkpoint">
<input type="hidden" name="ckpt_name" required value="{{.ckpt_name}}">
<div class="text"></div>
<i class="dropdown icon"></i>
<div class="menu" id="model_checkpoint">
</div>
</div>
</div>
<span >
<i class="question circle icon" data-content="{{.i18n.Tr "cloudbrain.model_file_postfix_rule"}}" data-position="top center" data-variation="inverted mini"></i>
</span>
</div>
{{template "custom/select_model" .}}
<div class="required inline min_title field " style="display: none;"> <div class="required inline min_title field " style="display: none;">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label> <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label>
<select class="ui dropdown width48" id="trainjob_resource_pool" name="pool_id"> <select class="ui dropdown width48" id="trainjob_resource_pool" name="pool_id">


+ 46
- 4
templates/user/auth/signin.tmpl View File

@@ -1,9 +1,51 @@
{{template "base/head" .}} {{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<script>
var ActivityTpl = {{ .ActivityTpl }};
</script>
<div class="user signin{{if .LinkAccountMode}} icon{{end}}"> <div class="user signin{{if .LinkAccountMode}} icon{{end}}">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
{{template "user/auth/signin_inner" .}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
{{template "user/auth/signin_navbar" .}}
{{template "user/auth/signin_inner" .}}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>


+ 43
- 4
templates/user/auth/signin_cloud_brain.tmpl View File

@@ -1,9 +1,48 @@
{{template "base/head" .}} {{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="user signin"> <div class="user signin">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
{{template "user/auth/signin_cloudbrain" .}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
{{template "user/auth/signin_navbar" .}}
{{template "user/auth/signin_cloudbrain" .}}
</div>
</div>
</div> </div>
</div> </div>
</div> </div>


+ 1
- 1
templates/user/auth/signin_navbar.tmpl View File

@@ -1,5 +1,5 @@
{{if or .EnablePhone .EnableOpenIDSignIn .EnableSSPI .EnableCloudBrain}} {{if or .EnablePhone .EnableOpenIDSignIn .EnableSSPI .EnableCloudBrain}}
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar">
<div class="ui secondary pointing tabular top attached borderless menu new-menu navbar" style="margin-bottom:45px !important;background-color:transparent !important;">
{{if .EnablePhone }} {{if .EnablePhone }}
<a class="{{if .PageIsPhoneLogin}}active{{end}} item" rel="nofollow" href="{{AppSubUrl}}/user/login/phone"> <a class="{{if .PageIsPhoneLogin}}active{{end}} item" rel="nofollow" href="{{AppSubUrl}}/user/login/phone">
{{.i18n.Tr "phone.mobile_login"}} {{.i18n.Tr "phone.mobile_login"}}


+ 97
- 59
templates/user/auth/signin_phone.tmpl View File

@@ -1,73 +1,111 @@
{{template "base/head" .}} {{template "base/head" .}}
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="user signin"> <div class="user signin">
{{template "user/auth/signin_navbar" .}}
<div class="ui container">
<div class="ui raised very padded text container segment">
<style>
.full.height{background-color: #F9F9F9;}
.ui.left:not(.action){ float:none;}
.ui.left{ float:none;}
.ui.secondary.pointing.menu{ border-bottom:none;}
</style>
{{template "base/alert" .}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signin_title"}}
{{else}}
{{.i18n.Tr "auth.login_userpass"}}
{{end}}
</h2>
</div>
{{if .ShowRegistrationButton}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</div>
{{end}}
<div class="ui container" style="margin-top:60px;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div> </div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="/user/login/phone" method="post">
{{.CsrfTokenHtml}}

{{if .EnablePhone }}
<div class="use-type" usetype="1" autofocus="true">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}

<div class="two fields inline">
<div class="field">
<div class="ui checkbox">
<label>{{.i18n.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox">
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
<style>
.full.height{background-color: #F9F9F9;}
.ui.left:not(.action){ float:none;}
.ui.left{ float:none;}
.ui.secondary.pointing.menu{ border-bottom:none;}
</style>
{{template "user/auth/signin_navbar" .}}
{{template "base/alert" .}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signin_title"}}
{{else}}
{{.i18n.Tr "auth.login_userpass"}}
{{end}}
</h2>
</div> </div>
{{if .ShowRegistrationButton}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/sign_up">{{.i18n.Tr "auth.sign_up_now" | Str2html}}</a>
</div>
{{end}}
</div> </div>
<div class="field" style="padding-right: 0; text-align: right;">
<a href="{{AppSubUrl}}/user/forgot_password?type=phone">{{.i18n.Tr "auth.forgot_password"}}</a>
</div>
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="/user/login/phone" method="post">
{{.CsrfTokenHtml}}

{{if .EnablePhone }}
<div class="use-type" usetype="1" autofocus="true">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}


<div class="ui hidden divider"></div>
<div class="two fields inline">
<div class="field">
<div class="ui checkbox">
<label>{{.i18n.Tr "auth.remember_me"}}</label>
<input name="remember" type="checkbox">
</div>
</div>
<div class="field" style="padding-right: 0; text-align: right;">
<a href="{{AppSubUrl}}/user/forgot_password?type=phone">{{.i18n.Tr "auth.forgot_password"}}</a>
</div>
</div>


<div class="center aligned field">
<button class="fluid large ui blue button">
{{.i18n.Tr "sign_in"}}
</button>
<div class="ui hidden divider"></div>

<div class="center aligned field">
<button class="fluid large ui blue button">
{{.i18n.Tr "sign_in"}}
</button>
</div>
</form>
</div>
</div>
</div> </div>
</form>
</div> </div>
</div> </div>
</div> </div>
</div>

</div>
</div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

+ 45
- 0
templates/user/auth/signin_up_img_default.tmpl View File

@@ -0,0 +1,45 @@
<div style="width:100%;height:100%;
border-radius: 0.28571429rem;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);
display: flex;
flex-direction: column;
justify-content: center;
padding: 0 40px;
background: url('/img/login_bg_default.png') center center no-repeat;
background-size: cover;
border-right:none !important;
">
<div style="margin: 14px 0;">
<span style="font-weight:500;font-size:28px;color:rgb(0, 122, 255);">{{.i18n.Tr "auth.openi_community_really_awesome"}}</span>
</div>
<div style="margin: 14px 0;">
<span style="font-weight:300;font-size:14px;color:rgb(140, 162, 170);">{{.i18n.Tr "home.page_description"}}</span>
</div>
<div style="margin: 14px 0;">
<div style="width:111px">
<a href="https://openi.pcl.ac.cn/zeizei/OpenI_Learning">
<div style="
width: 111px;
height: 40px;
font-size: 14px;
border-color: rgb(0, 122, 255);
border-width: 1px;
border-style: solid;
color: rgb(0, 122, 255);
display:flex;
align-items: center;
justify-content: center;
">
<svg xmlns="http://www.w3.org/2000/svg" style="margin-right:8px;margin-top:-2px;" class="styles__StyledSVGIconPathComponent-sc-16fsqc8-0 fPsHiw svg-icon-path-icon fill" viewBox="0 0 32 32" width="16" height="16"><defs data-reactroot=""></defs><g><path fill="rgb(0, 122, 255)" d="M2.667 5.324c0.005-0.729 0.594-1.318 1.322-1.324h24.022c0.731 0 1.323 0.593 1.323 1.324v21.352c-0.005 0.729-0.594 1.318-1.322 1.324h-24.022c-0.731-0.001-1.323-0.593-1.323-1.324v0-21.352zM14.667 6.667h-9.333v18.667h9.333v-18.667zM17.333 6.667v18.667h9.333v-18.667h-9.333zM18.667 9.333h6.667v2.667h-6.667v-2.667zM18.667 13.333h6.667v2.667h-6.667v-2.667z"></path></g></svg>
<span>{{.i18n.Tr "custom.Platform_Tutorial"}}</span>
</div>
</a>
</div>
</div>
</div>



+ 136
- 97
templates/user/auth/signup_inner.tmpl View File

@@ -1,112 +1,151 @@
<style> <style>
.full.height{background-color: #F9F9F9;} .full.height{background-color: #F9F9F9;}
</style> </style>

<div class="ui container very padded {{if .LinkAccountMode}} icon{{end}}" style=" padding-top: 5.0rem; padding-bottom: 3.0rem;">
<div class="ui raised very padded text container segment">
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_title"}}
{{else}}
{{.i18n.Tr "sign_up"}}
{{end}}
</h2>
</div>
{{if not .LinkAccountMode}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_helper_msg"}}</a>
</div>
{{end}}
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}}
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
{{template "base/alert" .}}
{{end}}
<div class="ui negative message" style="display:none;">
<p></p>
</div>
{{if .DisableRegistration}}
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
{{else}}
<div class="field invitation_tips" style="font-weight:400;font-size:14px;color:rgba(250,140,22,1);{{if not .invitationCode}}display:none;{{end}}">
<span>{{.i18n.Tr "your_friend"}} <span class="__invitation_code__">{{.invitationCode}}</span> {{.i18n.Tr "invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources"}}</span>
</div>
<div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
</div>
<div class="field {{if .Err_Email}}error{{end}}">
<input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
</div>

{{if not .DisablePassword}}
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
</div>
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "image")}}
<div class="field">
{{.Captcha.CreateHtml}}
</div>
<div class="field {{if .Err_Captcha}}error{{end}}">
<input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
<div class="field required">
<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
</div>
<style>
@media only screen and (max-width: 1200px) {
._container {
display:block !important;
}
._left-img-area {
display: none;
}
._right_content_area {
}
._right_content_area .segment {
margin-left: auto !important;
border-top-left-radius: .28571429rem !important;
border-bottom-left-radius: .28571429rem !important;
border-left: border: 1px solid rgba(34,36,38,.15) !important;
}
}
</style>
<div class="ui container very padded {{if .LinkAccountMode}} icon{{end}}" style=" padding-top: 5.0rem; padding-bottom: 3.0rem;">
<div class="_container" style="display:flex;justify-content:center;">
<div class="_left-img-area" style="padding-right:0;flex:2">
<div style="width:450px;height:100%;float:right;border-radius:0.28571429rem;border-top-right-radius: 0;
border-bottom-right-radius: 0;border-right:none !important;overflow: hidden;
-webkit-box-shadow: 0 2px 4px 0 rgba(34,36,38,.12),0 2px 10px 0 rgba(34,36,38,.15);
box-shadow: 0 2px 4px 0rgba(34,36,38,.12),0 2px 10px 0rgba(34,36,38,.15);">
{{ if .ActivityTpl }}
{{ .ActivityTpl | Safe}}
{{ else }}
{{ template "user/auth/signin_up_img_default" .}}
{{ end }}
</div>
</div>
<div class="_right_content_area" style="padding-left:0;flex:3;">
<div class="ui raised very padded text container segment" style="margin-left:0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: none !important;
">
<div class="ui centered grid">
<div class="sixteen wide mobile ten wide tablet ten wide computer column">
<div class="ui bottom aligned two column grid">
<div class="column">
<h2 class="ui header">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_title"}}
{{else}}
{{.i18n.Tr "sign_up"}}
{{end}} {{end}}
{{if .EnablePhone }}
<div class="use-type" usetype="0">
{{template "user/auth/phone_verify" .}}
</h2>
</div>
{{if not .LinkAccountMode}}
<div class="ui right floated column">
<a href="{{AppSubUrl}}/user/login">{{.i18n.Tr "auth.register_helper_msg"}}</a>
</div>
{{end}}
</div>
<div class="ui grid">
<div class="column">
<form class="ui form" action="{{.SignUpLink}}" method="post">
{{.CsrfTokenHtml}}
{{if or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister)}}
{{template "base/alert" .}}
{{end}}
<div class="ui negative message" style="display:none;">
<p></p>
</div> </div>
{{end}}
<div class="field">
<div style="display:flex;">
<div style="display:flex;align-items:center;">
<span>{{.i18n.Tr "recommender"}}</span>
{{if .DisableRegistration}}
<p>{{.i18n.Tr "auth.disable_register_prompt"}}</p>
{{else}}
<div class="field invitation_tips" style="font-weight:400;font-size:14px;color:rgba(250,140,22,1);{{if not .invitationCode}}display:none;{{end}}">
<span>{{.i18n.Tr "your_friend"}} <span class="__invitation_code__">{{.invitationCode}}</span> {{.i18n.Tr "invite_you_to_join_the_OpenI_AI_Collaboration_Platform_and_enjoy_abundant_free_computing_resources"}}</span>
</div>
<div class="field {{if and (.Err_UserName) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="user_name" name="user_name" value="{{.user_name}}" placeholder="{{.i18n.Tr "username"}}" autofocus required>
</div>
<div class="field {{if .Err_Email}}error{{end}}">
<input id="email" name="email" type="email" value="{{.email}}" placeholder="{{.i18n.Tr "email"}}" required>
</div> </div>
<input style="flex:1;margin-left:12px;" id="invitation_code" name="invitation_code" value="{{.invitationCode}}" {{if .invitationCode}}readonly="true"{{end}} autocomplete="off" />
</div>
</div>


<div class="field">
<div class="ui checkbox">
<input name="agree" type="checkbox" tabindex="0" class="hidden" {{if .agree}}checked{{end}}><label>{{.i18n.Tr "use_and_privacy_agree" "/home/term" "/home/privacy" | Safe}}</label>
</div>
</div>
<div class="ui hidden divider"></div>
<div class="center aligned field">
<button class="fluid large ui blue button">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_submit"}}
{{else}}
{{.i18n.Tr "auth.create_new_account"}}
{{if not .DisablePassword}}
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="password" name="password" type="password" value="{{.password}}" placeholder="{{.i18n.Tr "password"}}" autocomplete="off" required>
</div>
<div class="field {{if and (.Err_Password) (or (not .LinkAccountMode) (and .LinkAccountMode .LinkAccountModeRegister))}}error{{end}}">
<input id="retype" name="retype" type="password" value="{{.retype}}" placeholder="{{.i18n.Tr "re_type"}}" autocomplete="off" required>
</div>
{{end}} {{end}}
</button>
</div>
{{end}}
</form>
</div>
{{if and .EnableCaptcha (eq .CaptchaType "image")}}
<div class="field">
{{.Captcha.CreateHtml}}
</div>
<div class="field {{if .Err_Captcha}}error{{end}}">
<input id="captcha" name="captcha" value="{{.captcha}}" placeholder="{{.i18n.Tr "captcha"}}" autocomplete="off">
</div>
{{end}}
{{if and .EnableCaptcha (eq .CaptchaType "recaptcha")}}
<div class="field required">
<div class="g-recaptcha" data-sitekey="{{ .RecaptchaSitekey }}"></div>
</div>
{{end}}
{{if .EnablePhone }}
<div class="use-type" usetype="0">
{{template "user/auth/phone_verify" .}}
</div>
{{end}}
<div class="field">
<div style="display:flex;">
<div style="display:flex;align-items:center;">
<span>{{.i18n.Tr "recommender"}}</span>
</div>
<input style="flex:1;margin-left:12px;" id="invitation_code" name="invitation_code" value="{{.invitationCode}}" {{if .invitationCode}}readonly="true"{{end}} autocomplete="off" />
</div>
</div>

<div class="field">
<div class="ui checkbox">
<input name="agree" type="checkbox" tabindex="0" class="hidden" {{if .agree}}checked{{end}}><label>{{.i18n.Tr "use_and_privacy_agree" "/home/term" "/home/privacy" | Safe}}</label>
</div>
</div>
<div class="ui hidden divider"></div>
<div class="center aligned field">
<button class="fluid large ui blue button">
{{if .LinkAccountMode}}
{{.i18n.Tr "auth.oauth_signup_submit"}}
{{else}}
{{.i18n.Tr "auth.create_new_account"}}
{{end}}
</button>
</div>
{{end}}
</form>
</div>
</div>
</div>
</div> </div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

<script> <script>
; (function() { ; (function() {
var getUrlParams = function() { var getUrlParams = function() {


+ 5
- 5
templates/user/dashboard/cloudbrains.tmpl View File

@@ -71,7 +71,7 @@
<div class="row"> <div class="row">
<!-- 任务名 --> <!-- 任务名 -->
{{$JobID := '0'}} {{$JobID := '0'}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY" "SNN4ECOSET"}}
{{$JobID = .Cloudbrain.ID}} {{$JobID = .Cloudbrain.ID}}
{{else}} {{else}}
{{$JobID = .JobID}} {{$JobID = .JobID}}
@@ -85,7 +85,7 @@
<span class="fitted" <span class="fitted"
style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span>
</a> </a>
{{else if (eq .JobType "SNN4IMAGENET" "BRAINSCORE")}}
{{else if (eq .JobType "SNN4IMAGENET" "BRAINSCORE" "SNN4ECOSET")}}
<a class="title" <a class="title"
href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}" href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/cloudbrain/benchmark/{{$JobID}}"
title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px">
@@ -224,7 +224,7 @@
</a> </a>
</form> </form>
{{else}} {{else}}
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}}
{{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE" "SNN4ECOSET"}}
<form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> <form id="stopForm-{{$JobID}}" style="margin-left:-1px;">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}"
@@ -274,7 +274,7 @@
</form> </form>
{{else}} {{else}}
<form class="ui compact buttons" id="delForm-{{$JobID}}" <form class="ui compact buttons" id="delForm-{{$JobID}}"
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .Cloudbrain.Type 2}}/grampus/notebook{{else}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true'
action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE") (eq .JobType "SNN4ECOSET")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .Cloudbrain.Type 2}}/grampus/notebook{{else}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else}}/modelarts/notebook{{end}}{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true'
method="post"> method="post">
{{$.CsrfTokenHtml}} {{$.CsrfTokenHtml}}
<a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}"
@@ -290,7 +290,7 @@
</div> </div>
{{else}} {{else}}
{{$JobID := '0'}} {{$JobID := '0'}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}}
{{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "SNN4ECOSET"}}
{{$JobID = .Cloudbrain.ID}} {{$JobID = .Cloudbrain.ID}}
{{else}} {{else}}
{{$JobID = .JobID}} {{$JobID = .JobID}}


+ 3
- 2
web_src/js/components/Contributors.vue View File

@@ -3,9 +3,9 @@
<div class="row git-user-content"> <div class="row git-user-content">
<h3 class="ui header"> <h3 class="ui header">
<div class="ui breadcrumb"> <div class="ui breadcrumb">
<a class="section" :href="url_code">代码</a>
<a class="section" :href="url_code">{{$i18n['code']}}</a>
<div class="divider"> / </div> <div class="divider"> / </div>
<div class="active section" >贡献者&nbsp;({{totalNum}})</div>
<div class="active section" >{{$i18n['contributors']}}&nbsp;({{totalNum}})</div>
</div> </div>
</h3> </h3>
<div class="ui horizontal relaxed list"> <div class="ui horizontal relaxed list">
@@ -76,6 +76,7 @@ watch: {


}, },
created(){ created(){
this.$i18n = window.i18n;
const url = window.location.pathname; const url = window.location.pathname;
this.url = url; this.url = url;
let strIndex = this.url.indexOf("contributors") let strIndex = this.url.indexOf("contributors")


+ 8
- 7
web_src/js/components/EditAboutInfo.vue View File

@@ -1,13 +1,13 @@
<template> <template>
<div> <div>
<h4 id="about-desc" class="ui header desc-home">简介
<h4 id="about-desc" class="ui header desc-home">{{$i18n['introduction']}}
<a class="edit-icon" v-if="IsPermit" id ="editBtn" href="javascript:void(0)" @click="editClick" > <a class="edit-icon" v-if="IsPermit" id ="editBtn" href="javascript:void(0)" @click="editClick" >
<i class="gray edit outline icon" style="margin-right: 0;"></i> <i class="gray edit outline icon" style="margin-right: 0;"></i>
</a> </a>
</h4> </h4>
<edit-dialog-cmpt <edit-dialog-cmpt
:vmContext="vmContext" :vmContext="vmContext"
dialogTitle="编辑仓库信息"
:dialogTitle="$i18n['edit_repository_information']"
v-model="editDataDialog" v-model="editDataDialog"
:deleteCallback="editDataFunc" :deleteCallback="editDataFunc"
:deleteLoading ="editDataListLoading" :deleteLoading ="editDataListLoading"
@@ -19,11 +19,11 @@
</div> </div>
<div slot="content"> <div slot="content">
<el-form label-position="top" :model="info" :rules="rule" ref="ruleForm"> <el-form label-position="top" :model="info" :rules="rule" ref="ruleForm">
<el-form-item label="简介" prop="desc">
<el-input v-model="info.desc" type="textarea" placeholder="请输入内容" :autosize="{minRows:4,maxRows:6}" maxlength="255" show-word-limit></el-input>
<el-form-item :label="$i18n['introduction']" prop="desc">
<el-input v-model="info.desc" type="textarea" :placeholder="$i18n['please_enter_the_content']" :autosize="{minRows:4,maxRows:6}" maxlength="255" show-word-limit></el-input>
</el-form-item> </el-form-item>
<el-form-item label="主页" prop="index_web" >
<el-input v-model="info.index_web" placeholder="主页(eg: https://openi.pcl.ac.cn)"></el-input>
<el-form-item :label="$i18n['homePage']" prop="index_web" >
<el-input v-model="info.index_web" :placeholder="`${$i18n['homePage']}(eg: https://openi.pcl.ac.cn)`"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@@ -53,8 +53,8 @@ export default {
index_web: '', index_web: '',
repo_name_name: '', repo_name_name: '',
alias:'', alias:'',
IsPermit:false
}, },
IsPermit: false,
// rule1:[{min:3,max:5,message:'1',trigger:"blur"}], // rule1:[{min:3,max:5,message:'1',trigger:"blur"}],
rule: { rule: {
index_web: [ index_web: [
@@ -147,6 +147,7 @@ export default {
} }
}, },
created() { created() {
this.$i18n = window.i18n;
this.getIsSigned(); this.getIsSigned();
} }




+ 6
- 6
web_src/js/components/EditTopics.vue View File

@@ -3,7 +3,7 @@
<div class="input-search"> <div class="input-search">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic" placeholder="搜索或创建标签">
<el-input v-model="input" clearable :autofocus="true" @input="changeValue" id="topics_input" @keyup.enter.native="postTopic" :placeholder="$i18n['searchOrCreateTopics']">


</el-input> </el-input>
<div class="scrolling-menu"> <div class="scrolling-menu">
@@ -14,7 +14,7 @@
<div class="text">{{arr.topic_name.toLowerCase()}} </div> <div class="text">{{arr.topic_name.toLowerCase()}} </div>
</div> </div>
<div v-if="showInputValue" class="addition item-text" @click="postTopic"> <div v-if="showInputValue" class="addition item-text" @click="postTopic">
点击或回车添加<b class="user-add-label-text">{{input.toLowerCase()}}</b>标签
{{$i18n['clickOrEnterToAdd']}}<b class="user-add-label-text">{{input.toLowerCase()}}</b>{{$i18n['topic']}}
</div> </div>
<div v-if="showAddTopic" class="item-text" @click="addPostTopic"> <div v-if="showAddTopic" class="item-text" @click="addPostTopic">
<div class="icon-wrapper"> <div class="icon-wrapper">
@@ -98,7 +98,7 @@ export default {
this.Post(data,topics) this.Post(data,topics)
this.$set(this.showInitTopic,item,false) this.$set(this.showInitTopic,item,false)
if(this.arrayTopics.length===0){ if(this.arrayTopics.length===0){
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
$('#repo-topics1').append(`<span class="no-description text-italic">${this.$i18n['noTopics']}</span>`)
}else{ }else{
$('#repo-topics1').children('span').remove() $('#repo-topics1').children('span').remove()
} }
@@ -264,7 +264,7 @@ export default {
if(this.arrayTopics.length===0){ if(this.arrayTopics.length===0){
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
$('#repo-topics1').append(`<span class="no-description text-italic">${this.$i18n['noTopics']}</span>`)
}else{ }else{
$('#repo-topics1').children('span').remove() $('#repo-topics1').children('span').remove()
} }
@@ -386,12 +386,12 @@ mounted() {
}); });
if(this.arrayTopics.length===0){ if(this.arrayTopics.length===0){
$('#repo-topics1').append('<span class="no-description text-italic">暂无标签</span>')
$('#repo-topics1').append(`<span class="no-description text-italic">${this.$i18n['noTopics']}</span>`)
} }
this.changeValue() this.changeValue()
} , } ,
created(){ created(){
this.$i18n = window.i18n;
this.initTopics(); this.initTopics();
this.input='' this.input=''


+ 2
- 2
web_src/js/components/Model.vue View File

@@ -450,7 +450,7 @@ export default {
onHidden: function () { onHidden: function () {
if (flag == false) { if (flag == false) {
$(".alert") $(".alert")
.html("您已取消操作")
.html(_this.i18n['canceled_operation'])
.removeClass("alert-success") .removeClass("alert-success")
.addClass("alert-danger") .addClass("alert-danger")
.show() .show()
@@ -458,7 +458,7 @@ export default {
.fadeOut(); .fadeOut();
} else { } else {
$(".alert") $(".alert")
.html("删除成功")
.html(_this.i18n['successfully_deleted'])
.removeClass("alert-danger") .removeClass("alert-danger")
.addClass("alert-success") .addClass("alert-success")
.show() .show()


+ 3
- 2
web_src/js/components/basic/editDialog.vue View File

@@ -15,8 +15,8 @@
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">


<button class="ui button" @click="deleteDialog = false">{{"取消"}}</button>
<button class="ui green button" @click="deleteCallback.call(vmContext,deleteParam)">{{"确定"}}</button>
<button class="ui button" @click="deleteDialog = false">{{$i18n['cancel']}}</button>
<button class="ui green button" @click="deleteCallback.call(vmContext,deleteParam)">{{$i18n['confirm']}}</button>
<!-- <el-button size="small" style="font-size: 1rem;padding: .78571429em 1.5em .78571429em;border-radius: .28571429rem;" @click="deleteDialog = false">{{"取消"}}</el-button> <!-- <el-button size="small" style="font-size: 1rem;padding: .78571429em 1.5em .78571429em;border-radius: .28571429rem;" @click="deleteDialog = false">{{"取消"}}</el-button>
<el-button size="small" style="background-color: #21ba45;color: #fff;font-size: 1rem;padding: .78571429em 1.5em .78571429em;border-radius: .28571429rem;" @click="deleteCallback.call(vmContext,deleteParam)">{{"确定"}}</el-button> --> <el-button size="small" style="background-color: #21ba45;color: #fff;font-size: 1rem;padding: .78571429em 1.5em .78571429em;border-radius: .28571429rem;" @click="deleteCallback.call(vmContext,deleteParam)">{{"确定"}}</el-button> -->
</div> </div>
@@ -71,6 +71,7 @@ export default {
}, },
}, },
created() { created() {
this.$i18n = window.i18n;
this.deleteDialog = this.value; this.deleteDialog = this.value;
} }
}; };


+ 29
- 0
web_src/js/components/dataset/selectDataset.vue View File

@@ -176,6 +176,12 @@
> >
{{ i18n.dataset_unzip_failed }} {{ i18n.dataset_unzip_failed }}
</span> </span>
<span
class="unzip-failed"
v-if="data.Size > exceedSize"
>
{{ i18n.dataset_exceeds_failed }}{{exceedSize/(1000*1000*1000)}}G
</span>
</span> </span>
</span> </span>
</el-tree> </el-tree>
@@ -282,6 +288,12 @@
> >
{{ i18n.dataset_unzip_failed }} {{ i18n.dataset_unzip_failed }}
</span> </span>
<span
class="unzip-failed"
v-if="data.Size > exceedSize"
>
{{ i18n.dataset_exceeds_failed }}{{exceedSize/(1000*1000*1000)}}G
</span>
</span> </span>
</span> </span>
</el-tree> </el-tree>
@@ -388,6 +400,12 @@
> >
{{ i18n.dataset_unzip_failed }} {{ i18n.dataset_unzip_failed }}
</span> </span>
<span
class="unzip-failed"
v-if="data.Size > exceedSize"
>
{{ i18n.dataset_exceeds_failed }}{{exceedSize/(1000*1000*1000)}}G
</span>
</span> </span>
</span> </span>
</el-tree> </el-tree>
@@ -494,6 +512,12 @@
> >
{{ i18n.dataset_unzip_failed }} {{ i18n.dataset_unzip_failed }}
</span> </span>
<span
class="unzip-failed"
v-if="data.Size > exceedSize"
>
{{ i18n.dataset_exceeds_failed }}{{exceedSize/(1000*1000*1000)}}G
</span>
</span> </span>
</span> </span>
</el-tree> </el-tree>
@@ -625,6 +649,7 @@ export default {
paramsFavorite: { page: 1, q: "" }, paramsFavorite: { page: 1, q: "" },
loadingFavorite: false, loadingFavorite: false,
initFavoriteTreeNode: [], initFavoriteTreeNode: [],
exceedSize:0,
}; };
}, },
methods: { methods: {
@@ -883,6 +908,9 @@ export default {
if (curchild.DecompressState !== 1) { if (curchild.DecompressState !== 1) {
curchild.disabled = true; curchild.disabled = true;
} }
if(curchild.Size>this.exceedSize && this.exceedSize){
curchild.disabled = true;
}
curchild.ref = ref; curchild.ref = ref;
curchild.label = curchild.Name; curchild.label = curchild.Name;
preChild.push(curchild); preChild.push(curchild);
@@ -971,6 +999,7 @@ export default {
mounted() { mounted() {
this.type = $(".cloudbrain-type").data("cloudbrain-type"); this.type = $(".cloudbrain-type").data("cloudbrain-type");
this.repoLink = $(".cloudbrain-type").data("repo-link"); this.repoLink = $(".cloudbrain-type").data("repo-link");
this.exceedSize = $(".cloudbrain-type").data("exceed-size");
if ($(".cloudbrain-type").data("dataset-uuid")) { if ($(".cloudbrain-type").data("dataset-uuid")) {
this.hasSelectDatasetList = $(".cloudbrain-type") this.hasSelectDatasetList = $(".cloudbrain-type")
.data("dataset-uuid") .data("dataset-uuid")


+ 61
- 60
web_src/js/components/images/Images.vue View File

@@ -3,27 +3,27 @@
<div class="header-wrapper"> <div class="header-wrapper">
<div class="ui container"> <div class="ui container">
<el-row class="image_text"> <el-row class="image_text">
<h1>云脑镜像</h1>
<h1>{{$i18n['cloudeBrainMirror']['cloud_brain_mirror']}}</h1>
</el-row> </el-row>
</div> </div>
</div> </div>
<div class="ui container" id="header"> <div class="ui container" id="header">
<el-tabs v-model="activeName" @tab-click="handleClick"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="公开镜像" name="first" v-loading="loadingPublic">
<el-tab-pane :label="$i18n['cloudeBrainMirror']['public_mirror']" name="first" v-loading="loadingPublic">
<template v-if="tableDataPublic.length !== 0"> <template v-if="tableDataPublic.length !== 0">
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
<div> <div>
<el-checkbox v-model="checked">仅显示平台推荐</el-checkbox>
<el-checkbox v-model="checked">{{$i18n['cloudeBrainMirror']['platform_recommendations']}}</el-checkbox>
</div> </div>
</el-col> </el-col>
<el-col :span="4" <el-col :span="4"
><div style="visibility: hidden">TODO</div></el-col
><div style="visibility: hidden"></div></el-col
> >
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -33,7 +33,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -46,7 +46,7 @@
:header-cell-style="tableHeaderStyle" :header-cell-style="tableHeaderStyle"
> >
<el-table-column <el-table-column
label="镜像Tag"
:label="$i18n['cloudeBrainMirror']['mirror_tag']"
min-width="19%" min-width="19%"
align="left" align="left"
prop="tag" prop="tag"
@@ -65,7 +65,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="镜像描述"
:label="$i18n['cloudeBrainMirror']['mirror_description']"
min-width="28%" min-width="28%"
align="left" align="left"
prop="description" prop="description"
@@ -86,7 +86,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="cloudbrainType" prop="cloudbrainType"
label="可用集群"
:label="$i18n['cloudeBrainMirror']['available_clusters']"
min-width="10%" min-width="10%"
align="center" align="center"
> >
@@ -96,7 +96,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="creator" prop="creator"
label="创建者"
:label="$i18n['cloudeBrainMirror']['creator']"
min-width="8%" min-width="8%"
align="center" align="center"
> >
@@ -121,7 +121,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="updatedUnix" prop="updatedUnix"
label="创建时间"
:label="$i18n['cloudeBrainMirror']['creation_time']"
align="center" align="center"
min-width="14%" min-width="14%"
> >
@@ -129,7 +129,7 @@
{{ scope.row.updatedUnix | transformTimestamp }} {{ scope.row.updatedUnix | transformTimestamp }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" min-width="21%" label="操作">
<el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
style=" style="
@@ -171,7 +171,7 @@
<span <span
style="padding: 0 1rem; color: #0366d6; cursor: pointer" style="padding: 0 1rem; color: #0366d6; cursor: pointer"
@click="copyUrl(scope.row.place)" @click="copyUrl(scope.row.place)"
>复制地址</span
>{{$i18n['cloudeBrainMirror']['copy_address']}}</span
> >
</div> </div>
</template> </template>
@@ -199,16 +199,16 @@
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
<div> <div>
<el-checkbox v-model="checked">仅显示平台推荐</el-checkbox>
<el-checkbox v-model="checked">{{$i18n['cloudeBrainMirror']['platform_recommendations']}}</el-checkbox>
</div> </div>
</el-col> </el-col>
<el-col :span="4" <el-col :span="4"
><div style="visibility: hidden">TODO</div></el-col
><div style="visibility: hidden"></div></el-col
> >
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -218,7 +218,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -227,7 +227,7 @@
<el-empty :image-size="200"></el-empty> <el-empty :image-size="200"></el-empty>
</template> </template>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="我的镜像" name="second" v-loading="loadingCustom">
<el-tab-pane :label="$i18n['cloudeBrainMirror']['my_mirror']" name="second" v-loading="loadingCustom">
<template v-if="tableDataCustom.length !== 0"> <template v-if="tableDataCustom.length !== 0">
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
@@ -239,7 +239,7 @@
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -249,7 +249,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -262,7 +262,7 @@
:header-cell-style="tableHeaderStyle" :header-cell-style="tableHeaderStyle"
> >
<el-table-column <el-table-column
label="镜像Tag"
:label="$i18n['cloudeBrainMirror']['mirror_tag']"
min-width="19%" min-width="19%"
align="left" align="left"
prop="tag" prop="tag"
@@ -287,7 +287,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="镜像描述"
:label="$i18n['cloudeBrainMirror']['mirror_description']"
min-width="27%" min-width="27%"
align="left" align="left"
prop="description" prop="description"
@@ -308,7 +308,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="cloudbrainType" prop="cloudbrainType"
label="可用集群"
:label="$i18n['cloudeBrainMirror']['available_clusters']"
min-width="9%" min-width="9%"
align="center" align="center"
> >
@@ -318,7 +318,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="isPrivate" prop="isPrivate"
label="状态"
:label="$i18n['cloudeBrainMirror']['state']"
min-width="10%" min-width="10%"
align="center" align="center"
> >
@@ -333,14 +333,14 @@
<span <span
v-if="scope.row.isPrivate" v-if="scope.row.isPrivate"
style="color: rgb(250, 140, 22)" style="color: rgb(250, 140, 22)"
>私有</span
>{{$i18n['cloudeBrainMirror']['private']}}</span
> >
<span v-else style="color: rgb(19, 194, 141)">公开</span>
<span v-else style="color: rgb(19, 194, 141)">{{$i18n['cloudeBrainMirror']['public']}}</span>
<el-tooltip <el-tooltip
v-if="scope.row.status === 0" v-if="scope.row.status === 0"
class="item" class="item"
effect="dark" effect="dark"
content="镜像提交中..."
:content="$i18n['cloudeBrainMirror']['mirror_committed']"
placement="top" placement="top"
> >
<i class="CREATING" style="margin-left: 0.3rem"></i> <i class="CREATING" style="margin-left: 0.3rem"></i>
@@ -350,7 +350,7 @@
v-if="scope.row.status === 2" v-if="scope.row.status === 2"
class="item" class="item"
effect="dark" effect="dark"
content="检测提交镜像是否大小超过20G!"
:content="$i18n['cloudeBrainMirror']['check_exceeds_20g']"
placement="top" placement="top"
> >
<i class="FAILED" style="margin-left: 0.3rem"></i> <i class="FAILED" style="margin-left: 0.3rem"></i>
@@ -360,7 +360,7 @@
v-if="scope.row.status === 1" v-if="scope.row.status === 1"
class="item" class="item"
effect="dark" effect="dark"
content="镜像提交成功"
:content="$i18n['cloudeBrainMirror']['mirror_submitted']"
placement="top" placement="top"
> >
<i class="SUCCEEDED" style="margin-left: 0.3rem"></i> <i class="SUCCEEDED" style="margin-left: 0.3rem"></i>
@@ -370,7 +370,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="updatedUnix" prop="updatedUnix"
label="创建时间"
:label="$i18n['cloudeBrainMirror']['creation_time']"
align="center" align="center"
min-width="14%" min-width="14%"
> >
@@ -378,7 +378,7 @@
{{ scope.row.updatedUnix | transformTimestamp }} {{ scope.row.updatedUnix | transformTimestamp }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" min-width="21%" label="操作">
<el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
style=" style="
@@ -412,24 +412,24 @@
<span <span
style="padding: 0 1rem; color: #0366d6; cursor: pointer" style="padding: 0 1rem; color: #0366d6; cursor: pointer"
@click="copyUrl(scope.row.place)" @click="copyUrl(scope.row.place)"
>复制地址</span
>{{$i18n['cloudeBrainMirror']['copy_address']}}</span
> >
<div style="padding-left: 1rem; cursor: pointer"> <div style="padding-left: 1rem; cursor: pointer">
<el-dropdown size="medium"> <el-dropdown size="medium">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
更多<i
{{$i18n['cloudeBrainMirror']['more']}}<i
class="el-icon-arrow-down el-icon--right" class="el-icon-arrow-down el-icon--right"
></i> ></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item
@click.native="eidtImage(scope.row.id)" @click.native="eidtImage(scope.row.id)"
>编辑</el-dropdown-item
>{{$i18n['cloudeBrainMirror']['edit']}}</el-dropdown-item
> >
<el-dropdown-item <el-dropdown-item
style="color: red" style="color: red"
@click.native="deleteImage(scope.row.id)" @click.native="deleteImage(scope.row.id)"
>删除</el-dropdown-item
>{{$i18n['cloudeBrainMirror']['delete']}}</el-dropdown-item
> >
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -459,15 +459,15 @@
<template v-else> <template v-else>
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
<div style="visibility: hidden">TODO</div>
<div style="visibility: hidden"></div>
</el-col> </el-col>
<el-col :span="4" <el-col :span="4"
><div style="visibility: hidden">TODO</div></el-col
><div style="visibility: hidden"></div></el-col
> >
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -477,7 +477,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -486,19 +486,19 @@
<el-empty :image-size="200"></el-empty> <el-empty :image-size="200"></el-empty>
</template> </template>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="我收藏的镜像" name="third">
<el-tab-pane :label="$i18n['cloudeBrainMirror']['my_favorite_mirror']" name="third">
<template v-if="tableDataStar.length !== 0"> <template v-if="tableDataStar.length !== 0">
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
<div style="visibility: hidden">TODO</div>
<div style="visibility: hidden"></div>
</el-col> </el-col>
<el-col :span="4" <el-col :span="4"
><div style="visibility: hidden">TODO</div></el-col
><div style="visibility: hidden"></div></el-col
> >
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -508,7 +508,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -521,7 +521,7 @@
:header-cell-style="tableHeaderStyle" :header-cell-style="tableHeaderStyle"
> >
<el-table-column <el-table-column
label="镜像Tag"
:label="$i18n['cloudeBrainMirror']['mirror_tag']"
min-width="19%" min-width="19%"
align="left" align="left"
prop="tag" prop="tag"
@@ -540,7 +540,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="镜像描述"
:label="$i18n['cloudeBrainMirror']['mirror_description']"
min-width="28%" min-width="28%"
align="left" align="left"
prop="description" prop="description"
@@ -561,7 +561,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="cloudbrainType" prop="cloudbrainType"
label="可用集群"
:label="$i18n['cloudeBrainMirror']['available_clusters']"
min-width="10%" min-width="10%"
align="center" align="center"
> >
@@ -571,7 +571,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="creator" prop="creator"
label="创建者"
:label="$i18n['cloudeBrainMirror']['creator']"
min-width="8%" min-width="8%"
align="center" align="center"
> >
@@ -596,7 +596,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="updatedUnix" prop="updatedUnix"
label="创建时间"
:label="$i18n['cloudeBrainMirror']['creation_time']"
align="center" align="center"
min-width="14%" min-width="14%"
> >
@@ -604,7 +604,7 @@
{{ scope.row.updatedUnix | transformTimestamp }} {{ scope.row.updatedUnix | transformTimestamp }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" min-width="21%" label="操作">
<el-table-column align="center" min-width="21%" :label="$i18n['cloudeBrainMirror']['operation']">
<template slot-scope="scope"> <template slot-scope="scope">
<div <div
style=" style="
@@ -639,7 +639,7 @@
<span <span
style="padding: 0 1rem; color: #0366d6; cursor: pointer" style="padding: 0 1rem; color: #0366d6; cursor: pointer"
@click="copyUrl(scope.row.place)" @click="copyUrl(scope.row.place)"
>复制地址</span
>{{$i18n['cloudeBrainMirror']['copy_address']}}</span
> >
</div> </div>
</template> </template>
@@ -667,15 +667,15 @@
<template v-else> <template v-else>
<el-row style="align-items: center; display: flex"> <el-row style="align-items: center; display: flex">
<el-col :span="12"> <el-col :span="12">
<div style="visibility: hidden">TODO</div>
<div style="visibility: hidden"></div>
</el-col> </el-col>
<el-col :span="4" <el-col :span="4"
><div style="visibility: hidden">TODO</div></el-col
><div style="visibility: hidden"></div></el-col
> >
<el-col :span="8"> <el-col :span="8">
<div> <div>
<el-input <el-input
placeholder="搜镜像Tag/描述/标签..."
:placeholder="$i18n['cloudeBrainMirror']['placeholder']"
v-model="search" v-model="search"
class="input-with-select" class="input-with-select"
@keyup.enter.native="searchName()" @keyup.enter.native="searchName()"
@@ -685,7 +685,7 @@
slot="append" slot="append"
icon="el-icon-search" icon="el-icon-search"
@click="searchName()" @click="searchName()"
>搜索</el-button
>{{$i18n['cloudeBrainMirror']['search']}}</el-button
> >
</el-input> </el-input>
</div> </div>
@@ -859,7 +859,7 @@ export default {
onHidden: function () { onHidden: function () {
if (flag == false) { if (flag == false) {
$(".alert") $(".alert")
.html("您已取消操作")
.html(_this.$i18n['canceled_operation'])
.removeClass("alert-success") .removeClass("alert-success")
.addClass("alert-danger") .addClass("alert-danger")
.show() .show()
@@ -867,7 +867,7 @@ export default {
.fadeOut(); .fadeOut();
} else { } else {
$(".alert") $(".alert")
.html("删除成功")
.html(_this.$i18n['successfully_deleted'])
.removeClass("alert-danger") .removeClass("alert-danger")
.addClass("alert-success") .addClass("alert-success")
.show() .show()
@@ -921,7 +921,7 @@ export default {
document.execCommand("Copy"); document.execCommand("Copy");
cInput.remove(); cInput.remove();
$("body").toast({ $("body").toast({
message: "复制成功!",
message: this.$i18n['cloudeBrainMirror']['copy_succeeded'],
showProgress: "bottom", showProgress: "bottom",
showIcon: "check circle", showIcon: "check circle",
class: "info", class: "info",
@@ -954,9 +954,9 @@ export default {
}, },
transformPravite(val) { transformPravite(val) {
if (val) { if (val) {
return "私有";
return this.$i18n['cloudeBrainMirror']['private'];
} else { } else {
return "公开";
return this.$i18n['cloudeBrainMirror']['public'];
} }
}, },
transformTimestamp(timestamp) { transformTimestamp(timestamp) {
@@ -989,6 +989,7 @@ export default {
}, },
mounted() {}, mounted() {},
created() { created() {
this.$i18n = window.i18n;
const params = new URLSearchParams(location.search); const params = new URLSearchParams(location.search);
if (params.has("type") && params.get("type") == "myimage") { if (params.has("type") && params.get("type") == "myimage") {
this.activeName = "second"; this.activeName = "second";


+ 28
- 27
web_src/js/components/images/adminImages.vue View File

@@ -6,33 +6,33 @@
<div class="ui attached segment"> <div class="ui attached segment">
<div class="ui form ignore-dirty"> <div class="ui form ignore-dirty">
<div class="ui fluid action input"> <div class="ui fluid action input">
<input type="text" placeholder="搜镜像Tag/描述/标签..." v-model="search"
<input type="text" :placeholder="$i18n['cloudeBrainMirror']['placeholder']" v-model="search"
@keyup.enter="searchName()"> @keyup.enter="searchName()">
<button class="ui blue button" @click="searchName()">搜索</button>
<button class="ui blue button" @click="searchName()">{{$i18n['cloudeBrainMirror']['search']}}</button>
</div> </div>
</div> </div>
</div> </div>


<div class="ui ten wide column" style="margin: 1rem 0;"> <div class="ui ten wide column" style="margin: 1rem 0;">
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">仅显示平台推荐</el-checkbox>
<el-checkbox v-model="checked" style="padding: 0.5rem 1rem;">{{$i18n['cloudeBrainMirror']['platform_recommendations']}}</el-checkbox>
<el-dropdown @command="handleCommand" trigger="click" <el-dropdown @command="handleCommand" trigger="click"
style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;"> style="border: 1px solid rgba(34,36,38,.15);border-radius: 4px;padding: 0.5rem 1rem;">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
{{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i> {{dropdownPrivate}}<i class="el-icon-caret-bottom el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="{label:'全部',private:''}">全部</el-dropdown-item>
<el-dropdown-item :command="{label:'公开',private:false}">公开</el-dropdown-item>
<el-dropdown-item :command="{label:'私有',private:true}">私有</el-dropdown-item>
<el-dropdown-item :command="{label:$i18n['all'],private:''}">{{$i18n['all']}}</el-dropdown-item>
<el-dropdown-item :command="{label:$i18n['cloudeBrainMirror']['public'],private:false}">{{$i18n['cloudeBrainMirror']['public']}}</el-dropdown-item>
<el-dropdown-item :command="{label:$i18n['cloudeBrainMirror']['private'],private:true}">{{$i18n['cloudeBrainMirror']['private']}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
<div class="ui six wide column right aligned" style="margin: 1rem 0;"> <div class="ui six wide column right aligned" style="margin: 1rem 0;">
<a class="ui blue small button" href="/admin/images/commit_image">创建云脑镜像</a>
<a class="ui blue small button" href="/admin/images/commit_image">{{$i18n['cloudeBrainMirror']['create_cloud_brain_mirror']}}</a>
</div> </div>
<div class="ui sixteen wide column" style="padding: 0;overflow-x: auto;"> <div class="ui sixteen wide column" style="padding: 0;overflow-x: auto;">
<el-table :data="tableDataCustom" style="width: 100%;min-width:1700px;" :header-cell-style="tableHeaderStyle"> <el-table :data="tableDataCustom" style="width: 100%;min-width:1700px;" :header-cell-style="tableHeaderStyle">
<el-table-column label="镜像Tag" min-width="19%" align="left" prop="tag">
<el-table-column :label="$i18n['cloudeBrainMirror']['mirror_tag']" min-width="19%" align="left" prop="tag">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;align-items: center;"> <div style="display: flex;align-items: center;">
<a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a> <a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
@@ -42,7 +42,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="镜像描述" min-width="28%" align="left" prop="description">
<el-table-column :label="$i18n['cloudeBrainMirror']['mirror_description']" min-width="28%" align="left" prop="description">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}} <div class="image_desc" :title="scope.row.description">{{ scope.row.description}}
</div> </div>
@@ -53,18 +53,18 @@


</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="cloudbrainType" label="可用集群" min-width="10%" align="center">
<el-table-column prop="cloudbrainType" :label="$i18n['cloudeBrainMirror']['available_clusters']" min-width="10%" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.cloudbrainType | transformType}} {{scope.row.cloudbrainType | transformType}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="isPrivate" label="状态" min-width="8%" align="center">
<el-table-column prop="isPrivate" :label="$i18n['cloudeBrainMirror']['state']" min-width="8%" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">私有</span>
<span v-else style="color: rgb(19, 194, 141);">公开</span>
<span v-if="scope.row.isPrivate" style="color: rgb(250, 140, 22);">{{$i18n['cloudeBrainMirror']['private']}}</span>
<span v-else style="color: rgb(19, 194, 141);">{{$i18n['cloudeBrainMirror']['public']}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="creator" label="创建者" min-width="7%" align="center">
<el-table-column prop="creator" :label="$i18n['cloudeBrainMirror']['creator']" min-width="7%" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<a v-if="scope.row.userName||scope.row.relAvatarLink" <a v-if="scope.row.userName||scope.row.relAvatarLink"
:href="'/' + scope.row.userName" :title="scope.row.userName"> :href="'/' + scope.row.userName" :title="scope.row.userName">
@@ -75,12 +75,12 @@
</a> </a>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="updatedUnix" label="创建时间" align="center" min-width="13%">
<el-table-column prop="updatedUnix" :label="$i18n['cloudeBrainMirror']['creation_time']" align="center" min-width="13%">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.updatedUnix | transformTimestamp}} {{scope.row.updatedUnix | transformTimestamp}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" min-width="23%" label="操作">
<el-table-column align="center" min-width="23%" :label="$i18n['cloudeBrainMirror']['operation']">
<template slot-scope="scope"> <template slot-scope="scope">
<div style="display: flex;justify-content: flex-end;align-items: center;"> <div style="display: flex;justify-content: flex-end;align-items: center;">
<div <div
@@ -95,22 +95,22 @@
</div> </div>
<span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;" <span style="padding: 0 1rem;color: rgb(250, 140, 22);cursor:pointer;"
v-if="scope.row.type==5" v-if="scope.row.type==5"
@click="unSetRecommend(scope.$index,scope.row.id)">取消推荐</span>
@click="unSetRecommend(scope.$index,scope.row.id)">{{$i18n['cloudeBrainMirror']['cancel_recommendation']}}</span>
<span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;" <span style="padding: 0 1rem;color: rgb(19, 194, 141);cursor:pointer;"
v-if="scope.row.type!==5 && !scope.row.isPrivate" v-if="scope.row.type!==5 && !scope.row.isPrivate"
@click="setRecommend(scope.$index,scope.row.id)">设为推荐</span>
@click="setRecommend(scope.$index,scope.row.id)">{{$i18n['cloudeBrainMirror']['set_as_recommended']}}</span>
<span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" <span style="padding: 0 1rem;color:#0366d6;cursor:pointer;"
@click="copyUrl(scope.row.place)">复制地址</span>
@click="copyUrl(scope.row.place)">{{$i18n['cloudeBrainMirror']['copy_address']}}</span>
<div style="padding-left:1rem;cursor:pointer;"> <div style="padding-left:1rem;cursor:pointer;">
<el-dropdown size="medium"> <el-dropdown size="medium">
<span class="el-dropdown-link"> <span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right"></i>
{{$i18n['cloudeBrainMirror']['more']}}<i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="eidtImage(scope.row.id)">编辑
<el-dropdown-item @click.native="eidtImage(scope.row.id)">{{$i18n['cloudeBrainMirror']['edit']}}
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item style="color: red;" <el-dropdown-item style="color: red;"
@click.native="deleteImage(scope.row.id)">删除</el-dropdown-item>
@click.native="deleteImage(scope.row.id)">{{$i18n['cloudeBrainMirror']['delete']}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
@@ -205,9 +205,9 @@
}, },
onHidden: function () { onHidden: function () {
if (flag == false) { if (flag == false) {
$('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
$('.alert').html(_this.$i18n['canceled_operation']).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
} else { } else {
$('.alert').html('删除成功').removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
$('.alert').html(_this.$i18n['successfully_deleted']).removeClass('alert-danger').addClass('alert-success').show().delay(1500).fadeOut();
} }
} }
}) })
@@ -269,9 +269,9 @@
}, },
transformPravite(val) { transformPravite(val) {
if (val) { if (val) {
return "私有"
return this.$i18n['cloudeBrainMirror']['private'];
} else { } else {
return "公开"
return this.$i18n['cloudeBrainMirror']['public'];
} }
}, },
transformTimestamp(timestamp) { transformTimestamp(timestamp) {
@@ -298,7 +298,8 @@
this.getImageListCustom() this.getImageListCustom()
}, },
created() { created() {

this.$i18n = window.i18n;
this.dropdownPrivate = this.$i18n['all'];
} }


}; };


+ 11
- 206
web_src/js/features/cloudbrainShow.js View File

@@ -54,10 +54,10 @@ export default async function initCloudrainSow() {
if (max) { if (max) {
$("body").toast({ $("body").toast({
class: "black", class: "black",
message: `您已翻阅至日志底部,请稍后再试!`,
message: i18n.scrolled_logs_bottom_pls_retry,
}); });
} else { } else {
$(`.message${version_name} #header`).text("您已翻阅至日志底部");
$(`.message${version_name} #header`).text(i18n.scrolled_logs_bottom);
$(`.message${version_name}`).css("display", "block"); $(`.message${version_name}`).css("display", "block");
setTimeout(function () { setTimeout(function () {
$(`.message${version_name}`).css("display", "none"); $(`.message${version_name}`).css("display", "none");
@@ -101,10 +101,10 @@ export default async function initCloudrainSow() {
if (max) { if (max) {
$("body").toast({ $("body").toast({
class: "black", class: "black",
message: `您已翻阅至日志顶部,请稍后再试!`,
message: i18n.scrolled_logs_top_pls_retry,
}); });
} else { } else {
$(`.message${version_name} #header`).text("您已翻阅至日志顶部");
$(`.message${version_name} #header`).text(i18n.scrolled_logs_top);
$(`.message${version_name}`).css("display", "block"); $(`.message${version_name}`).css("display", "block");
setTimeout(function () { setTimeout(function () {
$(`.message${version_name}`).css("display", "none"); $(`.message${version_name}`).css("display", "none");
@@ -181,10 +181,10 @@ export default async function initCloudrainSow() {
if (max) { if (max) {
$("body").toast({ $("body").toast({
class: "black", class: "black",
message: `您已翻阅至日志顶部,请稍后再试!`,
message: i18n.scrolled_logs_top_pls_retry,
}); });
} else { } else {
$(`.message${version_name} #header`).text("您已翻阅至日志顶部");
$(`.message${version_name} #header`).text(i18n.scrolled_logs_top);
$(`.message${version_name}`).css("display", "block"); $(`.message${version_name}`).css("display", "block");
setTimeout(function () { setTimeout(function () {
$(`.message${version_name}`).css("display", "none"); $(`.message${version_name}`).css("display", "none");
@@ -202,10 +202,10 @@ export default async function initCloudrainSow() {
if (max) { if (max) {
$("body").toast({ $("body").toast({
class: "black", class: "black",
message: `您已翻阅至日志顶部,请稍后再试!`,
message: i18n.scrolled_logs_top_pls_retry,
}); });
} else { } else {
$(`.message${version_name} #header`).text("您已翻阅至日志顶部");
$(`.message${version_name} #header`).text(i18n.scrolled_logs_top);
$(`.message${version_name}`).css("display", "block"); $(`.message${version_name}`).css("display", "block");
setTimeout(function () { setTimeout(function () {
$(`.message${version_name}`).css("display", "none"); $(`.message${version_name}`).css("display", "none");
@@ -299,10 +299,10 @@ export default async function initCloudrainSow() {
if (max) { if (max) {
$("body").toast({ $("body").toast({
class: "black", class: "black",
message: `您已翻阅至日志底部,请稍后再试!`,
message: i18n.scrolled_logs_bottom_pls_retry,
}); });
} else { } else {
$(`.message${version_name} #header`).text("您已翻阅至日志底部");
$(`.message${version_name} #header`).text(i18n.scrolled_logs_bottom);
$(`.message${version_name}`).css("display", "block"); $(`.message${version_name}`).css("display", "block");
setTimeout(function () { setTimeout(function () {
$(`.message${version_name}`).css("display", "none"); $(`.message${version_name}`).css("display", "none");
@@ -544,6 +544,7 @@ export default async function initCloudrainSow() {
$.get(url, (data) => { $.get(url, (data) => {
if (data.StatusOK == 0) { // 成功 0 if (data.StatusOK == 0) { // 成功 0
if (data.Dirs) { if (data.Dirs) {
data.Dirs.length !==0 && $(`#${version_name}-result-down`).show()
renderDir(path, data, version_name, downloadFlag, gpuFlag); renderDir(path, data, version_name, downloadFlag, gpuFlag);
} }
if (init === "init") { if (init === "init") {
@@ -752,200 +753,4 @@ export default async function initCloudrainSow() {
html += "</div>"; html += "</div>";
$(`#dir_list${version_name}`).append(html); $(`#dir_list${version_name}`).append(html);
} }

let nameMap, nameList;
let RepoLink = $(".cloudbrain-type").data("repo-link");
let type = $(".cloudbrain-type").data("cloudbrain-type");
let flagModel = $(".cloudbrain-type").data("flag-model");
// 获取模型列表和模型名称对应的模型版本
$(document).ready(function () {
if (!flagModel) return;
else {
$.get(
`${RepoLink}/modelmanage/query_model_for_predict?type=${type}`,
(data) => {
nameMap = data.nameMap;
nameList = data.nameList;
let html = `<div class="item"></div>`;
nameList.forEach((element) => {
html += `<div class="item" data-value=${element}>${element}</div>`;
});
if (nameList.length !== 0) {
$("#model_name").append(html);
}
let faildModelName = $('input[name="model_name"]').val();
let faildModelVersion = $('input[name="model_version"]').val();
let dataID;

// 新建错误的表单返回初始化
if (faildModelName && nameList.includes(faildModelName)) {
$("#select_model").dropdown("set text", faildModelName);
$("#select_model").dropdown("set value", faildModelName);
nameMap[faildModelName].forEach((element) => {
if (element.Version === faildModelVersion) {
dataID = element.ID;
}
});
initModelVerison(faildModelName, nameMap, faildModelVersion);
initModelckpt(dataID);
}
}
);
}

$("#select_model").dropdown({
onChange: function (value, text, $selectedItem) {
$("#model_name_version").empty();
if (value) {
let html = "";
nameMap[value].forEach((element) => {
//let { trainTaskInfo } = element;
//trainTaskInfo = JSON.parse(trainTaskInfo);
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>`;
});
$("#model_name_version").append(html);
const initVersionText = $(
"#model_name_version div.item:first-child"
).text();
const initVersionValue = $(
"#model_name_version div.item:first-child"
).data("value");

$("#select_model_version").dropdown("set text", initVersionText);
$("#select_model_version").dropdown(
"set value",
initVersionValue,
initVersionText,
$("#model_name_version div.item:first-child")
);
} else {
$("#select_model_version").dropdown("set text", "");
$("#select_model_version").dropdown("set value", "");
$("#select_model_checkpoint").dropdown("set text", "");
$("#select_model_checkpoint").dropdown("set value", "");
$("#model_checkpoint").empty();
}
},
});

$("#select_model_version").dropdown({
onChange: function (value, text, $selectedItem) {
if (!value) return;
const dataID =
$selectedItem && $selectedItem[0].getAttribute("data-id");
$("input#ai_model_version").val(text);
$("#select_model_checkpoint").dropdown("set text", "");
$("#select_model_checkpoint").addClass("loading");

$("#model_checkpoint").empty();
let html = "";
loadCheckpointList(dataID).then((res) => {
res.forEach((element) => {
const ckptSuffix = element.FileName.split(".");
const loadCheckpointFile = [
"ckpt",
"pb",
"h5",
"json",
"pkl",
"pth",
"t7",
"pdparams",
"onnx",
"pbtxt",
"keras",
"mlmodel",
"cfg",
"pt",
];
if (
!element.IsDir &&
loadCheckpointFile.includes(ckptSuffix[ckptSuffix.length - 1])
) {
html += `<div class="item" data-value="${element.FileName}">${element.FileName}</div>`;
}
});
$("#model_checkpoint").append(html);
$("#select_model_checkpoint").removeClass("loading");
if (html) {
$("#select_model_checkpoint").removeClass("error");
}
const initVersionText = $(
"#model_checkpoint div.item:first-child"
).text();
const initVersionValue = $(
"#model_checkpoint div.item:first-child"
).data("value");

$("#select_model_checkpoint").dropdown("set text", initVersionText);
$("#select_model_checkpoint").dropdown(
"set value",
initVersionValue,
initVersionText,
$("#model_name_version div.item:first-child")
);
});
},
});
});
function initModelVerison(value, nameMap, faildModelVersion) {
let faildTrainUrl = $('input[name="pre_train_model_url"]').val();
let html = "";
nameMap[value].forEach((element) => {
let { TrainTaskInfo } = element;
TrainTaskInfo = JSON.parse(TrainTaskInfo);
html += `<div class="item" data-label="${element.Label}" data-id="${element.ID}" data-value="${element.Path}">${element.Version}</div>`;
});
$("#model_name_version").append(html);
$("#select_model_version").dropdown("set text", faildModelVersion);
$("#select_model_version").dropdown("set value", faildTrainUrl);
}
function initModelckpt(dataID) {
let faildCkptName = $('input[name="ckpt_name"]').val();
$("#select_model_checkpoint").addClass("loading");
$("#model_checkpoint").empty();
let html = "";
loadCheckpointList(dataID).then((res) => {
res.forEach((element) => {
const ckptSuffix = element.FileName.split(".");
const loadCheckpointFile = [
"ckpt",
"pb",
"h5",
"json",
"pkl",
"pth",
"t7",
"pdparams",
"onnx",
"pbtxt",
"keras",
"mlmodel",
"cfg",
"pt",
];
if (
!element.IsDir &&
loadCheckpointFile.includes(ckptSuffix[ckptSuffix.length - 1])
) {
html += `<div class="item" data-value=${element.FileName}>${element.FileName}</div>`;
}
});
$("#model_checkpoint").append(html);
$("#select_model_checkpoint").removeClass("loading");
$("#select_model_checkpoint").dropdown("set text", faildCkptName);
$("#select_model_checkpoint").dropdown("set value", faildCkptName);
});
}
function loadCheckpointList(value) {
return new Promise((resolve, reject) => {
$.get(
`${RepoLink}/modelmanage/query_modelfile_for_predict`,
{ id: value },
(data) => {
resolve(data);
}
);
});
}
} }

+ 4
- 41
web_src/js/features/cloudrbanin.js View File

@@ -58,8 +58,8 @@ export default async function initCloudrain() {
const duration = data.JobDuration; const duration = data.JobDuration;
const aiCenter = data.AiCenter || '--' const aiCenter = data.AiCenter || '--'
$("#duration-" + ID).text(duration); $("#duration-" + ID).text(duration);
$("#cluster-" + ID).text(aiCenter);
$("#" + versionname + "-ai_center").text(data.AiCenter);
data.AiCenter != undefined && $("#cluster-" + ID).text(aiCenter);
data.AiCenter != undefined && $("#" + versionname + "-ai_center").text(data.AiCenter);
if (status != status_text) { if (status != status_text) {
$("#" + ID + "-icon") $("#" + ID + "-icon")
.removeClass() .removeClass()
@@ -224,7 +224,7 @@ export default async function initCloudrain() {
data.StartTime !== undefined && data.StartTime > 0 && $("#" + versionname + "-startTime").text(timeFormat(new Date(data.StartTime * 1000))); data.StartTime !== undefined && data.StartTime > 0 && $("#" + versionname + "-startTime").text(timeFormat(new Date(data.StartTime * 1000)));
$("#" + versionname + "-duration").text(data.JobDuration); $("#" + versionname + "-duration").text(data.JobDuration);
$("#" + versionname + "-status").text(data.JobStatus); $("#" + versionname + "-status").text(data.JobStatus);
$("#" + versionname + "-ai_center").text(data.AiCenter);
data.AiCenter != undefined && $("#" + versionname + "-ai_center").text(data.AiCenter);


if (stopArray.includes(data.JobStatus)) { if (stopArray.includes(data.JobStatus)) {
$("#" + versionname + "-stop").addClass("disabled"); $("#" + versionname + "-stop").addClass("disabled");
@@ -267,7 +267,7 @@ export default async function initCloudrain() {
onHidden: function () { onHidden: function () {
if (flag == false) { if (flag == false) {
$(".alert") $(".alert")
.html("您已取消操作")
.html(i18n.canceled_operation)
.removeClass("alert-success") .removeClass("alert-success")
.addClass("alert-danger") .addClass("alert-danger")
.show() .show()
@@ -483,43 +483,6 @@ export default async function initCloudrain() {
const redirect_to = this.dataset.linkpath; const redirect_to = this.dataset.linkpath;
debugAgain(ID, repoPath, redirect_to); debugAgain(ID, repoPath, redirect_to);
}); });

function setWaitNums() {
if ($(".cloudbrain-type").length === 0 && $(".gpu-type").length === 0) {
return;
}
if (
$(".cloudbrain-type").length !== 0 &&
!$(".cloudbrain-type").data("queue")
) {
return;
}
let waitNums = $(".cloudbrain-type").data("queue").split("map")[1];
let test = new Map();
let waitNumsArray = waitNums.split(" ");
waitNumsArray.forEach((element, index) => {
if (index === 0) {
test.set(element.slice(1, -2), parseInt(element.slice(-1)));
} else if (index === waitNumsArray.length - 1) {
test.set(element.slice(0, -3), parseInt(element.slice(-2, -1)));
} else {
test.set(element.slice(0, -2), parseInt(element.slice(-1)));
}
});
$(".ui.search.dropdown.gpu-type").dropdown({
onChange: function (value, text, $selectedItem) {
let gpuTypeNums = test.get(value);
let gpuTypeNumString =
$(".cloudbrain-type").data("queue-start") +
" " +
gpuTypeNums +
" " +
$(".cloudbrain-type").data("queue-end");
$("#gpu-nums").text(gpuTypeNumString);
},
});
}
setWaitNums();
} }


function userSearchControll() { function userSearchControll() {


+ 108
- 0
web_src/js/features/i18nVue.js View File

@@ -74,6 +74,7 @@ export const i18nVue = {
dataset_search_placeholder: "搜数据集名称/描述...", dataset_search_placeholder: "搜数据集名称/描述...",
dataset_unziping: "正在解压缩", dataset_unziping: "正在解压缩",
dataset_unzip_failed: "解压失败", dataset_unzip_failed: "解压失败",
dataset_exceeds_failed: "数据集大小超过",
dataset_my_upload: "我上传的", dataset_my_upload: "我上传的",
dataset_current_repo: "本项目", dataset_current_repo: "本项目",
dataset_public: "公开数据集", dataset_public: "公开数据集",
@@ -115,6 +116,59 @@ export const i18nVue = {
modify:"修改", modify:"修改",
about:"约", about:"约",
count:"个", count:"个",
all:"全部",

introduction: '简介',
edit_repository_information: '编辑仓库信息',
please_enter_the_content: '请输入内容',
homePage: '主页',
cancel: '取消',
confirm: '确定',
contributors: '贡献者',
code: '代码',
searchOrCreateTopics: '搜索或创建标签',
clickOrEnterToAdd: '点击或回车添加',
topic: '标签',
topics: '标签',
noTopics: '暂无标签',
createTopicsTips: '标签名必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符',
canceled_operation: '您已取消操作',
successfully_deleted: '删除成功',

scrolled_logs_top: '您已翻阅至日志顶部',
scrolled_logs_top_pls_retry: '您已翻阅至日志顶部,请稍后再试!',
scrolled_logs_bottom: '您已翻阅至日志底部',
scrolled_logs_bottom_pls_retry: '您已翻阅至日志底部,请稍后再试!',

cloudeBrainMirror: {
cloud_brain_mirror: '云脑镜像',
public_mirror: '公开镜像',
platform_recommendations:'仅显示平台推荐',
placeholder: '搜镜像Tag/描述/标签...',
search:'搜索',
mirror_tag:'镜像Tag',
mirror_description:'镜像描述',
available_clusters: '可用集群',
creator: '创建者',
creation_time: '创建时间',
operation: '操作',
copy_address: '复制地址',
my_mirror: '我的镜像',
state: '状态',
private: '私有',
public: '公开',
mirror_committed: '镜像提交中...',
check_exceeds_20g:'检测提交镜像是否大小超过20G!',
mirror_submitted:'镜像提交成功',
edit: '编辑',
delete: '删除',
my_favorite_mirror: '我收藏的镜像',
more:'更多',
copy_succeeded: '复制成功!',
cancel_recommendation: '取消推荐',
set_as_recommended: '设为推荐',
create_cloud_brain_mirror: '创建云脑镜像',
},
}, },
US: { US: {
computer_vision: "computer vision", computer_vision: "computer vision",
@@ -195,6 +249,7 @@ export const i18nVue = {
dataset_search_placeholder: "Search dataset name/description ...", dataset_search_placeholder: "Search dataset name/description ...",
dataset_unziping: "Decompressing", dataset_unziping: "Decompressing",
dataset_unzip_failed: "Decompression failed", dataset_unzip_failed: "Decompression failed",
dataset_exceeds_failed: "Dataset size exceeds ",
dataset_my_upload: "Upload by me", dataset_my_upload: "Upload by me",
dataset_current_repo: "Current Repository", dataset_current_repo: "Current Repository",
dataset_public: "Public dataset", dataset_public: "Public dataset",
@@ -236,5 +291,58 @@ export const i18nVue = {
modify:"Modify", modify:"Modify",
about:"About", about:"About",
count:"", count:"",
all:"All",

introduction: 'Introduction',
edit_repository_information: 'Edit repository information',
please_enter_the_content: 'Please enter the content',
homePage: 'Home page',
cancel: 'Cancel',
confirm: 'Confirm',
contributors: 'Contributors',
code: 'Code',
searchOrCreateTopics: 'Search or create topics',
clickOrEnterToAdd: 'Click or enter to add',
topic: 'Topic',
topics: 'Topics',
noTopics: 'No topics',
createTopicsTips: 'The topic name must start with Chinese, letters or numbers, can contain hyphens (-), and cannot exceed 35 characters in length',
canceled_operation: 'You have canceled the operation',
successfully_deleted: 'Successfully deleted',

scrolled_logs_top: 'You have scrolled to the top of the log',
scrolled_logs_top_pls_retry: 'You have scrolled to the top of the log, please try again later!',
scrolled_logs_bottom: 'You have scrolled to the bottom of the log',
scrolled_logs_bottom_pls_retry: 'You have scrolled to the bottom of the log, please try again later!',

cloudeBrainMirror: {
cloud_brain_mirror: 'Cloud Brain Mirror',
public_mirror: 'Public Mirror',
platform_recommendations:'Show platform recommendations only',
placeholder: 'Search Mirror tag / description / tag ... ',
search:'Search',
mirror_tag:'Mirror Tag',
mirror_description:'mirror_description ',
available_clusters: 'Available clusters',
creator: 'Creator',
creation_time: 'Creation time',
operation: 'Operation',
copy_address: 'Copy address',
my_mirror: 'My Mirror',
state: 'State',
private: 'Private',
public: 'Public',
mirror_committed: 'Mirror Committed...',
check_exceeds_20g:'Check whether the size of the submitted image exceeds 20g!',
mirror_submitted:'Image submitted successfully',
edit: 'Edit',
delete: 'Delete',
my_favorite_mirror: 'My Favorite Mirror',
more:'More',
copy_succeeded: 'Copy succeeded!',
cancel_recommendation: 'Cancel recommendation',
set_as_recommended: 'Set as recommended',
create_cloud_brain_mirror: 'Create cloud brain mirror',
},
}, },
}; };

+ 245
- 1
web_src/js/standalone/cloudbrainNew.js View File

@@ -6,7 +6,7 @@
if (createFlag) return false; if (createFlag) return false;
createFlag = true; createFlag = true;
}; };
$("select.dropdown").dropdown();
// $("select.dropdown").dropdown();
$(document).keydown(function (event) { $(document).keydown(function (event) {
switch (event.keyCode) { switch (event.keyCode) {
case 13: case 13:
@@ -182,4 +182,248 @@
} }
validate(); validate();
}); });


//管理镜像相关的东西
let nameMap, nameList;
let RepoLink = $(".cloudbrain-type").data("repo-link");
let type = $(".cloudbrain-type").data("cloudbrain-type");
let flagModel = $(".cloudbrain-type").data("flag-model");
// 获取模型列表和模型名称对应的模型版本
$(document).ready(function () {
if (!flagModel) return;
else {
$.get(
`${RepoLink}/modelmanage/query_model_for_predict?type=${type}`,
(data) => {
nameMap = data.nameMap;
nameList = data.nameList;
let html = `<div class="item"></div>`;
nameList.forEach((element) => {
html += `<div class="item" data-value=${element}>${element}</div>`;
});
if (nameList.length !== 0) {
$("#model_name").append(html);
}
let faildModelName = $('input[name="model_name"]').val();
let faildModelVersion = $('input[name="model_version"]').val();
let dataID;
// 新建错误的表单返回初始化
if (faildModelName && nameList.includes(faildModelName)) {
$("#select_model").dropdown("set text", faildModelName);
$("#select_model").dropdown("set value", faildModelName);
nameMap[faildModelName].forEach((element) => {
if (element.version === faildModelVersion) {
dataID = element.id;
}
});
initModelVerison(faildModelName, nameMap, faildModelVersion);
initModelckpt(dataID);
}
}
);
}

$("#select_model").dropdown({
onChange: function (value, text, $selectedItem) {
$("#model_name_version").empty();
if (value) {
let html = "";
nameMap[value].forEach((element) => {
//let { trainTaskInfo } = element;
//trainTaskInfo = JSON.parse(trainTaskInfo);
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>`;
});
$("#model_name_version").append(html);
const initVersionText = $(
"#model_name_version div.item:first-child"
).text();
const initVersionValue = $(
"#model_name_version div.item:first-child"
).data("value");

$("#select_model_version").dropdown("set text", initVersionText);
$("#select_model_version").dropdown(
"set value",
initVersionValue,
initVersionText,
$("#model_name_version div.item:first-child")
);
} else {
$("#select_model_version").dropdown("set text", "");
$("#select_model_version").dropdown("set value", "");
$("#select_model_checkpoint").dropdown("set text", "");
$("#select_model_checkpoint").dropdown("set value", "");
$("#model_checkpoint").empty();
}
},
});

$("#select_model_version").dropdown({
onChange: function (value, text, $selectedItem) {
if (!value) return;
const dataID =
$selectedItem && $selectedItem[0].getAttribute("data-id");
$("input#ai_model_version").val(text);
$("#select_model_checkpoint").dropdown("set text", "");
$("#select_model_checkpoint").addClass("loading");

$("#model_checkpoint").empty();
let html = "";
loadCheckpointList(dataID).then((res) => {
res.forEach((element) => {
const ckptSuffix = element.FileName.split(".");
const loadCheckpointFile = [
"ckpt",
"pb",
"h5",
"json",
"pkl",
"pth",
"t7",
"pdparams",
"onnx",
"pbtxt",
"keras",
"mlmodel",
"cfg",
"pt",
];
if (
!element.IsDir &&
loadCheckpointFile.includes(ckptSuffix[ckptSuffix.length - 1])
) {
html += `<div class="item" data-value="${element.FileName}">${element.FileName}</div>`;
}
});
$("#model_checkpoint").append(html);
$("#select_model_checkpoint").removeClass("loading");
if (html) {
$("#select_model_checkpoint").removeClass("error");
}
const initVersionText = $(
"#model_checkpoint div.item:first-child"
).text();
const initVersionValue = $(
"#model_checkpoint div.item:first-child"
).data("value");

$("#select_model_checkpoint").dropdown("set text", initVersionText);
$("#select_model_checkpoint").dropdown(
"set value",
initVersionValue,
initVersionText,
$("#model_name_version div.item:first-child")
);
});
},
});
});
function initModelVerison(value, nameMap, faildModelVersion) {
let faildTrainUrl = $('input[name="pre_train_model_url"]').val();
let html = "";
nameMap[value].forEach((element) => {
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>`;
});
$("#model_name_version").append(html);
$("#select_model_version").dropdown("set text", faildModelVersion);
$("#select_model_version").dropdown("set value", faildTrainUrl);
}
function initModelckpt(dataID) {
let faildCkptName = $('input[name="ckpt_name"]').val();
$("#select_model_checkpoint").addClass("loading");
$("#model_checkpoint").empty();
let html = "";
loadCheckpointList(dataID).then((res) => {
res.forEach((element) => {
const ckptSuffix = element.FileName.split(".");
const loadCheckpointFile = [
"ckpt",
"pb",
"h5",
"json",
"pkl",
"pth",
"t7",
"pdparams",
"onnx",
"pbtxt",
"keras",
"mlmodel",
"cfg",
"pt",
];
if (
!element.IsDir &&
loadCheckpointFile.includes(ckptSuffix[ckptSuffix.length - 1])
) {
html += `<div class="item" data-value=${element.FileName}>${element.FileName}</div>`;
}
});
$("#model_checkpoint").append(html);
$("#select_model_checkpoint").removeClass("loading");
$("#select_model_checkpoint").dropdown("set text", faildCkptName);
$("#select_model_checkpoint").dropdown("set value", faildCkptName);
});
}
function loadCheckpointList(value) {
return new Promise((resolve, reject) => {
$.get(
`${RepoLink}/modelmanage/query_modelfile_for_predict`,
{ id: value },
(data) => {
resolve(data);
}
);
});
}
// 评测任务相关创建func
let repoLink = $(".cloudbrain-type").data("repo-link");
function setChildType(type_id=1) {
if (type_id == 3) {
$('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
$('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_MOT_benchmark');
} else {
$('#train_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
$('#test_href_id').attr('href', 'https://openi.pcl.ac.cn/CV_benchmark/CV_reID_benchmark');
}
let child_selected_id = $('#benchmark_child_types_id_hidden').val();
$.get(`${repoLink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => {
const n_length = data['child_types'].length
let html = ''
for (let i = 0; i < n_length; i++) {
if (child_selected_id == data['child_types'][i].id) {
html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`;
} else {
html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`;
}
}
let el = document.getElementById("benchmark_child_types_id");
el && (el.innerHTML = html);
})
}
$(document).ready(function () {
if ($('input[name=benchmarkMode]').val() === 'alogrithm' || $('input[name=benchmarkMode]').val() === '') {
setChildType();
}
$(".ui.selection.dropdown.benchmark_types_id").dropdown({
onChange:function (value, text, $selectedItem){
setChildType(value)
}
})
$('.ui.search.dropdown.job_type').dropdown({
onChange: function (value, text, $selectedItem) {
if (value === "BRAINSCORE") {
$('#brainscore_child_type').css('display', 'block')
$('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/similarity2brain_ann')
}else if(value === "SNN4ECOSET"){
$('#brainscore_child_type').css('display', 'none')
$('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/snn4ecoset')
}else {
$('#brainscore_child_type').css('display', 'none')
$('#benchmark_model_example').attr('href', 'https://openi.pcl.ac.cn/BDIP/snn4imagenet')
}
}
})
})
})(); })();

+ 3
- 1
web_src/less/openi.less View File

@@ -752,6 +752,8 @@ i.SUCCEEDED {
.disabled { .disabled {
cursor: pointer; cursor: pointer;
pointer-events: none; pointer-events: none;
opacity: .45!important;
color: rgba(0,0,0,.6);
} }
.left2 { .left2 {
margin-left: -2px !important; margin-left: -2px !important;
@@ -1453,7 +1455,7 @@ i.SUCCEEDED {
white-space: nowrap; white-space: nowrap;
} }
.text-span-new { .text-span-new {
width: 800px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
height: 20%; height: 20%;


+ 2
- 1
web_src/vuepages/pages/notebook/debug/index.vue View File

@@ -375,7 +375,7 @@ export default {
location.href=`${AppSubUrl}/authentication/wechat/bind` location.href=`${AppSubUrl}/authentication/wechat/bind`
} }
if(err.response.status===401){ if(err.response.status===401){
location.href=`${AppSubUrl}/user/login?redirect_to=${location.origin}${location.pathname}?type=login`
location.href=`${AppSubUrl}/user/login?redirect_to=${encodeURIComponent(location.origin+location.pathname + '?type=login&card='+ this.selectIndex)}`
return return
} }
this.btnStatus[index]=0 this.btnStatus[index]=0
@@ -445,6 +445,7 @@ export default {
if(new URLSearchParams(window.location.search).get("type")==='login'){ if(new URLSearchParams(window.location.search).get("type")==='login'){
that.getNotebookInfo() that.getNotebookInfo()
that.dialogVisible = true; that.dialogVisible = true;
that.selectIndex = Number(new URLSearchParams(window.location.search).get("card"))
} }
document document
.querySelector("#notebook-debug") .querySelector("#notebook-debug")


Loading…
Cancel
Save