| @@ -22,12 +22,14 @@ require ( | |||
| gitlink.org.cn/JointCloud/pcm-hpc v0.0.0-20241125115811-72f3568255a4 | |||
| gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20241211021152-9771ba5670b7 | |||
| gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240817071412-44397870b110 | |||
| gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20241217104229-e46c7e0c8e56 | |||
| gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20241230091026-2cbf3b839993 | |||
| gitlink.org.cn/JointCloud/pcm-openstack v0.0.0-20240403033338-e7edabad4203 | |||
| gitlink.org.cn/JointCloud/pcm-slurm v0.0.0-20240301080743-8b94bbaf57f5 | |||
| go.opentelemetry.io/otel/trace v1.32.0 | |||
| gonum.org/v1/gonum v0.11.0 | |||
| google.golang.org/grpc v1.68.1 | |||
| gopkg.in/yaml.v2 v2.4.0 | |||
| gopkg.in/yaml.v3 v3.0.1 | |||
| gorm.io/datatypes v1.2.0 | |||
| gorm.io/driver/mysql v1.5.7 | |||
| gorm.io/gorm v1.25.12 | |||
| @@ -183,8 +185,6 @@ require ( | |||
| google.golang.org/protobuf v1.35.2 // indirect | |||
| gopkg.in/inf.v0 v0.9.1 // indirect | |||
| gopkg.in/ini.v1 v1.67.0 // indirect | |||
| gopkg.in/yaml.v2 v2.4.0 // indirect | |||
| gopkg.in/yaml.v3 v3.0.1 // indirect | |||
| k8s.io/api v0.31.4 // indirect | |||
| k8s.io/klog/v2 v2.130.1 // indirect | |||
| k8s.io/kube-openapi v0.0.0-20241127205056-99599406b04f // indirect | |||
| @@ -532,8 +532,8 @@ gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20241211021152-9771ba5670b7 h1:sP | |||
| gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20241211021152-9771ba5670b7/go.mod h1:V19vFg8dWRAbaskASoSj70dgpacswOqZu/SaI02dxac= | |||
| 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-openi v0.0.0-20241217104229-e46c7e0c8e56 h1:zfE8/x16ZF4P2b8u24bHjH1ZBp/pA+4Zt4LKMasXlJs= | |||
| gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20241217104229-e46c7e0c8e56/go.mod h1:oDJrr/TNbUCaVjI+RaOrUtGawD7UPAvp7U/oVgT2Dhc= | |||
| gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20241230091026-2cbf3b839993 h1:u4fv0QNk/ubbkQTsijVUd6Zln7ESYrdXIHUL2Ydd5js= | |||
| gitlink.org.cn/JointCloud/pcm-openi v0.0.0-20241230091026-2cbf3b839993/go.mod h1:oDJrr/TNbUCaVjI+RaOrUtGawD7UPAvp7U/oVgT2Dhc= | |||
| 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-slurm v0.0.0-20240301080743-8b94bbaf57f5 h1:+/5vnzkJBfMRnya1NrhOzlroUtRa5ePiYbPKlHLoLV0= | |||
| @@ -7,6 +7,7 @@ import ( | |||
| "errors" | |||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/schedulers/option" | |||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/collector" | |||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/executor" | |||
| "gitlink.org.cn/JointCloud/pcm-coordinator/internal/scheduler/service/inference" | |||
| "gitlink.org.cn/JointCloud/pcm-openi/common" | |||
| "gitlink.org.cn/JointCloud/pcm-openi/model" | |||
| @@ -48,7 +49,55 @@ func NewOpenI(host string, id int64, name string, token string) *OpenI { | |||
| } | |||
| func (o OpenI) Execute(ctx context.Context, option *option.AiOption, mode int) (interface{}, error) { | |||
| return nil, errors.New("failed to implement") | |||
| switch mode { | |||
| case executor.SUBMIT_MODE_JOINT_CLOUD: | |||
| case executor.SUBMIT_MODE_STORAGE_SCHEDULE: | |||
| } | |||
| task, err := o.SubmitTask(ctx, option.ImageId, option.Cmd, option.Envs, option.Params, option.ResourceId, option.DatasetsId, option.AlgorithmId, option.TaskType) | |||
| if err != nil { | |||
| return nil, err | |||
| } | |||
| return task, nil | |||
| } | |||
| func (o *OpenI) SubmitTask(ctx context.Context, imageId string, cmd string, envs []string, params []string, resourceId string, datasetsId string, algorithmId string, aiType string) (interface{}, error) { | |||
| taskCreatelUrl := o.host + "/api/v1/task/create" | |||
| taskParam := &model.CreateTaskParam{} | |||
| param := model.CreateTaskReq{ | |||
| UserName: o.userName, | |||
| RepoName: algorithmId, | |||
| CreateTaskParam: taskParam, | |||
| } | |||
| b, _ := json.Marshal(param) | |||
| byt := bytes.NewBuffer(b) | |||
| resp := struct { | |||
| Code int `json:"code"` | |||
| Msg string `json:"msg"` | |||
| Data model.CreateTask `json:"data"` | |||
| }{} | |||
| req := common.GetRestyRequest(common.TIMEOUT) | |||
| r, _ := http.NewRequest("POST", taskCreatelUrl, byt) | |||
| req.RawRequest = r | |||
| req.URL = taskCreatelUrl | |||
| _, err := req. | |||
| SetHeader("Content-Type", "application/json"). | |||
| SetQueryParam(common.ACCESSTOKEN, o.accessToken). | |||
| SetBody(byt). | |||
| SetResult(&resp). | |||
| Send() | |||
| if err != nil { | |||
| } | |||
| return resp.Data, nil | |||
| } | |||
| func (o OpenI) GetClusterInferUrl(ctx context.Context, option *option.InferOption) (*inference.ClusterInferUrl, error) { | |||