From 434d29b8086531035e66564d267e995c3bfa7eac Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 22 Aug 2022 10:25:55 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4GPU=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=9A=84=E6=97=A5=E5=BF=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E3=80=82#2706?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/cloudbrain.go | 49 -------------------------------------- 1 file changed, 49 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 884aa326f..c3c6c43cb 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -2885,52 +2885,3 @@ func getFlavorNameByFlavorCode(flavorCode string) string { "核" + strconv.Itoa(cardNum*256) + "GB" return cloudbrainTwoFlavorName } - -func GetLogFromModelDir(ctx *context.Context) { - prefix := "/" + setting.CBCodePathPrefix + ctx.Cloudbrain.JobName + ModelMountPath - files, err := storage.GetOneLevelAllObjectUnderDirMinio(setting.Attachment.Minio.Bucket, prefix, "") - if err != nil { - log.Error("query cloudbrain model failed: %v", err) - return - } - startLine := ctx.QueryInt("startLine") - endLine := ctx.QueryInt("endLine") - - re := "" - for _, file := range files { - if strings.HasSuffix(file.FileName, "log.txt") { - path := storage.GetMinioPath(ctx.Cloudbrain.JobName+ModelMountPath+"/", file.FileName) - log.Info("path=" + path) - reader, err := os.Open(path) - defer reader.Close() - if err == nil { - r := bufio.NewReader(reader) - for i := 0; i < endLine; i++ { - line, error := r.ReadString('\n') - log.Info("line=" + line) - if error == io.EOF { - log.Info("read file completed.") - break - } - if error != nil { - log.Info("read file error." + error.Error()) - break - } - if error == nil { - if i >= startLine { - re = re + line - } - } - } - } else { - log.Info("error:" + err.Error()) - } - break - } - } - - ctx.JSON(http.StatusOK, map[string]interface{}{ - "JobName": ctx.Cloudbrain.JobName, - "Content": re, - }) -}