forked from JointCloud/pcm-coordinator
updated createdeploytask logic
This commit is contained in:
parent
bf513496e7
commit
125536012d
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue