Compare commits

...

2 Commits

4 changed files with 13 additions and 5 deletions

View File

@ -47,7 +47,7 @@ func (l *CreateDeployTaskLogic) CreateDeployTask(req *types.CreateDeployTaskReq)
return nil, err
}
if duplicated {
return nil, errors.New("TaskName doesn't exist")
return nil, errors.New("TaskName already exists")
}
taskId, err := l.svcCtx.Scheduler.AiStorages.SaveInferDeployTask(req.TaskName, req.ModelName, req.ModelType, req.TaskDesc)

View File

@ -1238,7 +1238,7 @@ func (o *OctopusLink) CreateInferDeployInstance(ctx context.Context, option *opt
desc := option.ModelType + FORWARD_SLASH + option.ModelName + FORWARD_SLASH + strings.ToLower(BIV100)
param := &octopus.CreateNotebookParam{
Name: option.TaskName,
Name: DEPLOY_INSTANCE_PREFIEX + DASH + utils.TimeString(),
ResourcePool: RESOURCE_POOL,
ResourceSpecId: option.ResourceId,
AlgorithmId: option.AlgorithmId,

View File

@ -929,7 +929,7 @@ func (s *ShuguangAi) CreateInferDeployInstance(ctx context.Context, option *opti
}
desc := option.ModelType + FORWARD_SLASH + option.ModelName + FORWARD_SLASH + strings.ToLower(DCU)
instanceServiceName := "infer_instance" + UNDERSCORE + utils.RandomString(15)
instanceServiceName := "infer_instance" + UNDERSCORE + utils.TimeString()
resourceGroup := "kshdtest"
script, ok := ModelNameCmdMap[option.ModelName]

View File

@ -17,15 +17,23 @@ package utils
import (
"math/rand"
"strings"
"time"
)
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
const (
CHARSET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
TIMEFORMAT = "20060102150405"
)
func RandomString(n int) string {
sb := strings.Builder{}
sb.Grow(n)
for i := 0; i < n; i++ {
sb.WriteByte(charset[rand.Intn(len(charset))])
sb.WriteByte(CHARSET[rand.Intn(len(CHARSET))])
}
return sb.String()
}
func TimeString() string {
return time.Now().Format(TIMEFORMAT)
}