Browse Source

Merge branch 'V20220616' of git.openi.org.cn:OpenI/aiforge into grampus

tags/v1.22.6.2
lewis 3 years ago
parent
commit
fed1c66808
3 changed files with 18 additions and 7 deletions
  1. +8
    -0
      routers/repo/ai_model_manage.go
  2. +10
    -6
      routers/repo/dataset.go
  3. +0
    -1
      templates/repo/modelmanage/showinfo.tmpl

+ 8
- 0
routers/repo/ai_model_manage.go View File

@@ -66,6 +66,14 @@ func saveModelByParameters(jobId string, versionName string, name string, versio
return err
}
} else if cloudType == models.TypeCloudBrainOne {
var ResourceSpecs *models.ResourceSpecs
json.Unmarshal([]byte(setting.ResourceSpecs), &ResourceSpecs)
for _, tmp := range ResourceSpecs.ResourceSpec {
if tmp.Id == aiTask.ResourceSpecId {
flaverName := ctx.Tr("cloudbrain.gpu_num") + ": " + fmt.Sprint(tmp.GpuNum) + " " + ctx.Tr("cloudbrain.cpu_num") + ": " + fmt.Sprint(tmp.CpuNum) + " " + ctx.Tr("cloudbrain.memory") + "(MB): " + fmt.Sprint(tmp.MemMiB) + " " + ctx.Tr("cloudbrain.shared_memory") + "(MB): " + fmt.Sprint(tmp.ShareMemMiB)
aiTask.FlavorName = flaverName
}
}
modelPath, modelSize, err = downloadModelFromCloudBrainOne(id, aiTask.JobName, "", aiTask.TrainUrl)
if err != nil {
log.Info("download model from CloudBrainOne faild." + err.Error())


+ 10
- 6
routers/repo/dataset.go View File

@@ -522,7 +522,6 @@ func MyFavoriteDataset(ctx *context.Context) {
}
datasets := IsColDatasets
count := NotColcount + IsColcount
//排序
sort.Slice(datasets, func(i, j int) bool {
return datasets[i].Attachment.CreatedUnix > datasets[j].Attachment.CreatedUnix
})
@@ -613,23 +612,28 @@ func GetDatasetStatus(ctx *context.Context) {
func DatasetIsCollaborator(ctx *context.Context, DatasetID int64) bool {
dataset, err := models.GetDatasetByID(DatasetID)
if err != nil {
log.Info("query dataset error")
log.Error("query dataset error:", err.Error())
return false
} else {
repo, err := models.GetRepositoryByID(dataset.RepoID)
if err != nil {
log.Info("query repo error.")
log.Error("query repo error:", err.Error())
} else {
repo.GetOwner()
if ctx.User != nil {
if repo.Owner.IsOrganization() {
if repo.Owner.IsUserPartOfOrg(ctx.User.ID) {
log.Info("org user may visit the attach.")
return true
for _, t := range repo.Owner.Teams {
if t.IsMember(ctx.User.ID) && t.HasRepository(repo.ID) {
return true
}
}
return false
}
}

isCollaborator, _ := repo.IsCollaborator(ctx.User.ID)
if isCollaborator {
log.Info("Collaborator user may visit the attach.")
return true
}
}


+ 0
- 1
templates/repo/modelmanage/showinfo.tmpl View File

@@ -191,7 +191,6 @@
</div>
</div>
</div>
</div>
</div>


Loading…
Cancel
Save