| @@ -57,7 +57,7 @@ func (l *CreateInferenceTaskLogic) CreateInferenceTask(req *types.CreateInferenc | |||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| assignedClusters := task.CopyParams(clusters, req.JobResources.Clusters) | |||||
| assignedClusters := task.CopyParams(clusters, req.JobResources.Clusters, "inference") | |||||
| opt := &option.InferOption{ | opt := &option.InferOption{ | ||||
| TaskName: taskName, | TaskName: taskName, | ||||
| @@ -158,7 +158,7 @@ func updateInferOption(cluster *strategy.AssignedCluster, opt *option.InferOptio | |||||
| opt.ImageId = cluster.ImageId | opt.ImageId = cluster.ImageId | ||||
| opt.AlgorithmId = cluster.CodeId | opt.AlgorithmId = cluster.CodeId | ||||
| opt.ModelId = cluster.ModelId | |||||
| opt.ModelID = cluster.ModelId | |||||
| opt.ResourcesRequired = cluster.ResourcesRequired | opt.ResourcesRequired = cluster.ResourcesRequired | ||||
| @@ -162,7 +162,7 @@ func (l *ScheduleCreateTaskLogic) ScheduleCreateTask(req *types.CreateTaskReq) ( | |||||
| assignedClusters := task.CopyParams([]*strategy.AssignedCluster{{ | assignedClusters := task.CopyParams([]*strategy.AssignedCluster{{ | ||||
| ClusterId: req.JobResources.Clusters[0].ClusterID, Replicas: 1, | ClusterId: req.JobResources.Clusters[0].ClusterID, Replicas: 1, | ||||
| }}, req.JobResources.Clusters) | |||||
| }}, req.JobResources.Clusters, "") | |||||
| // filter data distribution | // filter data distribution | ||||
| clustersWithDataDistributes := generateFilteredDataDistributes(assignedClusters, req.DataDistributes) | clustersWithDataDistributes := generateFilteredDataDistributes(assignedClusters, req.DataDistributes) | ||||
| @@ -244,14 +244,14 @@ func (l *ScheduleCreateTaskLogic) getAssignedClustersByStrategy(resources *types | |||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| assignedClusters = task.CopyParams(clusters, resources.Clusters) | |||||
| assignedClusters = task.CopyParams(clusters, resources.Clusters, "") | |||||
| case strategy.DATA_LOCALITY: | case strategy.DATA_LOCALITY: | ||||
| strtg := strategy.NewDataLocality(TRAINNING_TASK_REPLICA, dataDistribute) | strtg := strategy.NewDataLocality(TRAINNING_TASK_REPLICA, dataDistribute) | ||||
| clusters, err := strtg.Schedule() | clusters, err := strtg.Schedule() | ||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| assignedClusters = task.CopyParams(clusters, resources.Clusters) | |||||
| assignedClusters = task.CopyParams(clusters, resources.Clusters, "") | |||||
| default: | default: | ||||
| return nil, errors.New("no strategy has been chosen") | return nil, errors.New("no strategy has been chosen") | ||||
| } | } | ||||
| @@ -19,6 +19,7 @@ type InferOption struct { | |||||
| ResourceId string | ResourceId string | ||||
| AlgorithmId string | AlgorithmId string | ||||
| ImageId string | ImageId string | ||||
| ModelID string | |||||
| Output string | Output string | ||||
| @@ -34,7 +34,7 @@ func ValidateJobResources(resources types.JobResources, taskType string) error { | |||||
| return nil | return nil | ||||
| } | } | ||||
| func CopyParams(clusters []*strategy.AssignedCluster, clusterInfos []*types.JobClusterInfo) []*strategy.AssignedCluster { | |||||
| func CopyParams(clusters []*strategy.AssignedCluster, clusterInfos []*types.JobClusterInfo, taskType string) []*strategy.AssignedCluster { | |||||
| var result []*strategy.AssignedCluster | var result []*strategy.AssignedCluster | ||||
| for _, c := range clusters { | for _, c := range clusters { | ||||
| @@ -69,5 +69,19 @@ func CopyParams(clusters []*strategy.AssignedCluster, clusterInfos []*types.JobC | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if taskType == "inference" { | |||||
| for _, c := range clusters { | |||||
| for _, r := range result { | |||||
| if c.ClusterId == r.ClusterId { | |||||
| r.ModelId = c.ModelId | |||||
| r.ModelName = c.ModelName | |||||
| r.ImageId = c.ImageId | |||||
| r.CodeId = c.CodeId | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| return result | return result | ||||
| } | } | ||||