| @@ -20,7 +20,7 @@ require ( | |||||
| github.com/zeromicro/go-zero v1.6.6 | github.com/zeromicro/go-zero v1.6.6 | ||||
| gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1 | gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1 | ||||
| gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c | gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c | ||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240815070729-eeab0822f4fe | |||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 | |||||
| gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 | gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 | ||||
| gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 | gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 | ||||
| gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d | gitlink.org.cn/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d | ||||
| @@ -475,8 +475,8 @@ gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1 h1:DicBXoQiC | |||||
| gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY= | gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240725071305-f751eec4dde1/go.mod h1:3eECiw9O2bIFkkePlloKyLNXiqBAhOxNrDoGaaGseGY= | ||||
| gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c h1:CodJeGgTYJwA6NDHFnw6B+4pBXUl79tvAcECq39tgZI= | gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c h1:CodJeGgTYJwA6NDHFnw6B+4pBXUl79tvAcECq39tgZI= | ||||
| gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c/go.mod h1:/eOmBFZKWGoabG3sRVkVvIbLwsd2631k4jkUBR6x1AA= | gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240724095608-1727d09f030c/go.mod h1:/eOmBFZKWGoabG3sRVkVvIbLwsd2631k4jkUBR6x1AA= | ||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240815070729-eeab0822f4fe h1:4zBOROvGGzmS1p/cuCVKE0d2tIqhkHNzpSspizZ4G2Y= | |||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240815070729-eeab0822f4fe/go.mod h1:QOD5+/l2D+AYBjF2h5T0mdJyfGAmF78QmeKdbBXbjLQ= | |||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 h1:GaXwr5sgDh0raHjUf9IewTvnRvajYea7zbLsaerYyXo= | |||||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110/go.mod h1:QOD5+/l2D+AYBjF2h5T0mdJyfGAmF78QmeKdbBXbjLQ= | |||||
| gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6PsZ1+bev294IWdZRlV7mnOwI1+UzFcldVW/BqhQzI= | gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 h1:s6PsZ1+bev294IWdZRlV7mnOwI1+UzFcldVW/BqhQzI= | ||||
| gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8= | gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203/go.mod h1:i2rrbMQ+Fve345BY9Heh4MUqVTAimZQElQhzzRee5B8= | ||||
| gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0= | gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0= | ||||
| @@ -2,8 +2,6 @@ package ai | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "errors" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | ||||
| @@ -37,10 +35,6 @@ func (l *TrainingTaskStatLogic) TrainingTaskStat() (resp *types.TrainingTaskStat | |||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if total == 0 { | |||||
| return nil, errors.New("get statistics failed") | |||||
| } | |||||
| resp.Total = total | resp.Total = total | ||||
| resp.Running = running | resp.Running = running | ||||
| return resp, nil | return resp, nil | ||||
| @@ -2,8 +2,6 @@ package inference | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "errors" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | ||||
| @@ -37,10 +35,6 @@ func (l *DeployInstanceStatLogic) DeployInstanceStat(req *types.DeployInstanceSt | |||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if total == 0 { | |||||
| return nil, errors.New("get statistics failed") | |||||
| } | |||||
| resp.Total = total | resp.Total = total | ||||
| resp.Running = running | resp.Running = running | ||||
| return resp, nil | return resp, nil | ||||
| @@ -2,8 +2,6 @@ package inference | |||||
| import ( | import ( | ||||
| "context" | "context" | ||||
| "errors" | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/types" | ||||
| @@ -37,10 +35,6 @@ func (l *InferenceTaskStatLogic) InferenceTaskStat(req *types.InferenceTaskStatR | |||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if total == 0 { | |||||
| return nil, errors.New("get statistics failed") | |||||
| } | |||||
| resp.Total = total | resp.Total = total | ||||
| resp.Running = running | resp.Running = running | ||||
| return resp, nil | return resp, nil | ||||
| @@ -15,6 +15,7 @@ | |||||
| package storeLink | package storeLink | ||||
| import ( | import ( | ||||
| "bufio" | |||||
| "context" | "context" | ||||
| "errors" | "errors" | ||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option" | "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option" | ||||
| @@ -24,8 +25,7 @@ import ( | |||||
| "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" | "gitlink.org.cn/JointCloud/pcm-coordinator/pkg/utils" | ||||
| "gitlink.org.cn/JointCloud/pcm-octopus/octopus" | "gitlink.org.cn/JointCloud/pcm-octopus/octopus" | ||||
| "gitlink.org.cn/JointCloud/pcm-octopus/octopusclient" | "gitlink.org.cn/JointCloud/pcm-octopus/octopusclient" | ||||
| "io/ioutil" | |||||
| "log" | |||||
| "io" | |||||
| "math" | "math" | ||||
| "mime/multipart" | "mime/multipart" | ||||
| "strconv" | "strconv" | ||||
| @@ -990,24 +990,33 @@ func (o *OctopusLink) GetInferDeployInstance(ctx context.Context, id string) (*i | |||||
| } | } | ||||
| func (o *OctopusLink) GetInferResult(ctx context.Context, url string, file multipart.File, fileName string) (string, error) { | func (o *OctopusLink) GetInferResult(ctx context.Context, url string, file multipart.File, fileName string) (string, error) { | ||||
| buf, err := ioutil.ReadAll(file) | |||||
| stream, err := o.octopusRpc.GetInferResult(ctx) | |||||
| if err != nil { | if err != nil { | ||||
| log.Fatal(err) | |||||
| return "", err | |||||
| } | } | ||||
| req := &octopus.InferResultReq{ | |||||
| Platform: o.platform, | |||||
| InferUrl: url, | |||||
| FileName: fileName, | |||||
| FileBytes: buf, | |||||
| buffer := make([]byte, 2048) | |||||
| bufferedReader := bufio.NewReader(file) | |||||
| for { | |||||
| _, err = bufferedReader.Read(buffer) | |||||
| if err != nil { | |||||
| if err != io.EOF { | |||||
| return "", err | |||||
| } | |||||
| break | |||||
| } | |||||
| err = stream.Send(&octopus.InferResultReq{ | |||||
| Platform: o.platform, | |||||
| InferUrl: url, | |||||
| FileName: fileName, | |||||
| FileBytes: buffer, | |||||
| }) | |||||
| } | } | ||||
| result, err := o.octopusRpc.GetInferResult(ctx, req) | |||||
| recv, err := stream.CloseAndRecv() | |||||
| if err != nil { | if err != nil { | ||||
| return "", err | return "", err | ||||
| } | } | ||||
| if result.Result == "" { | |||||
| return "", errors.New("get result failed") | |||||
| } | |||||
| return result.Result, nil | |||||
| return recv.Result, nil | |||||
| } | } | ||||