|
|
|
@@ -198,6 +198,8 @@ func (i *ImageInference) filterClusters() ([]*FilteredCluster, error) { |
|
|
|
for _, cluster := range i.clusters { |
|
|
|
var inferurls []*inference.InferUrl |
|
|
|
var clustertype string |
|
|
|
var clusterName string |
|
|
|
|
|
|
|
for _, instance := range i.instances { |
|
|
|
clusterId := strconv.FormatInt(instance.ClusterId, 10) |
|
|
|
adapterId := strconv.FormatInt(instance.AdapterId, 10) |
|
|
|
@@ -214,6 +216,7 @@ func (i *ImageInference) filterClusters() ([]*FilteredCluster, error) { |
|
|
|
inferurls = append(inferurls, &url) |
|
|
|
|
|
|
|
clustertype = deployInstance.ClusterType |
|
|
|
clusterName = deployInstance.ClusterName |
|
|
|
} |
|
|
|
} |
|
|
|
if len(inferurls) == 0 { |
|
|
|
@@ -224,7 +227,8 @@ func (i *ImageInference) filterClusters() ([]*FilteredCluster, error) { |
|
|
|
|
|
|
|
var f FilteredCluster |
|
|
|
f.urls = inferurls |
|
|
|
f.clusterName = cluster.ClusterName |
|
|
|
f.clusterId = cluster.ClusterId |
|
|
|
f.clusterName = clusterName |
|
|
|
f.clusterType = clustertype |
|
|
|
f.imageNum = cluster.Replicas |
|
|
|
cs = append(cs, &f) |
|
|
|
@@ -448,12 +452,19 @@ func (i *ImageInference) saveAiSubTasks(id int64, aiTaskList []*models.TaskAi, c |
|
|
|
} |
|
|
|
|
|
|
|
func getInferResult(url string, file multipart.File, fileName string, clusterId string, clusterType string, inferAdapter map[string]map[string]inference.ICluster, adapterId string) (string, error) { |
|
|
|
inferMap := inferAdapter[adapterId] |
|
|
|
adapter, found := inferAdapter[adapterId] |
|
|
|
if !found { |
|
|
|
return "", errors.New("adapterId not found") |
|
|
|
} |
|
|
|
iCluster, found := adapter[clusterId] |
|
|
|
if !found { |
|
|
|
return "", errors.New("clusterId not found") |
|
|
|
} |
|
|
|
|
|
|
|
switch clusterType { |
|
|
|
case storeLink.TYPE_OCTOPUS: |
|
|
|
r := http.Request{} |
|
|
|
result, err := inferMap[clusterId].GetInferResult(r.Context(), url, file, fileName) |
|
|
|
result, err := iCluster.GetInferResult(r.Context(), url, file, fileName) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
|