|
|
@@ -1588,17 +1588,17 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference |
|
|
|
|
|
|
|
ckptUrl := form.TrainUrl + form.CkptName |
|
|
|
|
|
|
|
count, err := models.GetCloudbrainTrainJobCountByUserID(ctx.User.ID) |
|
|
|
count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetCloudbrainTrainJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
log.Error("GetCloudbrainInferenceJobCountByUserID failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("system error", tplModelArtsInferenceJobNew, &form) |
|
|
|
return |
|
|
|
} else { |
|
|
|
if count >= 1 { |
|
|
|
log.Error("the user already has running or waiting task", ctx.Data["MsgID"]) |
|
|
|
log.Error("the user already has running or waiting inference task", ctx.Data["MsgID"]) |
|
|
|
inferenceJobErrorNewDataPrepare(ctx, form) |
|
|
|
ctx.RenderWithErr("you have already a running or waiting task, can not create more", tplModelArtsInferenceJobNew, &form) |
|
|
|
ctx.RenderWithErr("you have already a running or waiting inference task, can not create more", tplModelArtsInferenceJobNew, &form) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@@ -1786,7 +1786,7 @@ func inferenceJobNewDataPrepare(ctx *context.Context) error { |
|
|
|
ctx.Data["PageIsCloudBrain"] = true |
|
|
|
|
|
|
|
t := time.Now() |
|
|
|
var jobName = "inference" + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] |
|
|
|
var jobName = cutString(ctx.User.Name, 5) + t.Format("2006010215") + strconv.Itoa(int(t.Unix()))[5:] |
|
|
|
ctx.Data["job_name"] = jobName |
|
|
|
|
|
|
|
attachs, err := models.GetModelArtsTrainAttachments(ctx.User.ID) |
|
|
@@ -1946,6 +1946,7 @@ func InferenceJobShow(ctx *context.Context) { |
|
|
|
ctx.Data["jobID"] = jobID |
|
|
|
ctx.Data["jobName"] = task.JobName |
|
|
|
ctx.Data["task"] = task |
|
|
|
ctx.Data["userName"] = ctx.User.Name |
|
|
|
ctx.HTML(http.StatusOK, tplModelArtsInferenceJobShow) |
|
|
|
} |
|
|
|
|
|
|
@@ -2006,14 +2007,14 @@ func DownloadMultiResultFile(ctx *context.Context) { |
|
|
|
// } |
|
|
|
|
|
|
|
// path := Model_prefix + models.AttachmentRelativePath(id) + "/" |
|
|
|
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, "result/", versionName), "/") |
|
|
|
path := strings.TrimPrefix(path.Join(setting.TrainJobModelPath, task.JobName, "result/", versionName), "/") + "/" |
|
|
|
|
|
|
|
allFile, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, path) |
|
|
|
if err == nil { |
|
|
|
//count++ |
|
|
|
// models.ModifyModelDownloadCount(id) |
|
|
|
|
|
|
|
returnFileName := task.JobName + "_" + task.VersionName + ".zip" |
|
|
|
returnFileName := task.JobName + ".zip" |
|
|
|
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+returnFileName) |
|
|
|
ctx.Resp.Header().Set("Content-Type", "application/octet-stream") |
|
|
|
w := zip.NewWriter(ctx.Resp) |
|
|
|