feat:slurm provider support(TianHe)& listNode grpc example

This commit is contained in:
zhouqunjie 2022-10-24 20:24:49 -07:00
parent 06451fb456
commit e3643661cc
41 changed files with 325 additions and 227 deletions

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc-gen-go v1.26.0
// protoc (unknown)
// source: idl/pod.proto

View File

@ -34,8 +34,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/podCloudProvider",
"title": "云类型"
"$ref": "#/definitions/podCloudProvider"
},
"accountName": {
"type": "string",
@ -200,8 +199,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/podCloudProvider",
"title": "云类型"
"$ref": "#/definitions/podCloudProvider"
},
"accountName": {
"type": "string",
@ -290,14 +288,11 @@
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"@type": {
"type": "string"
}
},
"value": {
"type": "string",
"format": "byte"
}
}
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",

View File

@ -0,0 +1,3 @@
package slurm
//todo

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/extra"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/extra"
"fmt"
)
import "os"

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/extra"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/extra"
"fmt"
)
import "os"

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
"fmt"
)

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/nodeinfo"
"fmt"
)

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
"fmt"
)

View File

@ -1,8 +1,8 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
"fmt"
"os"
"strconv"

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/nodeinfo"
"fmt"
)

View File

@ -1,7 +1,7 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/partitioninfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/partitioninfo"
"fmt"
)

View File

@ -1,8 +1,8 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
"fmt"
"os"
)

View File

@ -1,8 +1,8 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
)
import "os/user"
import "os"

View File

@ -1,9 +1,9 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
)
import "os"
import "strconv"

View File

@ -2,9 +2,9 @@ package main
//
//import (
// "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
// job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
// submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
// "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
// job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
// submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
// "fmt"
// "os"
// "os/exec"

View File

@ -2,9 +2,9 @@ package main
//
//import (
// "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
// job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
// submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
// "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
// job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
// submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
// "fmt"
// "os"
// "os/exec"

View File

@ -1,8 +1,8 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
submit_job "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
)
import "os"
import "strconv"

View File

@ -4,8 +4,8 @@
package extra
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
"errors"
"fmt"
"os"

View File

@ -74,7 +74,7 @@ void free_submit_response_msg(struct submit_response_msg *msg)
import "C"
import (
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/jobinfo"
job_info "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/jobinfo"
"fmt"
)
import "unsafe"

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc-gen-go v1.26.0
// protoc (unknown)
// source: idl/slurm.proto
@ -20,10 +20,57 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// slurm version
type SlurmVersion int32
const (
// 0 - 阿里云
SlurmVersion_tianhe SlurmVersion = 0
)
// Enum value maps for SlurmVersion.
var (
SlurmVersion_name = map[int32]string{
0: "tianhe",
}
SlurmVersion_value = map[string]int32{
"tianhe": 0,
}
)
func (x SlurmVersion) Enum() *SlurmVersion {
p := new(SlurmVersion)
*p = x
return p
}
func (x SlurmVersion) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (SlurmVersion) Descriptor() protoreflect.EnumDescriptor {
return file_idl_slurm_proto_enumTypes[0].Descriptor()
}
func (SlurmVersion) Type() protoreflect.EnumType {
return &file_idl_slurm_proto_enumTypes[0]
}
func (x SlurmVersion) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use SlurmVersion.Descriptor instead.
func (SlurmVersion) EnumDescriptor() ([]byte, []int) {
return file_idl_slurm_proto_rawDescGZIP(), []int{0}
}
type ListNodesReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SlurmVersion int32 `protobuf:"varint,1,opt,name=SlurmVersion,proto3" json:"SlurmVersion,omitempty"`
}
func (x *ListNodesReq) Reset() {
@ -58,6 +105,13 @@ func (*ListNodesReq) Descriptor() ([]byte, []int) {
return file_idl_slurm_proto_rawDescGZIP(), []int{0}
}
func (x *ListNodesReq) GetSlurmVersion() int32 {
if x != nil {
return x.SlurmVersion
}
return 0
}
type NodeInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -196,22 +250,26 @@ var File_idl_slurm_proto protoreflect.FileDescriptor
var file_idl_slurm_proto_rawDesc = []byte{
0x0a, 0x0f, 0x69, 0x64, 0x6c, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x05, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x22, 0x0e, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x22, 0x9e, 0x01, 0x0a, 0x08, 0x4e, 0x6f, 0x64,
0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18,
0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x12, 0x12, 0x0a,
0x04, 0x63, 0x70, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x70, 0x75,
0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x61, 0x6c, 0x4d, 0x65, 0x6d,
0x6f, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x6c, 0x4d,
0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x73,
0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x73, 0x12,
0x18, 0x0a, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05,
0x52, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0d, 0x4c, 0x69, 0x73,
0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2e, 0x0a, 0x0a, 0x6e, 0x6f,
0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52,
0x09, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x32, 0x46, 0x0a, 0x0c, 0x53, 0x6c,
0x6f, 0x12, 0x05, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x22, 0x32, 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x6c, 0x75, 0x72,
0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c,
0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x9e, 0x01, 0x0a,
0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x6f, 0x61,
0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64,
0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x70, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x04, 0x63, 0x70, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x61,
0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72,
0x65, 0x61, 0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x6f, 0x63,
0x6b, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x6f, 0x63, 0x6b,
0x65, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x18, 0x06,
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x73, 0x22, 0x3f, 0x0a,
0x0d, 0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2e,
0x0a, 0x0a, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x2a, 0x1a,
0x0a, 0x0c, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0a,
0x0a, 0x06, 0x74, 0x69, 0x61, 0x6e, 0x68, 0x65, 0x10, 0x00, 0x32, 0x46, 0x0a, 0x0c, 0x53, 0x6c,
0x75, 0x72, 0x6d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x4c, 0x69,
0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x13, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x73,
@ -232,16 +290,18 @@ func file_idl_slurm_proto_rawDescGZIP() []byte {
return file_idl_slurm_proto_rawDescData
}
var file_idl_slurm_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_idl_slurm_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_idl_slurm_proto_goTypes = []interface{}{
(*ListNodesReq)(nil), // 0: slurm.ListNodesReq
(*NodeInfo)(nil), // 1: slurm.NodeInfo
(*ListNodesResp)(nil), // 2: slurm.ListNodesResp
(SlurmVersion)(0), // 0: slurm.SlurmVersion
(*ListNodesReq)(nil), // 1: slurm.ListNodesReq
(*NodeInfo)(nil), // 2: slurm.NodeInfo
(*ListNodesResp)(nil), // 3: slurm.ListNodesResp
}
var file_idl_slurm_proto_depIdxs = []int32{
1, // 0: slurm.ListNodesResp.node_infos:type_name -> slurm.NodeInfo
0, // 1: slurm.SlurmService.ListNodes:input_type -> slurm.ListNodesReq
2, // 2: slurm.SlurmService.ListNodes:output_type -> slurm.ListNodesResp
2, // 0: slurm.ListNodesResp.node_infos:type_name -> slurm.NodeInfo
1, // 1: slurm.SlurmService.ListNodes:input_type -> slurm.ListNodesReq
3, // 2: slurm.SlurmService.ListNodes:output_type -> slurm.ListNodesResp
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
@ -297,13 +357,14 @@ func file_idl_slurm_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_idl_slurm_proto_rawDesc,
NumEnums: 0,
NumEnums: 1,
NumMessages: 3,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_idl_slurm_proto_goTypes,
DependencyIndexes: file_idl_slurm_proto_depIdxs,
EnumInfos: file_idl_slurm_proto_enumTypes,
MessageInfos: file_idl_slurm_proto_msgTypes,
}.Build()
File_idl_slurm_proto = out.File

View File

@ -31,10 +31,21 @@ var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
var (
filter_SlurmService_ListNodes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_SlurmService_ListNodes_0(ctx context.Context, marshaler runtime.Marshaler, client SlurmServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListNodesReq
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SlurmService_ListNodes_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ListNodes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
@ -44,6 +55,13 @@ func local_request_SlurmService_ListNodes_0(ctx context.Context, marshaler runti
var protoReq ListNodesReq
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SlurmService_ListNodes_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ListNodes(ctx, &protoReq)
return msg, metadata, err

View File

@ -20,14 +20,11 @@
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"@type": {
"type": "string"
}
},
"value": {
"type": "string",
"format": "byte"
}
}
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",

View File

@ -3,7 +3,14 @@ package slurm;
option go_package = "/slurmpb";
message ListNodesReq{}
// slurm version
enum SlurmVersion {
// 0 -
tianhe = 0;
}
message ListNodesReq{
int32 SlurmVersion = 1;
}
message NodeInfo{
int32 boards = 1 ;

View File

@ -1,24 +1,13 @@
package server
import (
nodeinfo "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/nodeinfo"
pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
slurmer "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/service"
"context"
)
func ListNodes(ctx context.Context, req *pbslurm.ListNodesReq) (*pbslurm.ListNodesResp, error) {
nodeList := nodeinfo.Get_all_nodes()
var resp = pbslurm.ListNodesResp{}
for _, node := range nodeList.Node_list {
nodeInfoResult := pbslurm.NodeInfo{}
nodeInfoResult.Cpus = int32(node.Cpus)
nodeInfoResult.Boards = int32(node.Boards)
nodeInfoResult.RealMemory = int32(node.Real_memory)
nodeInfoResult.Sockets = int32(node.Sockets)
nodeInfoResult.Threads = int32(node.Threads)
resp.NodeInfos = append(resp.NodeInfos, &nodeInfoResult)
}
return &resp, nil
slurm, _ := slurmer.SelectSlurmVersion(req.SlurmVersion)
resp, _ := slurm.ListNodes(ctx, req)
return resp, nil
}

View File

@ -1,4 +1,4 @@
package service
package slurmer
import (
pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
@ -8,3 +8,12 @@ import (
type Slurmer interface {
ListNodes(ctx context.Context, req *pbslurm.ListNodesReq) (resp *pbslurm.ListNodesResp, err error) //list slurm nodes
}
func SelectSlurmVersion(slurmVersion int32) (slurmer Slurmer, err error) {
switch slurmVersion {
case int32(pbslurm.SlurmVersion_tianhe):
return SelectTianhe()
}
return
}

View File

@ -0,0 +1,35 @@
package slurmer
import (
nodeinfo "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/nodeinfo"
pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
"context"
)
type SlurmStruct struct {
version string
}
func SelectTianhe() (Slurmer, error) {
return &SlurmStruct{
version: "2.6.9.1",
}, nil
}
func (slurmStruct SlurmStruct) ListNodes(ctx context.Context, req *pbslurm.ListNodesReq) (*pbslurm.ListNodesResp, error) {
nodeList := nodeinfo.Get_all_nodes()
var resp = pbslurm.ListNodesResp{}
for _, node := range nodeList.Node_list {
nodeInfoResult := pbslurm.NodeInfo{}
nodeInfoResult.Cpus = int32(node.Cpus)
nodeInfoResult.Boards = int32(node.Boards)
nodeInfoResult.RealMemory = int32(node.Real_memory)
nodeInfoResult.Sockets = int32(node.Sockets)
nodeInfoResult.Threads = int32(node.Threads)
resp.NodeInfos = append(resp.NodeInfos, &nodeInfoResult)
}
return &resp, nil
}

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc-gen-go v1.26.0
// protoc (unknown)
// source: idl/ecs.proto

View File

@ -21,8 +21,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -90,8 +89,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云类型"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -135,8 +133,7 @@
"title": "可用区id"
},
"systemDisk": {
"$ref": "#/definitions/ecsSystemDisk",
"title": "系统磁盘"
"$ref": "#/definitions/ecsSystemDisk"
},
"amount": {
"type": "integer",
@ -152,8 +149,7 @@
"title": "数据盘N的云盘种类。取值范围cloud_efficiency高效云盘cloud_ssdSSD云盘cloud_essdESSD云盘cloud普通云盘。"
},
"internetChargeType": {
"$ref": "#/definitions/ecsInternetChargeType",
"title": "网络计费类型。取值范围PayByBandwidth按固定带宽计费。PayByTraffic默认按使用流量计费"
"$ref": "#/definitions/ecsInternetChargeType"
},
"internetMaxBandwidthOut": {
"type": "integer",
@ -252,8 +248,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -295,8 +290,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -318,8 +312,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云类型"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -406,8 +399,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -480,8 +472,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"images": {
"type": "array",
@ -538,8 +529,7 @@
"type": "object",
"properties": {
"provider": {
"$ref": "#/definitions/ecsCloudProvider",
"title": "云名称"
"$ref": "#/definitions/ecsCloudProvider"
},
"accountName": {
"type": "string",
@ -560,14 +550,11 @@
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"@type": {
"type": "string"
}
},
"value": {
"type": "string",
"format": "byte"
}
}
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",

View File

@ -1,8 +1,8 @@
package main
import (
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo/src/slurm/submitjob"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm"
"code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/cgo_tianhe/src/slurm/submitjob"
)
import "os/user"
import "os"

View File

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc-gen-go v1.26.0
// protoc (unknown)
// source: idl/tenant.proto

View File

@ -15,14 +15,11 @@
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"@type": {
"type": "string"
}
},
"value": {
"type": "string",
"format": "byte"
}
}
"additionalProperties": {}
},
"rpcStatus": {
"type": "object",