fit:modelarts

This commit is contained in:
qiwang 2023-02-24 10:46:06 +08:00
parent e7d097f08f
commit 8f468845a9
10 changed files with 1037 additions and 7 deletions

View File

@ -0,0 +1,5 @@
Name: modelarts.rpc
ListenOn: 0.0.0.0:2003
modelartsUrl: "https://modelarts.cn-north-4.myhuaweicloud.com/"

View File

@ -0,0 +1,31 @@
package logic
import (
"context"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
"github.com/zeromicro/go-zero/core/logx"
)
type GetTokenLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewGetTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTokenLogic {
return &GetTokenLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ListJob list all jobs
func (l *GetTokenLogic) GetToken(in *modelarts.TokenReq) (*modelarts.TokenResp, error) {
// todo: add your logic here and delete this line
return &modelarts.TokenResp{}, nil
}

View File

@ -0,0 +1,29 @@
// Code generated by goctl. DO NOT EDIT.
// Source: modelarts.proto
package server
import (
"context"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/logic"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
)
type ModelArtsServer struct {
svcCtx *svc.ServiceContext
modelarts.UnimplementedModelArtsServer
}
func NewModelArtsServer(svcCtx *svc.ServiceContext) *ModelArtsServer {
return &ModelArtsServer{
svcCtx: svcCtx,
}
}
// ListJob list all jobs
func (s *ModelArtsServer) GetToken(ctx context.Context, in *modelarts.TokenReq) (*modelarts.TokenResp, error) {
l := logic.NewGetTokenLogic(ctx, s.svcCtx)
return l.GetToken(in)
}

View File

@ -1,6 +1,6 @@
package svc
import "PCM/adaptor/slurm/slurmTianhe/rpc/internal/config"
import "PCM/adaptor/AIComputing/modelarts/rpc/internal/config"
type ServiceContext struct {
Config config.Config

View File

@ -4,10 +4,10 @@ import (
"flag"
"fmt"
"PCM/adaptor/slurm/slurmTianhe/rpc/internal/config"
"PCM/adaptor/slurm/slurmTianhe/rpc/internal/server"
"PCM/adaptor/slurm/slurmTianhe/rpc/internal/svc"
"PCM/adaptor/slurm/slurmTianhe/rpc/slurmTianhe"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/config"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/server"
"PCM/adaptor/AIComputing/modelarts/rpc/internal/svc"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
@ -16,7 +16,7 @@ import (
"google.golang.org/grpc/reflection"
)
var configFile = flag.String("f", "adaptor/slurm/slurmTianhe/rpc/etc/slurmtianhe.yaml", "the config file")
var configFile = flag.String("f", "etc/modelarts.yaml", "the config file")
func main() {
flag.Parse()
@ -26,7 +26,7 @@ func main() {
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
slurmTianhe.RegisterSlurmTianheServer(grpcServer, server.NewSlurmTianheServer(ctx))
modelarts.RegisterModelArtsServer(grpcServer, server.NewModelArtsServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)

View File

@ -0,0 +1,753 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.19.4
// source: modelarts.proto
package modelarts
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// *****************auth Start************************
type Auth struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Identity *Identity `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"` // @gotags: copier:"Identity"
Scope *Scope `protobuf:"bytes,2,opt,name=scope,proto3" json:"scope,omitempty"` // @gotags: copier:"Scope"
}
func (x *Auth) Reset() {
*x = Auth{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Auth) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Auth) ProtoMessage() {}
func (x *Auth) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Auth.ProtoReflect.Descriptor instead.
func (*Auth) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{0}
}
func (x *Auth) GetIdentity() *Identity {
if x != nil {
return x.Identity
}
return nil
}
func (x *Auth) GetScope() *Scope {
if x != nil {
return x.Scope
}
return nil
}
type Identity struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Methods *Methods `protobuf:"bytes,1,opt,name=methods,proto3" json:"methods,omitempty"` // @gotags: copier:"Methods"
Password *Password `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // @gotags: copier:"Password"
}
func (x *Identity) Reset() {
*x = Identity{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Identity) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Identity) ProtoMessage() {}
func (x *Identity) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Identity.ProtoReflect.Descriptor instead.
func (*Identity) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{1}
}
func (x *Identity) GetMethods() *Methods {
if x != nil {
return x.Methods
}
return nil
}
func (x *Identity) GetPassword() *Password {
if x != nil {
return x.Password
}
return nil
}
type Scope struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Project *Project `protobuf:"bytes,1,opt,name=project,proto3" json:"project,omitempty"` // @gotags: copier:"Project"
}
func (x *Scope) Reset() {
*x = Scope{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Scope) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Scope) ProtoMessage() {}
func (x *Scope) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Scope.ProtoReflect.Descriptor instead.
func (*Scope) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{2}
}
func (x *Scope) GetProject() *Project {
if x != nil {
return x.Project
}
return nil
}
type Project struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // @gotags: copier:"Name"
}
func (x *Project) Reset() {
*x = Project{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Project) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Project) ProtoMessage() {}
func (x *Project) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Project.ProtoReflect.Descriptor instead.
func (*Project) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{3}
}
func (x *Project) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type Methods struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Password []string `protobuf:"bytes,1,rep,name=password,proto3" json:"password,omitempty"` // @gotags: copier:"Password"
}
func (x *Methods) Reset() {
*x = Methods{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Methods) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Methods) ProtoMessage() {}
func (x *Methods) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Methods.ProtoReflect.Descriptor instead.
func (*Methods) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{4}
}
func (x *Methods) GetPassword() []string {
if x != nil {
return x.Password
}
return nil
}
type Password struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` // @gotags: copier:"User"
}
func (x *Password) Reset() {
*x = Password{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Password) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Password) ProtoMessage() {}
func (x *Password) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Password.ProtoReflect.Descriptor instead.
func (*Password) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{5}
}
func (x *Password) GetUser() *User {
if x != nil {
return x.User
}
return nil
}
type User struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // @gotags: copier:"Name"
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // @gotags: copier:"Password"
Domain *Domain `protobuf:"bytes,3,opt,name=domain,proto3" json:"domain,omitempty"` // @gotags: copier:"Domain"
}
func (x *User) Reset() {
*x = User{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *User) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*User) ProtoMessage() {}
func (x *User) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use User.ProtoReflect.Descriptor instead.
func (*User) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{6}
}
func (x *User) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *User) GetPassword() string {
if x != nil {
return x.Password
}
return ""
}
func (x *User) GetDomain() *Domain {
if x != nil {
return x.Domain
}
return nil
}
type Domain struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // @gotags: copier:"Name"
}
func (x *Domain) Reset() {
*x = Domain{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Domain) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Domain) ProtoMessage() {}
func (x *Domain) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Domain.ProtoReflect.Descriptor instead.
func (*Domain) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{7}
}
func (x *Domain) GetName() string {
if x != nil {
return x.Name
}
return ""
}
type TokenReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Auth *Auth `protobuf:"bytes,1,opt,name=auth,proto3" json:"auth,omitempty"` // @gotags: copier:"Auth"
}
func (x *TokenReq) Reset() {
*x = TokenReq{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TokenReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TokenReq) ProtoMessage() {}
func (x *TokenReq) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TokenReq.ProtoReflect.Descriptor instead.
func (*TokenReq) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{8}
}
func (x *TokenReq) GetAuth() *Auth {
if x != nil {
return x.Auth
}
return nil
}
type TokenResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *TokenResp) Reset() {
*x = TokenResp{}
if protoimpl.UnsafeEnabled {
mi := &file_modelarts_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TokenResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TokenResp) ProtoMessage() {}
func (x *TokenResp) ProtoReflect() protoreflect.Message {
mi := &file_modelarts_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TokenResp.ProtoReflect.Descriptor instead.
func (*TokenResp) Descriptor() ([]byte, []int) {
return file_modelarts_proto_rawDescGZIP(), []int{9}
}
var File_modelarts_proto protoreflect.FileDescriptor
var file_modelarts_proto_rawDesc = []byte{
0x0a, 0x0f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x22, 0x5f, 0x0a, 0x04,
0x61, 0x75, 0x74, 0x68, 0x12, 0x2f, 0x0a, 0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72,
0x74, 0x73, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x08, 0x69, 0x64, 0x65,
0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x26, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73,
0x2e, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x22, 0x69, 0x0a,
0x08, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x2c, 0x0a, 0x07, 0x6d, 0x65, 0x74,
0x68, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6f, 0x64,
0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x52, 0x07,
0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6d, 0x6f, 0x64, 0x65,
0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x52, 0x08,
0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x35, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x70,
0x65, 0x12, 0x2c, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x70,
0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x22,
0x1d, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x25,
0x0a, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73,
0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x2f, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72,
0x64, 0x12, 0x23, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x0f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x75, 0x73, 0x65, 0x72,
0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x61, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x12,
0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x29,
0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11,
0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x64, 0x6f, 0x6d, 0x61, 0x69,
0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x1c, 0x0a, 0x06, 0x64, 0x6f, 0x6d,
0x61, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x2f, 0x0a, 0x08, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x52, 0x65, 0x71, 0x12, 0x23, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x0f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x61, 0x75,
0x74, 0x68, 0x52, 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x0b, 0x0a, 0x09, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x52, 0x65, 0x73, 0x70, 0x32, 0x42, 0x0a, 0x09, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x41, 0x72,
0x74, 0x73, 0x12, 0x35, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x13,
0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x2e,
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x0c, 0x5a, 0x0a, 0x2f, 0x6d, 0x6f,
0x64, 0x65, 0x6c, 0x61, 0x72, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_modelarts_proto_rawDescOnce sync.Once
file_modelarts_proto_rawDescData = file_modelarts_proto_rawDesc
)
func file_modelarts_proto_rawDescGZIP() []byte {
file_modelarts_proto_rawDescOnce.Do(func() {
file_modelarts_proto_rawDescData = protoimpl.X.CompressGZIP(file_modelarts_proto_rawDescData)
})
return file_modelarts_proto_rawDescData
}
var file_modelarts_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_modelarts_proto_goTypes = []interface{}{
(*Auth)(nil), // 0: modelarts.auth
(*Identity)(nil), // 1: modelarts.identity
(*Scope)(nil), // 2: modelarts.scope
(*Project)(nil), // 3: modelarts.project
(*Methods)(nil), // 4: modelarts.methods
(*Password)(nil), // 5: modelarts.password
(*User)(nil), // 6: modelarts.user
(*Domain)(nil), // 7: modelarts.domain
(*TokenReq)(nil), // 8: modelarts.TokenReq
(*TokenResp)(nil), // 9: modelarts.TokenResp
}
var file_modelarts_proto_depIdxs = []int32{
1, // 0: modelarts.auth.identity:type_name -> modelarts.identity
2, // 1: modelarts.auth.scope:type_name -> modelarts.scope
4, // 2: modelarts.identity.methods:type_name -> modelarts.methods
5, // 3: modelarts.identity.password:type_name -> modelarts.password
3, // 4: modelarts.scope.project:type_name -> modelarts.project
6, // 5: modelarts.password.user:type_name -> modelarts.user
7, // 6: modelarts.user.domain:type_name -> modelarts.domain
0, // 7: modelarts.TokenReq.auth:type_name -> modelarts.auth
8, // 8: modelarts.ModelArts.GetToken:input_type -> modelarts.TokenReq
9, // 9: modelarts.ModelArts.GetToken:output_type -> modelarts.TokenResp
9, // [9:10] is the sub-list for method output_type
8, // [8:9] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
}
func init() { file_modelarts_proto_init() }
func file_modelarts_proto_init() {
if File_modelarts_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_modelarts_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Auth); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Identity); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Scope); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Project); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Methods); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Password); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*User); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Domain); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TokenReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_modelarts_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TokenResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_modelarts_proto_rawDesc,
NumEnums: 0,
NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_modelarts_proto_goTypes,
DependencyIndexes: file_modelarts_proto_depIdxs,
MessageInfos: file_modelarts_proto_msgTypes,
}.Build()
File_modelarts_proto = out.File
file_modelarts_proto_rawDesc = nil
file_modelarts_proto_goTypes = nil
file_modelarts_proto_depIdxs = nil
}

View File

@ -0,0 +1,107 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: modelarts.proto
package modelarts
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// ModelArtsClient is the client API for ModelArts service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ModelArtsClient interface {
//ListJob list all jobs
GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error)
}
type modelArtsClient struct {
cc grpc.ClientConnInterface
}
func NewModelArtsClient(cc grpc.ClientConnInterface) ModelArtsClient {
return &modelArtsClient{cc}
}
func (c *modelArtsClient) GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error) {
out := new(TokenResp)
err := c.cc.Invoke(ctx, "/modelarts.ModelArts/GetToken", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ModelArtsServer is the server API for ModelArts service.
// All implementations must embed UnimplementedModelArtsServer
// for forward compatibility
type ModelArtsServer interface {
//ListJob list all jobs
GetToken(context.Context, *TokenReq) (*TokenResp, error)
mustEmbedUnimplementedModelArtsServer()
}
// UnimplementedModelArtsServer must be embedded to have forward compatible implementations.
type UnimplementedModelArtsServer struct {
}
func (UnimplementedModelArtsServer) GetToken(context.Context, *TokenReq) (*TokenResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetToken not implemented")
}
func (UnimplementedModelArtsServer) mustEmbedUnimplementedModelArtsServer() {}
// UnsafeModelArtsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ModelArtsServer will
// result in compilation errors.
type UnsafeModelArtsServer interface {
mustEmbedUnimplementedModelArtsServer()
}
func RegisterModelArtsServer(s grpc.ServiceRegistrar, srv ModelArtsServer) {
s.RegisterService(&ModelArts_ServiceDesc, srv)
}
func _ModelArts_GetToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(TokenReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ModelArtsServer).GetToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/modelarts.ModelArts/GetToken",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ModelArtsServer).GetToken(ctx, req.(*TokenReq))
}
return interceptor(ctx, in, info, handler)
}
// ModelArts_ServiceDesc is the grpc.ServiceDesc for ModelArts service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ModelArts_ServiceDesc = grpc.ServiceDesc{
ServiceName: "modelarts.ModelArts",
HandlerType: (*ModelArtsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetToken",
Handler: _ModelArts_GetToken_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "modelarts.proto",
}

View File

@ -0,0 +1,47 @@
// Code generated by goctl. DO NOT EDIT.
// Source: modelarts.proto
package modelartsclient
import (
"context"
"PCM/adaptor/AIComputing/modelarts/rpc/modelarts"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
Auth = modelarts.Auth
Domain = modelarts.Domain
Identity = modelarts.Identity
Methods = modelarts.Methods
Password = modelarts.Password
Project = modelarts.Project
Scope = modelarts.Scope
TokenReq = modelarts.TokenReq
TokenResp = modelarts.TokenResp
User = modelarts.User
ModelArts interface {
// ListJob list all jobs
GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error)
}
defaultModelArts struct {
cli zrpc.Client
}
)
func NewModelArts(cli zrpc.Client) ModelArts {
return &defaultModelArts{
cli: cli,
}
}
// ListJob list all jobs
func (m *defaultModelArts) GetToken(ctx context.Context, in *TokenReq, opts ...grpc.CallOption) (*TokenResp, error) {
client := modelarts.NewModelArtsClient(m.cli.Conn())
return client.GetToken(ctx, in, opts...)
}

View File

@ -0,0 +1,58 @@
syntax = "proto3";
package modelarts;
option go_package = "/modelarts";
/******************auth Start*************************/
message auth{
identity identity = 1; // @gotags: copier:"Identity"
scope scope = 2; // @gotags: copier:"Scope"
}
message identity{
methods methods = 1; // @gotags: copier:"Methods"
password password = 2; // @gotags: copier:"Password"
}
message scope{
project project = 1; // @gotags: copier:"Project"
}
message project{
string name = 1; // @gotags: copier:"Name"
}
message methods{
repeated string password = 1; // @gotags: copier:"Password"
}
message password{
user user = 1; // @gotags: copier:"User"
}
message user{
string name = 1; // @gotags: copier:"Name"
string password = 2; // @gotags: copier:"Password"
domain domain = 3; // @gotags: copier:"Domain"
}
message domain{
string name = 1; // @gotags: copier:"Name"
}
message TokenReq{
auth auth = 1; // @gotags: copier:"Auth"
}
message TokenResp{
}
/******************auth end*************************/
// Slurm Services for Shuguang Branch
service ModelArts {
//ListJob list all jobs
rpc GetToken(TokenReq) returns (TokenResp);
}