|
|
|
@@ -302,34 +302,7 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
datasetDownload := make([]models.DatasetDownload, 0) |
|
|
|
if ctx.IsSigned { |
|
|
|
if task.Uuid != "" && task.UserID == ctx.User.ID { |
|
|
|
uuidList := strings.Split(task.Uuid, ";") |
|
|
|
for _, uuidStr := range uuidList { |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuidStr) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetAttachmentByUUID failed:%v", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
dataset, err := models.GetDatasetByID(attachment.DatasetID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetByID failed:%v", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
repo, err := models.GetRepositoryByID(dataset.RepoID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRepositoryByID failed:%v", err.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
datasetDownload = append(datasetDownload, models.DatasetDownload{ |
|
|
|
DatasetName: attachment.Name, |
|
|
|
DatasetDownloadLink: attachment.S3DownloadURL(), |
|
|
|
RepositoryLink: repo.Link() + "/datasets", |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
// datasetName, err := GetDatasetNameByUUID(task.Uuid) |
|
|
|
// if err == nil { |
|
|
|
// task.DatasetName = datasetName |
|
|
|
// } |
|
|
|
datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, true) |
|
|
|
} |
|
|
|
} |
|
|
|
user, err := models.GetUserByID(task.UserID) |
|
|
|
@@ -375,6 +348,39 @@ func NotebookShow(ctx *context.Context) { |
|
|
|
ctx.HTML(200, tplModelArtsNotebookShow) |
|
|
|
} |
|
|
|
|
|
|
|
func GetCloudBrainDataSetInfo(uuid string, isNeedDown bool) []models.DatasetDownload { |
|
|
|
datasetDownload := make([]models.DatasetDownload, 0) |
|
|
|
|
|
|
|
uuidList := strings.Split(uuid, ";") |
|
|
|
for _, uuidStr := range uuidList { |
|
|
|
attachment, err := models.GetAttachmentByUUID(uuidStr) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetAttachmentByUUID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
dataset, err := models.GetDatasetByID(attachment.DatasetID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetDatasetByID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
repo, err := models.GetRepositoryByID(dataset.RepoID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetRepositoryByID failed:%v", err.Error()) |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
url := "" |
|
|
|
if isNeedDown { |
|
|
|
url = attachment.S3DownloadURL() |
|
|
|
} |
|
|
|
datasetDownload = append(datasetDownload, models.DatasetDownload{ |
|
|
|
DatasetName: attachment.Name, |
|
|
|
DatasetDownloadLink: url, |
|
|
|
RepositoryLink: repo.Link() + "/datasets", |
|
|
|
}) |
|
|
|
} |
|
|
|
return datasetDownload |
|
|
|
} |
|
|
|
|
|
|
|
func setShowSpecBySpecialPoolConfig(ctx *context.Context, findSpec bool, task *models.Cloudbrain) { |
|
|
|
modelarts.InitSpecialPool() |
|
|
|
if modelarts.SpecialPools != nil && !findSpec { |
|
|
|
@@ -1758,7 +1764,7 @@ func TrainJobShow(ctx *context.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
ctx.Data["canNewJob"] = canNewJob |
|
|
|
|
|
|
|
datasetList := make([][]models.DatasetDownload, 0) |
|
|
|
//将运行参数转化为epoch_size = 3, device_target = Ascend的格式 |
|
|
|
for i, task := range VersionListTasks { |
|
|
|
|
|
|
|
@@ -1781,7 +1787,7 @@ func TrainJobShow(ctx *context.Context) { |
|
|
|
} else { |
|
|
|
VersionListTasks[i].Parameters = "" |
|
|
|
} |
|
|
|
|
|
|
|
datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) |
|
|
|
VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) |
|
|
|
VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) |
|
|
|
} |
|
|
|
@@ -1793,6 +1799,7 @@ func TrainJobShow(ctx *context.Context) { |
|
|
|
ctx.Data["displayJobName"] = VersionListTasks[0].DisplayJobName |
|
|
|
ctx.Data["version_list_task"] = VersionListTasks |
|
|
|
ctx.Data["version_list_count"] = VersionListCount |
|
|
|
ctx.Data["datasetList"] = datasetList |
|
|
|
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, &VersionListTasks[0].Cloudbrain) |
|
|
|
ctx.HTML(http.StatusOK, tplModelArtsTrainJobShow) |
|
|
|
} |
|
|
|
@@ -2515,7 +2522,7 @@ func InferenceJobShow(ctx *context.Context) { |
|
|
|
ctx.Data["displayJobName"] = task.DisplayJobName |
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) |
|
|
|
|
|
|
|
ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) |
|
|
|
tempUids := []int64{} |
|
|
|
tempUids = append(tempUids, task.UserID) |
|
|
|
JobCreater, err := models.GetUserNamesByIDs(tempUids) |
|
|
|
|