|
- package octopusHttp
-
- import (
- "context"
- "errors"
- "fmt"
- "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/inference"
- "mime/multipart"
- )
-
- const (
- RESOURCE_POOL = "common-pool"
- )
-
- const (
- NotImplementError = "not implemented"
- )
-
- const (
- MyAlgorithmListUrl = "/api/v1/algorithm/myAlgorithmList"
- ResourcespecsUrl = "/api/v1/resource/specs"
- )
-
- type OctopusHttp struct {
- host string
- platform string
- participantId int64
- token *Token
- }
-
- func NewOctopusHttp(name string, id int64, host string, user string, pwd string) *OctopusHttp {
- token, err := NewToken(host, user, pwd)
- if err != nil {
- fmt.Println(err.Error())
- }
- return &OctopusHttp{platform: name, participantId: id, host: host, token: token}
- }
-
- // executor
- func (o *OctopusHttp) Execute(ctx context.Context, option *option.AiOption, mode int) (interface{}, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) Stop(ctx context.Context, id string) error {
- //TODO implement me
- panic("implement me")
- }
-
- // collector
- func (o *OctopusHttp) GetResourceStats(ctx context.Context) (*collector.ResourceStats, error) {
- return nil, nil
- }
-
- func (o *OctopusHttp) GetDatasetsSpecs(ctx context.Context) ([]*collector.DatasetsSpecs, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) GetAlgorithms(ctx context.Context) ([]*collector.Algorithm, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) GetTrainingTaskLog(ctx context.Context, taskId string, instanceNum string) (string, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) GetTrainingTask(ctx context.Context, taskId string) (*collector.Task, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) DownloadAlgorithmCode(ctx context.Context, resourceType string, card string, taskType string, dataset string, algorithm string) (string, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) UploadAlgorithmCode(ctx context.Context, resourceType string, card string, taskType string, dataset string, algorithm string, code string) error {
- //TODO implement me
- panic("implement me")
- }
-
- func (o OctopusHttp) GetComputeCards(ctx context.Context) ([]string, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) GetUserBalance(ctx context.Context) (float64, error) {
- //TODO implement me
- panic("implement me")
- }
-
- func (o *OctopusHttp) GetResourceSpecs(ctx context.Context, resrcType string) (*collector.ResourceSpec, error) {
- //TODO implement me
- panic("implement me")
- }
-
- // inference
- func (o *OctopusHttp) GetClusterInferUrl(ctx context.Context, option *option.InferOption) (*inference.ClusterInferUrl, error) {
- return nil, errors.New(NotImplementError)
- }
-
- func (o *OctopusHttp) GetInferDeployInstanceList(ctx context.Context) ([]*inference.DeployInstance, error) {
- return nil, errors.New(NotImplementError)
- }
-
- func (o *OctopusHttp) StartInferDeployInstance(ctx context.Context, id string) bool {
- return false
- }
-
- func (o *OctopusHttp) StopInferDeployInstance(ctx context.Context, id string) bool {
- return false
- }
-
- func (o *OctopusHttp) GetInferDeployInstance(ctx context.Context, id string) (*inference.DeployInstance, error) {
- return nil, errors.New(NotImplementError)
- }
-
- func (o *OctopusHttp) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
- return "", errors.New(NotImplementError)
- }
-
- func (o *OctopusHttp) CheckModelExistence(ctx context.Context, modelName string, modelType string) bool {
- return false
- }
-
- func (o *OctopusHttp) GetImageInferResult(ctx context.Context, url string, file multipart.File, fileName string) (string, error) {
- return "", errors.New(NotImplementError)
- }
|