Merge pull request 'added deployinstance apis' (#268) from tzwang/pcm-coordinator:master into master
Former-commit-id: 85c7246136d79a6662808268f7c5478bc1dcc704
This commit is contained in:
commit
68defdf78f
|
@ -76,4 +76,31 @@ type (
|
|||
|
||||
}
|
||||
|
||||
/******************Deploy instance*************************/
|
||||
DeployInstanceListReq{
|
||||
PageInfo
|
||||
}
|
||||
|
||||
DeployInstanceListResp {
|
||||
PageResult
|
||||
}
|
||||
|
||||
StartDeployInstanceReq {
|
||||
AdapterId string `form:"adapterId"`
|
||||
ClusterId string `form:"clusterId"`
|
||||
InstanceId string `form:"id"`
|
||||
}
|
||||
|
||||
StartDeployInstanceResp {
|
||||
}
|
||||
|
||||
StopDeployInstanceReq {
|
||||
AdapterId string `form:"adapterId"`
|
||||
ClusterId string `form:"clusterId"`
|
||||
InstanceId string `form:"id"`
|
||||
}
|
||||
|
||||
StopDeployInstanceResp {
|
||||
}
|
||||
|
||||
)
|
||||
|
|
|
@ -940,6 +940,15 @@ service pcm {
|
|||
|
||||
@handler InferenceTaskDetailHandler
|
||||
get /inference/taskDetail (InferenceTaskDetailReq) returns (InferenceTaskDetailResp)
|
||||
|
||||
@handler DeployInstanceListHandler
|
||||
get /inference/deployInstanceList (DeployInstanceListReq) returns (DeployInstanceListResp)
|
||||
|
||||
@handler StartDeployInstanceListHandler
|
||||
post /inference/startDeployInstance (StartDeployInstanceReq) returns (StartDeployInstanceResp)
|
||||
|
||||
@handler StopDeployInstanceHandler
|
||||
post /inference/stopDeployInstance (StopDeployInstanceReq) returns (StopDeployInstanceResp)
|
||||
}
|
||||
|
||||
@server(
|
||||
|
|
175
go.mod
175
go.mod
|
@ -1,175 +0,0 @@
|
|||
module gitlink.org.cn/JointCloud/pcm-coordinator
|
||||
|
||||
go 1.22.0
|
||||
|
||||
require (
|
||||
github.com/JCCE-nudt/apigw-go-sdk v0.0.0-20230525025609-34159d6f2818
|
||||
github.com/Masterminds/squirrel v1.5.4
|
||||
github.com/bwmarrin/snowflake v0.3.0
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/go-resty/resty/v2 v2.12.0
|
||||
github.com/jinzhu/copier v0.4.0
|
||||
github.com/json-iterator/go v1.1.12
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.2
|
||||
github.com/prometheus/alertmanager v0.27.0
|
||||
github.com/prometheus/client_golang v1.19.1
|
||||
github.com/prometheus/common v0.55.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/zeromicro/go-zero v1.6.6
|
||||
gitlink.org.cn/JointCloud/pcm-ac v0.0.0-20240722032933-7bd6ab00d249
|
||||
gitlink.org.cn/JointCloud/pcm-modelarts v0.0.0-20240722092017-50d17f36d023
|
||||
gitlink.org.cn/JointCloud/pcm-octopus v0.0.0-20240718073732-bc5d687f6330
|
||||
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/jcce-pcm/pcm-participant-ceph v0.0.0-20230904090036-24fc730ec87d
|
||||
go.opentelemetry.io/otel/trace v1.28.0
|
||||
gonum.org/v1/gonum v0.11.0
|
||||
google.golang.org/grpc v1.65.0
|
||||
gorm.io/datatypes v1.2.0
|
||||
gorm.io/driver/mysql v1.5.2
|
||||
gorm.io/gorm v1.25.5
|
||||
k8s.io/apimachinery v0.30.3
|
||||
k8s.io/client-go v0.30.3
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.1.0 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/alecthomas/kingpin/v2 v2.4.0 // indirect
|
||||
github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect
|
||||
github.com/armon/go-metrics v0.4.1 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aws/aws-sdk-go v1.50.8 // indirect
|
||||
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/distribution/reference v0.6.0 // indirect
|
||||
github.com/docker/distribution v2.8.3+incompatible // indirect
|
||||
github.com/docker/docker v27.1.0+incompatible // indirect
|
||||
github.com/docker/go-connections v0.5.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/analysis v0.22.2 // indirect
|
||||
github.com/go-openapi/errors v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/loads v0.21.5 // indirect
|
||||
github.com/go-openapi/runtime v0.27.1 // indirect
|
||||
github.com/go-openapi/spec v0.20.14 // indirect
|
||||
github.com/go-openapi/strfmt v0.22.0 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-openapi/validate v0.23.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/google/btree v1.0.1 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-msgpack v0.5.3 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
|
||||
github.com/hashicorp/golang-lru v0.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/hashicorp/memberlist v0.5.0 // indirect
|
||||
github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.106 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/jpillora/backoff v1.0.0 // indirect
|
||||
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
|
||||
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/miekg/dns v1.1.58 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/moby/docker-image-spec v1.3.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/openzipkin/zipkin-go v0.4.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common/sigv4 v0.1.0 // indirect
|
||||
github.com/prometheus/exporter-toolkit v0.11.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/redis/go-redis/v9 v9.6.0 // indirect
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect
|
||||
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.15 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.15 // indirect
|
||||
go.mongodb.org/mongo-driver v1.13.1 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/zipkin v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
go.uber.org/automaxprocs v1.5.3 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/crypto v0.25.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // indirect
|
||||
golang.org/x/mod v0.19.0 // indirect
|
||||
golang.org/x/net v0.27.0 // indirect
|
||||
golang.org/x/oauth2 v0.21.0 // indirect
|
||||
golang.org/x/sync v0.7.0 // indirect
|
||||
golang.org/x/sys v0.22.0 // indirect
|
||||
golang.org/x/term v0.22.0 // indirect
|
||||
golang.org/x/text v0.16.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.23.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240722135656-d784300faade // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240722135656-d784300faade // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.30.3 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20240709000822-3c01b740850f // indirect
|
||||
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
|
||||
)
|
|
@ -0,0 +1,28 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"jcc-coordinator/internal/logic/inference"
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func DeployInstanceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.DeployInstanceListReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := inference.NewDeployInstanceListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.DeployInstanceList(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"jcc-coordinator/internal/logic/inference"
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func StartDeployInstanceListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.StartDeployInstanceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := inference.NewStartDeployInstanceListLogic(r.Context(), svcCtx)
|
||||
resp, err := l.StartDeployInstanceList(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"jcc-coordinator/internal/logic/inference"
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
)
|
||||
|
||||
func StopDeployInstanceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.StopDeployInstanceReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := inference.NewStopDeployInstanceLogic(r.Context(), svcCtx)
|
||||
resp, err := l.StopDeployInstance(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,19 +4,19 @@ package handler
|
|||
import (
|
||||
"net/http"
|
||||
|
||||
adapters "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/adapters"
|
||||
ai "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/ai"
|
||||
cloud "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/cloud"
|
||||
core "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/core"
|
||||
dictionary "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/dictionary"
|
||||
hpc "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/hpc"
|
||||
inference "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/inference"
|
||||
monitoring "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/monitoring"
|
||||
schedule "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/schedule"
|
||||
storage "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/storage"
|
||||
storelink "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/storelink"
|
||||
vm "gitlink.org.cn/JointCloud/pcm-coordinator/internal/handler/vm"
|
||||
"gitlink.org.cn/JointCloud/pcm-coordinator/internal/svc"
|
||||
adapters "jcc-coordinator/internal/handler/adapters"
|
||||
ai "jcc-coordinator/internal/handler/ai"
|
||||
cloud "jcc-coordinator/internal/handler/cloud"
|
||||
core "jcc-coordinator/internal/handler/core"
|
||||
dictionary "jcc-coordinator/internal/handler/dictionary"
|
||||
hpc "jcc-coordinator/internal/handler/hpc"
|
||||
inference "jcc-coordinator/internal/handler/inference"
|
||||
monitoring "jcc-coordinator/internal/handler/monitoring"
|
||||
schedule "jcc-coordinator/internal/handler/schedule"
|
||||
storage "jcc-coordinator/internal/handler/storage"
|
||||
storelink "jcc-coordinator/internal/handler/storelink"
|
||||
vm "jcc-coordinator/internal/handler/vm"
|
||||
"jcc-coordinator/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
@ -1183,6 +1183,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||
Path: "/inference/taskDetail",
|
||||
Handler: inference.InferenceTaskDetailHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/inference/deployInstanceList",
|
||||
Handler: inference.DeployInstanceListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/inference/startDeployInstance",
|
||||
Handler: inference.StartDeployInstanceListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
Path: "/inference/stopDeployInstance",
|
||||
Handler: inference.StopDeployInstanceHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithPrefix("/pcm/v1"),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type DeployInstanceListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewDeployInstanceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeployInstanceListLogic {
|
||||
return &DeployInstanceListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *DeployInstanceListLogic) DeployInstanceList(req *types.DeployInstanceListReq) (resp *types.DeployInstanceListResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StartDeployInstanceListLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewStartDeployInstanceListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StartDeployInstanceListLogic {
|
||||
return &StartDeployInstanceListLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StartDeployInstanceListLogic) StartDeployInstanceList(req *types.StartDeployInstanceReq) (resp *types.StartDeployInstanceResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package inference
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"jcc-coordinator/internal/svc"
|
||||
"jcc-coordinator/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type StopDeployInstanceLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewStopDeployInstanceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StopDeployInstanceLogic {
|
||||
return &StopDeployInstanceLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *StopDeployInstanceLogic) StopDeployInstance(req *types.StopDeployInstanceReq) (resp *types.StopDeployInstanceResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
|
@ -372,3 +372,48 @@ func (s *AiStorage) AddNoticeInfo(adapterId string, adapterName string, clusterI
|
|||
logx.Errorf("Task creation failure, err: %v", result.Error)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *AiStorage) SaveInferDeployInstance() (int64, error) {
|
||||
startTime := time.Now().Format(time.RFC3339)
|
||||
// 构建主任务结构体
|
||||
insModel := models.AiInferDeployInstance{
|
||||
InstanceId: "",
|
||||
InstanceName: "",
|
||||
AdapterId: 123,
|
||||
AdapterName: "",
|
||||
ClusterId: 123,
|
||||
ClusterName: "",
|
||||
ModelName: "",
|
||||
ModelType: "",
|
||||
InferCard: "",
|
||||
Status: constants.Saved,
|
||||
CreateTime: startTime,
|
||||
UpdateTime: startTime,
|
||||
}
|
||||
// 保存任务数据到数据库
|
||||
tx := s.DbEngin.Table("ai_infer_deploy_instance").Create(&insModel)
|
||||
if tx.Error != nil {
|
||||
return 0, tx.Error
|
||||
}
|
||||
return insModel.Id, nil
|
||||
}
|
||||
|
||||
func (s *AiStorage) UpdateInferDeployInstance(instance *models.AiInferDeployInstance) error {
|
||||
instance.UpdateTime = time.Now().Format(time.RFC3339)
|
||||
tx := s.DbEngin.Table("ai_infer_deploy_instance").Updates(instance)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
return tx.Error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *AiStorage) GetInferDeployInstanceById(id int64) (*models.AiInferDeployInstance, error) {
|
||||
var deployIns models.AiInferDeployInstance
|
||||
tx := s.DbEngin.Raw("select * from ai_infer_deploy_instance where `id` = ?", id).Scan(&deployIns)
|
||||
if tx.Error != nil {
|
||||
logx.Errorf(tx.Error.Error())
|
||||
return nil, tx.Error
|
||||
}
|
||||
return &deployIns, nil
|
||||
}
|
||||
|
|
|
@ -5963,3 +5963,29 @@ type TextToTextInferenceReq struct {
|
|||
|
||||
type TextToTextInferenceResp struct {
|
||||
}
|
||||
|
||||
type DeployInstanceListReq struct {
|
||||
PageInfo
|
||||
}
|
||||
|
||||
type DeployInstanceListResp struct {
|
||||
PageResult
|
||||
}
|
||||
|
||||
type StartDeployInstanceReq struct {
|
||||
AdapterId string `form:"adapterId"`
|
||||
ClusterId string `form:"clusterId"`
|
||||
InstanceId string `form:"id"`
|
||||
}
|
||||
|
||||
type StartDeployInstanceResp struct {
|
||||
}
|
||||
|
||||
type StopDeployInstanceReq struct {
|
||||
AdapterId string `form:"adapterId"`
|
||||
ClusterId string `form:"clusterId"`
|
||||
InstanceId string `form:"id"`
|
||||
}
|
||||
|
||||
type StopDeployInstanceResp struct {
|
||||
}
|
||||
|
|
|
@ -36,18 +36,18 @@ type (
|
|||
|
||||
AiInferDeployInstance struct {
|
||||
Id int64 `db:"id"`
|
||||
InstanceId sql.NullString `db:"instance_id"`
|
||||
InstanceName sql.NullString `db:"instance_name"`
|
||||
AdapterId sql.NullInt64 `db:"adapter_id"`
|
||||
AdapterName sql.NullString `db:"adapter_name"`
|
||||
ClusterId sql.NullInt64 `db:"cluster_id"`
|
||||
ClusterName sql.NullString `db:"cluster_name"`
|
||||
ModelName sql.NullString `db:"model_name"`
|
||||
ModelType sql.NullString `db:"model_type"`
|
||||
InferCard sql.NullString `db:"infer_card"`
|
||||
Status sql.NullString `db:"status"`
|
||||
CreateTime sql.NullString `db:"create_time"`
|
||||
UpdateTime sql.NullString `db:"update_time"`
|
||||
InstanceId string `db:"instance_id"`
|
||||
InstanceName string `db:"instance_name"`
|
||||
AdapterId int64 `db:"adapter_id"`
|
||||
AdapterName string `db:"adapter_name"`
|
||||
ClusterId int64 `db:"cluster_id"`
|
||||
ClusterName string `db:"cluster_name"`
|
||||
ModelName string `db:"model_name"`
|
||||
ModelType string `db:"model_type"`
|
||||
InferCard string `db:"infer_card"`
|
||||
Status string `db:"status"`
|
||||
CreateTime string `db:"create_time"`
|
||||
UpdateTime string `db:"update_time"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue