|
|
@@ -725,6 +725,36 @@ func GrampusTrainJobShow(ctx *context.Context) { |
|
|
|
ctx.HTML(http.StatusOK, tplGrampusTrainJobShow) |
|
|
|
} |
|
|
|
|
|
|
|
func GrampusDownloadLog(ctx *context.Context) { |
|
|
|
jobID := ctx.Params(":jobid") |
|
|
|
job, err := models.GetCloudbrainByJobID(jobID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetCloudbrainByJobID failed: %v", err, ctx.Data["MsgID"]) |
|
|
|
ctx.ServerError(err.Error(), err) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
content, err := grampus.GetTrainJobLog(job.JobID) |
|
|
|
if err != nil { |
|
|
|
log.Error("GetTrainJobLog failed: %v", err, ctx.Data["MsgID"]) |
|
|
|
ctx.ServerError(err.Error(), err) |
|
|
|
return |
|
|
|
} |
|
|
|
fileName := job.JobName + "-log.txt" |
|
|
|
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+fileName) |
|
|
|
ctx.Resp.Header().Set("Content-Type", "application/octet-stream") |
|
|
|
var b []byte = []byte(content) |
|
|
|
|
|
|
|
ctx.Resp.Write(b) |
|
|
|
|
|
|
|
// ctx.JSON(http.StatusOK, map[string]interface{}{ |
|
|
|
// "JobName": job.JobName, |
|
|
|
// "Content": content, |
|
|
|
// }) |
|
|
|
|
|
|
|
//return |
|
|
|
} |
|
|
|
|
|
|
|
func GrampusGetLog(ctx *context.Context) { |
|
|
|
jobID := ctx.Params(":jobid") |
|
|
|
job, err := models.GetCloudbrainByJobID(jobID) |
|
|
|