|
|
@@ -1,13 +1,13 @@ |
|
|
|
package modelarts |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"encoding/json" |
|
|
|
"path" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
"code.gitea.io/gitea/modules/context" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/setting" |
|
|
|
"code.gitea.io/gitea/modules/storage" |
|
|
|
"encoding/json" |
|
|
|
"path" |
|
|
|
) |
|
|
|
|
|
|
|
const ( |
|
|
@@ -25,7 +25,27 @@ var ( |
|
|
|
) |
|
|
|
|
|
|
|
func GenerateTask(ctx *context.Context, jobName, uuid, description string) error { |
|
|
|
dataActualPath := setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" |
|
|
|
var dataActualPath string |
|
|
|
if uuid != "" { |
|
|
|
dataActualPath = setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" |
|
|
|
} else { |
|
|
|
userPath := setting.UserBasePath + ctx.User.Name + "/" |
|
|
|
isExist, err := storage.ObsHasObject(userPath) |
|
|
|
if err != nil { |
|
|
|
log.Error("ObsHasObject failed:%v", err.Error(), ctx.Data["MsgID"]) |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
if !isExist { |
|
|
|
if err = storage.ObsCreateObject(userPath); err != nil { |
|
|
|
log.Error("ObsCreateObject failed:%v", err.Error(), ctx.Data["MsgID"]) |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dataActualPath = setting.Bucket + "/" + userPath |
|
|
|
} |
|
|
|
|
|
|
|
if poolInfos == nil { |
|
|
|
json.Unmarshal([]byte(setting.PoolInfos), &poolInfos) |
|
|
|
} |
|
|
|