add/delete account

This commit is contained in:
zhouqunjie 2022-11-10 23:03:21 -08:00
parent 9855660385
commit 2500395ddf
17 changed files with 1481 additions and 105 deletions

View File

@ -32,7 +32,7 @@ var file_idl_slurm_proto_rawDesc = []byte{
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x69, 0x64, 0x6c, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x64,
0x62, 0x5f, 0x71, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x69, 0x64, 0x6c,
0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x64, 0x62, 0x5f, 0x77, 0x63, 0x6b, 0x65, 0x79, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x32, 0xad, 0x04, 0x0a, 0x0c, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x65,
0x72, 0x6f, 0x74, 0x6f, 0x32, 0xac, 0x05, 0x0a, 0x0c, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x73, 0x65,
0x72, 0x73, 0x12, 0x13, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e,
@ -57,18 +57,26 @@ var file_idl_slurm_proto_rawDesc = []byte{
0x6e, 0x74, 0x12, 0x14, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x2e, 0x47, 0x65, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
0x33, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73, 0x12, 0x12, 0x2e, 0x73, 0x6c,
0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x71, 0x1a,
0x13, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73,
0x52, 0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x63, 0x6b, 0x65,
0x79, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57,
0x63, 0x6b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12,
0x33, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x2e, 0x73, 0x6c,
0x75, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x1a,
0x13, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79,
0x52, 0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x39, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x2e,
0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x41, 0x64, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x41, 0x64, 0x64, 0x41,
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x42, 0x0a, 0x0d, 0x44, 0x65,
0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x17, 0x2e, 0x73, 0x6c,
0x75, 0x72, 0x6d, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e,
0x74, 0x52, 0x65, 0x71, 0x1a, 0x18, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33,
0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73, 0x12, 0x12, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x13,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x51, 0x6f, 0x73, 0x73, 0x52,
0x65, 0x73, 0x70, 0x12, 0x39, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79,
0x73, 0x12, 0x14, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x57, 0x63,
0x6b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x33,
0x0a, 0x08, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x13,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x63, 0x6b, 0x65, 0x79, 0x52,
0x65, 0x73, 0x70, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x70, 0x62, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_idl_slurm_proto_goTypes = []interface{}{
@ -78,18 +86,22 @@ var file_idl_slurm_proto_goTypes = []interface{}{
(*GetAssociationReq)(nil), // 3: slurm.GetAssociationReq
(*ListAccountsReq)(nil), // 4: slurm.ListAccountsReq
(*GetAccountReq)(nil), // 5: slurm.GetAccountReq
(*ListQossReq)(nil), // 6: slurm.ListQossReq
(*ListWckeysReq)(nil), // 7: slurm.ListWckeysReq
(*GetWckeyReq)(nil), // 8: slurm.GetWckeyReq
(*ListUsersResp)(nil), // 9: slurm.ListUsersResp
(*GetUserResp)(nil), // 10: slurm.GetUserResp
(*ListAssociationsResp)(nil), // 11: slurm.ListAssociationsResp
(*GetAssociationResp)(nil), // 12: slurm.GetAssociationResp
(*ListAccountsResp)(nil), // 13: slurm.ListAccountsResp
(*GetAccountResp)(nil), // 14: slurm.GetAccountResp
(*ListQossResp)(nil), // 15: slurm.ListQossResp
(*ListWckeysResp)(nil), // 16: slurm.ListWckeysResp
(*GetWckeyResp)(nil), // 17: slurm.GetWckeyResp
(*AddAccountReq)(nil), // 6: slurm.AddAccountReq
(*DeleteAccountReq)(nil), // 7: slurm.DeleteAccountReq
(*ListQossReq)(nil), // 8: slurm.ListQossReq
(*ListWckeysReq)(nil), // 9: slurm.ListWckeysReq
(*GetWckeyReq)(nil), // 10: slurm.GetWckeyReq
(*ListUsersResp)(nil), // 11: slurm.ListUsersResp
(*GetUserResp)(nil), // 12: slurm.GetUserResp
(*ListAssociationsResp)(nil), // 13: slurm.ListAssociationsResp
(*GetAssociationResp)(nil), // 14: slurm.GetAssociationResp
(*ListAccountsResp)(nil), // 15: slurm.ListAccountsResp
(*GetAccountResp)(nil), // 16: slurm.GetAccountResp
(*AddAccountResp)(nil), // 17: slurm.AddAccountResp
(*DeleteAccountResp)(nil), // 18: slurm.DeleteAccountResp
(*ListQossResp)(nil), // 19: slurm.ListQossResp
(*ListWckeysResp)(nil), // 20: slurm.ListWckeysResp
(*GetWckeyResp)(nil), // 21: slurm.GetWckeyResp
}
var file_idl_slurm_proto_depIdxs = []int32{
0, // 0: slurm.SlurmService.ListUsers:input_type -> slurm.ListUsersReq
@ -98,20 +110,24 @@ var file_idl_slurm_proto_depIdxs = []int32{
3, // 3: slurm.SlurmService.GetAssociation:input_type -> slurm.GetAssociationReq
4, // 4: slurm.SlurmService.ListAccounts:input_type -> slurm.ListAccountsReq
5, // 5: slurm.SlurmService.GetAccount:input_type -> slurm.GetAccountReq
6, // 6: slurm.SlurmService.ListQoss:input_type -> slurm.ListQossReq
7, // 7: slurm.SlurmService.ListWckeys:input_type -> slurm.ListWckeysReq
8, // 8: slurm.SlurmService.GetWckey:input_type -> slurm.GetWckeyReq
9, // 9: slurm.SlurmService.ListUsers:output_type -> slurm.ListUsersResp
10, // 10: slurm.SlurmService.GetUser:output_type -> slurm.GetUserResp
11, // 11: slurm.SlurmService.ListAssociations:output_type -> slurm.ListAssociationsResp
12, // 12: slurm.SlurmService.GetAssociation:output_type -> slurm.GetAssociationResp
13, // 13: slurm.SlurmService.ListAccounts:output_type -> slurm.ListAccountsResp
14, // 14: slurm.SlurmService.GetAccount:output_type -> slurm.GetAccountResp
15, // 15: slurm.SlurmService.ListQoss:output_type -> slurm.ListQossResp
16, // 16: slurm.SlurmService.ListWckeys:output_type -> slurm.ListWckeysResp
17, // 17: slurm.SlurmService.GetWckey:output_type -> slurm.GetWckeyResp
9, // [9:18] is the sub-list for method output_type
0, // [0:9] is the sub-list for method input_type
6, // 6: slurm.SlurmService.AddAccount:input_type -> slurm.AddAccountReq
7, // 7: slurm.SlurmService.DeleteAccount:input_type -> slurm.DeleteAccountReq
8, // 8: slurm.SlurmService.ListQoss:input_type -> slurm.ListQossReq
9, // 9: slurm.SlurmService.ListWckeys:input_type -> slurm.ListWckeysReq
10, // 10: slurm.SlurmService.GetWckey:input_type -> slurm.GetWckeyReq
11, // 11: slurm.SlurmService.ListUsers:output_type -> slurm.ListUsersResp
12, // 12: slurm.SlurmService.GetUser:output_type -> slurm.GetUserResp
13, // 13: slurm.SlurmService.ListAssociations:output_type -> slurm.ListAssociationsResp
14, // 14: slurm.SlurmService.GetAssociation:output_type -> slurm.GetAssociationResp
15, // 15: slurm.SlurmService.ListAccounts:output_type -> slurm.ListAccountsResp
16, // 16: slurm.SlurmService.GetAccount:output_type -> slurm.GetAccountResp
17, // 17: slurm.SlurmService.AddAccount:output_type -> slurm.AddAccountResp
18, // 18: slurm.SlurmService.DeleteAccount:output_type -> slurm.DeleteAccountResp
19, // 19: slurm.SlurmService.ListQoss:output_type -> slurm.ListQossResp
20, // 20: slurm.SlurmService.ListWckeys:output_type -> slurm.ListWckeysResp
21, // 21: slurm.SlurmService.GetWckey:output_type -> slurm.GetWckeyResp
11, // [11:22] is the sub-list for method output_type
0, // [0:11] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name

View File

@ -247,6 +247,78 @@ func local_request_SlurmService_GetAccount_0(ctx context.Context, marshaler runt
}
var (
filter_SlurmService_AddAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_SlurmService_AddAccount_0(ctx context.Context, marshaler runtime.Marshaler, client SlurmServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AddAccountReq
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_AddAccount_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.AddAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SlurmService_AddAccount_0(ctx context.Context, marshaler runtime.Marshaler, server SlurmServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AddAccountReq
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_AddAccount_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.AddAccount(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_SlurmService_DeleteAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_SlurmService_DeleteAccount_0(ctx context.Context, marshaler runtime.Marshaler, client SlurmServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteAccountReq
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_DeleteAccount_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.DeleteAccount(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_SlurmService_DeleteAccount_0(ctx context.Context, marshaler runtime.Marshaler, server SlurmServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteAccountReq
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_DeleteAccount_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.DeleteAccount(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_SlurmService_ListQoss_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@ -511,6 +583,56 @@ func RegisterSlurmServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
})
mux.Handle("GET", pattern_SlurmService_AddAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slurm.SlurmService/AddAccount", runtime.WithHTTPPathPattern("/apis/slurm/addAccount"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SlurmService_AddAccount_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SlurmService_AddAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_SlurmService_DeleteAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
var stream runtime.ServerTransportStream
ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slurm.SlurmService/DeleteAccount", runtime.WithHTTPPathPattern("/apis/slurm/deleteAccount"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_SlurmService_DeleteAccount_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SlurmService_DeleteAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_SlurmService_ListQoss_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -759,6 +881,50 @@ func RegisterSlurmServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
})
mux.Handle("GET", pattern_SlurmService_AddAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slurm.SlurmService/AddAccount", runtime.WithHTTPPathPattern("/apis/slurm/addAccount"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SlurmService_AddAccount_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SlurmService_AddAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_SlurmService_DeleteAccount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slurm.SlurmService/DeleteAccount", runtime.WithHTTPPathPattern("/apis/slurm/deleteAccount"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_SlurmService_DeleteAccount_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_SlurmService_DeleteAccount_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("GET", pattern_SlurmService_ListQoss_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -841,6 +1007,10 @@ var (
pattern_SlurmService_GetAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "slurm", "getAccount"}, ""))
pattern_SlurmService_AddAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "slurm", "addAccount"}, ""))
pattern_SlurmService_DeleteAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "slurm", "deleteAccount"}, ""))
pattern_SlurmService_ListQoss_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "slurm", "listQoss"}, ""))
pattern_SlurmService_ListWckeys_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"apis", "slurm", "listWckeys"}, ""))
@ -861,6 +1031,10 @@ var (
forward_SlurmService_GetAccount_0 = runtime.ForwardResponseMessage
forward_SlurmService_AddAccount_0 = runtime.ForwardResponseMessage
forward_SlurmService_DeleteAccount_0 = runtime.ForwardResponseMessage
forward_SlurmService_ListQoss_0 = runtime.ForwardResponseMessage
forward_SlurmService_ListWckeys_0 = runtime.ForwardResponseMessage

View File

@ -34,6 +34,10 @@ type SlurmServiceClient interface {
ListAccounts(ctx context.Context, in *ListAccountsReq, opts ...grpc.CallOption) (*ListAccountsResp, error)
// get specific account info from slurmdb
GetAccount(ctx context.Context, in *GetAccountReq, opts ...grpc.CallOption) (*GetAccountResp, error)
// add account
AddAccount(ctx context.Context, in *AddAccountReq, opts ...grpc.CallOption) (*AddAccountResp, error)
// delete account
DeleteAccount(ctx context.Context, in *DeleteAccountReq, opts ...grpc.CallOption) (*DeleteAccountResp, error)
// list all qos info from slurmdb
ListQoss(ctx context.Context, in *ListQossReq, opts ...grpc.CallOption) (*ListQossResp, error)
// list all wckeys info from slurmdb
@ -104,6 +108,24 @@ func (c *slurmServiceClient) GetAccount(ctx context.Context, in *GetAccountReq,
return out, nil
}
func (c *slurmServiceClient) AddAccount(ctx context.Context, in *AddAccountReq, opts ...grpc.CallOption) (*AddAccountResp, error) {
out := new(AddAccountResp)
err := c.cc.Invoke(ctx, "/slurm.SlurmService/AddAccount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *slurmServiceClient) DeleteAccount(ctx context.Context, in *DeleteAccountReq, opts ...grpc.CallOption) (*DeleteAccountResp, error) {
out := new(DeleteAccountResp)
err := c.cc.Invoke(ctx, "/slurm.SlurmService/DeleteAccount", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *slurmServiceClient) ListQoss(ctx context.Context, in *ListQossReq, opts ...grpc.CallOption) (*ListQossResp, error) {
out := new(ListQossResp)
err := c.cc.Invoke(ctx, "/slurm.SlurmService/ListQoss", in, out, opts...)
@ -147,6 +169,10 @@ type SlurmServiceServer interface {
ListAccounts(context.Context, *ListAccountsReq) (*ListAccountsResp, error)
// get specific account info from slurmdb
GetAccount(context.Context, *GetAccountReq) (*GetAccountResp, error)
// add account
AddAccount(context.Context, *AddAccountReq) (*AddAccountResp, error)
// delete account
DeleteAccount(context.Context, *DeleteAccountReq) (*DeleteAccountResp, error)
// list all qos info from slurmdb
ListQoss(context.Context, *ListQossReq) (*ListQossResp, error)
// list all wckeys info from slurmdb
@ -178,6 +204,12 @@ func (UnimplementedSlurmServiceServer) ListAccounts(context.Context, *ListAccoun
func (UnimplementedSlurmServiceServer) GetAccount(context.Context, *GetAccountReq) (*GetAccountResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetAccount not implemented")
}
func (UnimplementedSlurmServiceServer) AddAccount(context.Context, *AddAccountReq) (*AddAccountResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method AddAccount not implemented")
}
func (UnimplementedSlurmServiceServer) DeleteAccount(context.Context, *DeleteAccountReq) (*DeleteAccountResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteAccount not implemented")
}
func (UnimplementedSlurmServiceServer) ListQoss(context.Context, *ListQossReq) (*ListQossResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListQoss not implemented")
}
@ -308,6 +340,42 @@ func _SlurmService_GetAccount_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
func _SlurmService_AddAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AddAccountReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SlurmServiceServer).AddAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/slurm.SlurmService/AddAccount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SlurmServiceServer).AddAccount(ctx, req.(*AddAccountReq))
}
return interceptor(ctx, in, info, handler)
}
func _SlurmService_DeleteAccount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteAccountReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SlurmServiceServer).DeleteAccount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/slurm.SlurmService/DeleteAccount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SlurmServiceServer).DeleteAccount(ctx, req.(*DeleteAccountReq))
}
return interceptor(ctx, in, info, handler)
}
func _SlurmService_ListQoss_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListQossReq)
if err := dec(in); err != nil {
@ -393,6 +461,14 @@ var SlurmService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetAccount",
Handler: _SlurmService_GetAccount_Handler,
},
{
MethodName: "AddAccount",
Handler: _SlurmService_AddAccount_Handler,
},
{
MethodName: "DeleteAccount",
Handler: _SlurmService_DeleteAccount_Handler,
},
{
MethodName: "ListQoss",
Handler: _SlurmService_ListQoss_Handler,

View File

@ -296,6 +296,370 @@ func (x *GetAccountResp) GetAccountInfos() []*AccountInfo {
return nil
}
type AddAccountReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SlurmVersion SlurmVersion `protobuf:"varint,1,opt,name=slurm_version,json=slurmVersion,proto3,enum=slurm.SlurmVersion" json:"slurm_version,omitempty"`
Clusters string `protobuf:"bytes,2,opt,name=clusters,proto3" json:"clusters,omitempty"`
DefaultQos string `protobuf:"bytes,3,opt,name=default_qos,json=defaultQos,proto3" json:"default_qos,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
FairShare string `protobuf:"bytes,5,opt,name=fair_share,json=fairShare,proto3" json:"fair_share,omitempty"`
GrpCpuMins string `protobuf:"bytes,6,opt,name=grp_cpu_mins,json=grpCpuMins,proto3" json:"grp_cpu_mins,omitempty"`
GrpCpus string `protobuf:"bytes,7,opt,name=grp_cpus,json=grpCpus,proto3" json:"grp_cpus,omitempty"`
GrpJobs string `protobuf:"bytes,8,opt,name=grp_jobs,json=grpJobs,proto3" json:"grp_jobs,omitempty"`
GrpMemory string `protobuf:"bytes,9,opt,name=grp_memory,json=grpMemory,proto3" json:"grp_memory,omitempty"`
GrpNodes string `protobuf:"bytes,10,opt,name=grp_nodes,json=grpNodes,proto3" json:"grp_nodes,omitempty"`
GrpSubmitJobs string `protobuf:"bytes,11,opt,name=grp_submit_jobs,json=grpSubmitJobs,proto3" json:"grp_submit_jobs,omitempty"`
GrpWall string `protobuf:"bytes,12,opt,name=grp_wall,json=grpWall,proto3" json:"grp_wall,omitempty"`
MaxCpuMins string `protobuf:"bytes,13,opt,name=max_cpu_mins,json=maxCpuMins,proto3" json:"max_cpu_mins,omitempty"`
MaxCpus string `protobuf:"bytes,14,opt,name=max_cpus,json=maxCpus,proto3" json:"max_cpus,omitempty"`
MaxJobs string `protobuf:"bytes,15,opt,name=max_jobs,json=maxJobs,proto3" json:"max_jobs,omitempty"`
MaxNodes string `protobuf:"bytes,16,opt,name=max_nodes,json=maxNodes,proto3" json:"max_nodes,omitempty"`
MaxSubmitJobs string `protobuf:"bytes,17,opt,name=max_submit_jobs,json=maxSubmitJobs,proto3" json:"max_submit_jobs,omitempty"`
MaxWall string `protobuf:"bytes,18,opt,name=max_wall,json=maxWall,proto3" json:"max_wall,omitempty"`
Names string `protobuf:"bytes,19,opt,name=names,proto3" json:"names,omitempty"`
Organization string `protobuf:"bytes,20,opt,name=organization,proto3" json:"organization,omitempty"`
Parent string `protobuf:"bytes,21,opt,name=parent,proto3" json:"parent,omitempty"`
QosLevel string `protobuf:"bytes,22,opt,name=qos_level,json=qosLevel,proto3" json:"qos_level,omitempty"`
}
func (x *AddAccountReq) Reset() {
*x = AddAccountReq{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_account_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddAccountReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddAccountReq) ProtoMessage() {}
func (x *AddAccountReq) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_account_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 AddAccountReq.ProtoReflect.Descriptor instead.
func (*AddAccountReq) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_account_proto_rawDescGZIP(), []int{5}
}
func (x *AddAccountReq) GetSlurmVersion() SlurmVersion {
if x != nil {
return x.SlurmVersion
}
return SlurmVersion_tianhe
}
func (x *AddAccountReq) GetClusters() string {
if x != nil {
return x.Clusters
}
return ""
}
func (x *AddAccountReq) GetDefaultQos() string {
if x != nil {
return x.DefaultQos
}
return ""
}
func (x *AddAccountReq) GetDescription() string {
if x != nil {
return x.Description
}
return ""
}
func (x *AddAccountReq) GetFairShare() string {
if x != nil {
return x.FairShare
}
return ""
}
func (x *AddAccountReq) GetGrpCpuMins() string {
if x != nil {
return x.GrpCpuMins
}
return ""
}
func (x *AddAccountReq) GetGrpCpus() string {
if x != nil {
return x.GrpCpus
}
return ""
}
func (x *AddAccountReq) GetGrpJobs() string {
if x != nil {
return x.GrpJobs
}
return ""
}
func (x *AddAccountReq) GetGrpMemory() string {
if x != nil {
return x.GrpMemory
}
return ""
}
func (x *AddAccountReq) GetGrpNodes() string {
if x != nil {
return x.GrpNodes
}
return ""
}
func (x *AddAccountReq) GetGrpSubmitJobs() string {
if x != nil {
return x.GrpSubmitJobs
}
return ""
}
func (x *AddAccountReq) GetGrpWall() string {
if x != nil {
return x.GrpWall
}
return ""
}
func (x *AddAccountReq) GetMaxCpuMins() string {
if x != nil {
return x.MaxCpuMins
}
return ""
}
func (x *AddAccountReq) GetMaxCpus() string {
if x != nil {
return x.MaxCpus
}
return ""
}
func (x *AddAccountReq) GetMaxJobs() string {
if x != nil {
return x.MaxJobs
}
return ""
}
func (x *AddAccountReq) GetMaxNodes() string {
if x != nil {
return x.MaxNodes
}
return ""
}
func (x *AddAccountReq) GetMaxSubmitJobs() string {
if x != nil {
return x.MaxSubmitJobs
}
return ""
}
func (x *AddAccountReq) GetMaxWall() string {
if x != nil {
return x.MaxWall
}
return ""
}
func (x *AddAccountReq) GetNames() string {
if x != nil {
return x.Names
}
return ""
}
func (x *AddAccountReq) GetOrganization() string {
if x != nil {
return x.Organization
}
return ""
}
func (x *AddAccountReq) GetParent() string {
if x != nil {
return x.Parent
}
return ""
}
func (x *AddAccountReq) GetQosLevel() string {
if x != nil {
return x.QosLevel
}
return ""
}
type AddAccountResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *AddAccountResp) Reset() {
*x = AddAccountResp{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_account_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AddAccountResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AddAccountResp) ProtoMessage() {}
func (x *AddAccountResp) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_account_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 AddAccountResp.ProtoReflect.Descriptor instead.
func (*AddAccountResp) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_account_proto_rawDescGZIP(), []int{6}
}
func (x *AddAccountResp) GetResult() string {
if x != nil {
return x.Result
}
return ""
}
type DeleteAccountReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SlurmVersion SlurmVersion `protobuf:"varint,1,opt,name=slurm_version,json=slurmVersion,proto3,enum=slurm.SlurmVersion" json:"slurm_version,omitempty"`
Names string `protobuf:"bytes,2,opt,name=names,proto3" json:"names,omitempty"`
}
func (x *DeleteAccountReq) Reset() {
*x = DeleteAccountReq{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_account_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteAccountReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteAccountReq) ProtoMessage() {}
func (x *DeleteAccountReq) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_account_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 DeleteAccountReq.ProtoReflect.Descriptor instead.
func (*DeleteAccountReq) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_account_proto_rawDescGZIP(), []int{7}
}
func (x *DeleteAccountReq) GetSlurmVersion() SlurmVersion {
if x != nil {
return x.SlurmVersion
}
return SlurmVersion_tianhe
}
func (x *DeleteAccountReq) GetNames() string {
if x != nil {
return x.Names
}
return ""
}
type DeleteAccountResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *DeleteAccountResp) Reset() {
*x = DeleteAccountResp{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_account_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteAccountResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteAccountResp) ProtoMessage() {}
func (x *DeleteAccountResp) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_account_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 DeleteAccountResp.ProtoReflect.Descriptor instead.
func (*DeleteAccountResp) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_account_proto_rawDescGZIP(), []int{8}
}
func (x *DeleteAccountResp) GetResult() string {
if x != nil {
return x.Result
}
return ""
}
var File_idl_slurmdb_account_proto protoreflect.FileDescriptor
var file_idl_slurmdb_account_proto_rawDesc = []byte{
@ -342,8 +706,64 @@ var file_idl_slurmdb_account_proto_rawDesc = []byte{
0x75, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x12, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49,
0x6e, 0x66, 0x6f, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f,
0x73, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0x73, 0x22, 0xc5, 0x05, 0x0a, 0x0d, 0x41, 0x64, 0x64, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74,
0x52, 0x65, 0x71, 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x2e, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52,
0x0c, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a,
0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x66,
0x61, 0x75, 0x6c, 0x74, 0x5f, 0x71, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x51, 0x6f, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a,
0x66, 0x61, 0x69, 0x72, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
0x52, 0x09, 0x66, 0x61, 0x69, 0x72, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x67,
0x72, 0x70, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x6d, 0x69, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x67, 0x72, 0x70, 0x43, 0x70, 0x75, 0x4d, 0x69, 0x6e, 0x73, 0x12, 0x19, 0x0a,
0x08, 0x67, 0x72, 0x70, 0x5f, 0x63, 0x70, 0x75, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x67, 0x72, 0x70, 0x43, 0x70, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x70, 0x5f,
0x6a, 0x6f, 0x62, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x70, 0x4a,
0x6f, 0x62, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x70, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72,
0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72, 0x70, 0x4d, 0x65, 0x6d, 0x6f,
0x72, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x67, 0x72, 0x70, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18,
0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x72, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12,
0x26, 0x0a, 0x0f, 0x67, 0x72, 0x70, 0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x5f, 0x6a, 0x6f,
0x62, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x67, 0x72, 0x70, 0x53, 0x75, 0x62,
0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x67, 0x72, 0x70, 0x5f, 0x77,
0x61, 0x6c, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x67, 0x72, 0x70, 0x57, 0x61,
0x6c, 0x6c, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x70, 0x75, 0x5f, 0x6d, 0x69,
0x6e, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x43, 0x70, 0x75,
0x4d, 0x69, 0x6e, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x70, 0x75, 0x73,
0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x43, 0x70, 0x75, 0x73, 0x12,
0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x4a, 0x6f, 0x62, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61,
0x78, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6d,
0x61, 0x78, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78, 0x5f, 0x73,
0x75, 0x62, 0x6d, 0x69, 0x74, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0d, 0x6d, 0x61, 0x78, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62, 0x73, 0x12,
0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x77, 0x61, 0x6c, 0x6c, 0x18, 0x12, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x57, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61,
0x6d, 0x65, 0x73, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73,
0x12, 0x22, 0x0a, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x15,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09,
0x71, 0x6f, 0x73, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x71, 0x6f, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x28, 0x0a, 0x0e, 0x41, 0x64, 0x64,
0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x22, 0x62, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x63, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x2b, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06,
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x70, 0x62,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -358,29 +778,35 @@ func file_idl_slurmdb_account_proto_rawDescGZIP() []byte {
return file_idl_slurmdb_account_proto_rawDescData
}
var file_idl_slurmdb_account_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
var file_idl_slurmdb_account_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_idl_slurmdb_account_proto_goTypes = []interface{}{
(*AccountInfo)(nil), // 0: slurm.AccountInfo
(*ListAccountsReq)(nil), // 1: slurm.ListAccountsReq
(*ListAccountsResp)(nil), // 2: slurm.ListAccountsResp
(*GetAccountReq)(nil), // 3: slurm.GetAccountReq
(*GetAccountResp)(nil), // 4: slurm.GetAccountResp
(*AssociationInfo)(nil), // 5: slurm.AssociationInfo
(*CoordInfo)(nil), // 6: slurm.CoordInfo
(SlurmVersion)(0), // 7: slurm.SlurmVersion
(*AccountInfo)(nil), // 0: slurm.AccountInfo
(*ListAccountsReq)(nil), // 1: slurm.ListAccountsReq
(*ListAccountsResp)(nil), // 2: slurm.ListAccountsResp
(*GetAccountReq)(nil), // 3: slurm.GetAccountReq
(*GetAccountResp)(nil), // 4: slurm.GetAccountResp
(*AddAccountReq)(nil), // 5: slurm.AddAccountReq
(*AddAccountResp)(nil), // 6: slurm.AddAccountResp
(*DeleteAccountReq)(nil), // 7: slurm.DeleteAccountReq
(*DeleteAccountResp)(nil), // 8: slurm.DeleteAccountResp
(*AssociationInfo)(nil), // 9: slurm.AssociationInfo
(*CoordInfo)(nil), // 10: slurm.CoordInfo
(SlurmVersion)(0), // 11: slurm.SlurmVersion
}
var file_idl_slurmdb_account_proto_depIdxs = []int32{
5, // 0: slurm.AccountInfo.assoc_list:type_name -> slurm.AssociationInfo
6, // 1: slurm.AccountInfo.coordinators:type_name -> slurm.CoordInfo
7, // 2: slurm.ListAccountsReq.slurm_version:type_name -> slurm.SlurmVersion
0, // 3: slurm.ListAccountsResp.account_infos:type_name -> slurm.AccountInfo
7, // 4: slurm.GetAccountReq.slurm_version:type_name -> slurm.SlurmVersion
0, // 5: slurm.GetAccountResp.account_infos:type_name -> slurm.AccountInfo
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
9, // 0: slurm.AccountInfo.assoc_list:type_name -> slurm.AssociationInfo
10, // 1: slurm.AccountInfo.coordinators:type_name -> slurm.CoordInfo
11, // 2: slurm.ListAccountsReq.slurm_version:type_name -> slurm.SlurmVersion
0, // 3: slurm.ListAccountsResp.account_infos:type_name -> slurm.AccountInfo
11, // 4: slurm.GetAccountReq.slurm_version:type_name -> slurm.SlurmVersion
0, // 5: slurm.GetAccountResp.account_infos:type_name -> slurm.AccountInfo
11, // 6: slurm.AddAccountReq.slurm_version:type_name -> slurm.SlurmVersion
11, // 7: slurm.DeleteAccountReq.slurm_version:type_name -> slurm.SlurmVersion
8, // [8:8] is the sub-list for method output_type
8, // [8:8] 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_idl_slurmdb_account_proto_init() }
@ -452,6 +878,54 @@ func file_idl_slurmdb_account_proto_init() {
return nil
}
}
file_idl_slurmdb_account_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddAccountReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_idl_slurmdb_account_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AddAccountResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_idl_slurmdb_account_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteAccountReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_idl_slurmdb_account_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteAccountResp); 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{
@ -459,7 +933,7 @@ func file_idl_slurmdb_account_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_idl_slurmdb_account_proto_rawDesc,
NumEnums: 0,
NumMessages: 5,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -380,7 +380,23 @@ type AddUsersReq struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
UserInfo *UserInfo `protobuf:"bytes,1,opt,name=user_info,json=userInfo,proto3" json:"user_info,omitempty"`
SlurmVersion SlurmVersion `protobuf:"varint,1,opt,name=slurm_version,json=slurmVersion,proto3,enum=slurm.SlurmVersion" json:"slurm_version,omitempty"`
Accounts string `protobuf:"bytes,2,opt,name=accounts,proto3" json:"accounts,omitempty"`
AdminLevel string `protobuf:"bytes,3,opt,name=admin_level,json=adminLevel,proto3" json:"admin_level,omitempty"`
Clusters string `protobuf:"bytes,4,opt,name=clusters,proto3" json:"clusters,omitempty"`
DefaultAccount string `protobuf:"bytes,5,opt,name=default_account,json=defaultAccount,proto3" json:"default_account,omitempty"`
DefaultQos string `protobuf:"bytes,6,opt,name=default_qos,json=defaultQos,proto3" json:"default_qos,omitempty"`
DefaultWckey string `protobuf:"bytes,7,opt,name=default_wckey,json=defaultWckey,proto3" json:"default_wckey,omitempty"`
FairShare string `protobuf:"bytes,8,opt,name=fair_share,json=fairShare,proto3" json:"fair_share,omitempty"`
MaxCpuMins string `protobuf:"bytes,9,opt,name=max_cpu_mins,json=maxCpuMins,proto3" json:"max_cpu_mins,omitempty"`
MaxCpus string `protobuf:"bytes,10,opt,name=max_cpus,json=maxCpus,proto3" json:"max_cpus,omitempty"`
MaxJobs string `protobuf:"bytes,11,opt,name=max_jobs,json=maxJobs,proto3" json:"max_jobs,omitempty"`
MaxNodes string `protobuf:"bytes,12,opt,name=max_nodes,json=maxNodes,proto3" json:"max_nodes,omitempty"`
MaxSubmitJobs string `protobuf:"bytes,13,opt,name=max_submit_jobs,json=maxSubmitJobs,proto3" json:"max_submit_jobs,omitempty"`
MaxWall string `protobuf:"bytes,14,opt,name=max_wall,json=maxWall,proto3" json:"max_wall,omitempty"`
Names string `protobuf:"bytes,15,opt,name=names,proto3" json:"names,omitempty"`
Partition string `protobuf:"bytes,16,opt,name=partition,proto3" json:"partition,omitempty"`
QosLevel string `protobuf:"bytes,17,opt,name=qos_level,json=qosLevel,proto3" json:"qos_level,omitempty"`
}
func (x *AddUsersReq) Reset() {
@ -415,11 +431,123 @@ func (*AddUsersReq) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_user_proto_rawDescGZIP(), []int{6}
}
func (x *AddUsersReq) GetUserInfo() *UserInfo {
func (x *AddUsersReq) GetSlurmVersion() SlurmVersion {
if x != nil {
return x.UserInfo
return x.SlurmVersion
}
return nil
return SlurmVersion_tianhe
}
func (x *AddUsersReq) GetAccounts() string {
if x != nil {
return x.Accounts
}
return ""
}
func (x *AddUsersReq) GetAdminLevel() string {
if x != nil {
return x.AdminLevel
}
return ""
}
func (x *AddUsersReq) GetClusters() string {
if x != nil {
return x.Clusters
}
return ""
}
func (x *AddUsersReq) GetDefaultAccount() string {
if x != nil {
return x.DefaultAccount
}
return ""
}
func (x *AddUsersReq) GetDefaultQos() string {
if x != nil {
return x.DefaultQos
}
return ""
}
func (x *AddUsersReq) GetDefaultWckey() string {
if x != nil {
return x.DefaultWckey
}
return ""
}
func (x *AddUsersReq) GetFairShare() string {
if x != nil {
return x.FairShare
}
return ""
}
func (x *AddUsersReq) GetMaxCpuMins() string {
if x != nil {
return x.MaxCpuMins
}
return ""
}
func (x *AddUsersReq) GetMaxCpus() string {
if x != nil {
return x.MaxCpus
}
return ""
}
func (x *AddUsersReq) GetMaxJobs() string {
if x != nil {
return x.MaxJobs
}
return ""
}
func (x *AddUsersReq) GetMaxNodes() string {
if x != nil {
return x.MaxNodes
}
return ""
}
func (x *AddUsersReq) GetMaxSubmitJobs() string {
if x != nil {
return x.MaxSubmitJobs
}
return ""
}
func (x *AddUsersReq) GetMaxWall() string {
if x != nil {
return x.MaxWall
}
return ""
}
func (x *AddUsersReq) GetNames() string {
if x != nil {
return x.Names
}
return ""
}
func (x *AddUsersReq) GetPartition() string {
if x != nil {
return x.Partition
}
return ""
}
func (x *AddUsersReq) GetQosLevel() string {
if x != nil {
return x.QosLevel
}
return ""
}
type AddUsersResp struct {
@ -427,7 +555,7 @@ type AddUsersResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result int32 `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"`
Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *AddUsersResp) Reset() {
@ -462,11 +590,113 @@ func (*AddUsersResp) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_user_proto_rawDescGZIP(), []int{7}
}
func (x *AddUsersResp) GetResult() int32 {
func (x *AddUsersResp) GetResult() string {
if x != nil {
return x.Result
}
return 0
return ""
}
type DeleteUsersReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SlurmVersion SlurmVersion `protobuf:"varint,1,opt,name=slurm_version,json=slurmVersion,proto3,enum=slurm.SlurmVersion" json:"slurm_version,omitempty"`
Names string `protobuf:"bytes,2,opt,name=names,proto3" json:"names,omitempty"`
}
func (x *DeleteUsersReq) Reset() {
*x = DeleteUsersReq{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_user_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteUsersReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteUsersReq) ProtoMessage() {}
func (x *DeleteUsersReq) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_user_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 DeleteUsersReq.ProtoReflect.Descriptor instead.
func (*DeleteUsersReq) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_user_proto_rawDescGZIP(), []int{8}
}
func (x *DeleteUsersReq) GetSlurmVersion() SlurmVersion {
if x != nil {
return x.SlurmVersion
}
return SlurmVersion_tianhe
}
func (x *DeleteUsersReq) GetNames() string {
if x != nil {
return x.Names
}
return ""
}
type DeleteUsersResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Result string `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (x *DeleteUsersResp) Reset() {
*x = DeleteUsersResp{}
if protoimpl.UnsafeEnabled {
mi := &file_idl_slurmdb_user_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteUsersResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteUsersResp) ProtoMessage() {}
func (x *DeleteUsersResp) ProtoReflect() protoreflect.Message {
mi := &file_idl_slurmdb_user_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 DeleteUsersResp.ProtoReflect.Descriptor instead.
func (*DeleteUsersResp) Descriptor() ([]byte, []int) {
return file_idl_slurmdb_user_proto_rawDescGZIP(), []int{9}
}
func (x *DeleteUsersResp) GetResult() string {
if x != nil {
return x.Result
}
return ""
}
var File_idl_slurmdb_user_proto protoreflect.FileDescriptor
@ -526,14 +756,55 @@ var file_idl_slurmdb_user_proto_rawDesc = []byte{
0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x6e,
0x66, 0x6f, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x2e, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x49,
0x6e, 0x66, 0x6f, 0x22, 0x3b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52,
0x65, 0x71, 0x12, 0x2c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x55, 0x73,
0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f,
0x22, 0x26, 0x0a, 0x0c, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70,
0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6e, 0x66, 0x6f, 0x22, 0xb7, 0x04, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73,
0x52, 0x65, 0x71, 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x5f, 0x76, 0x65, 0x72,
0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x2e, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52,
0x0c, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a,
0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x64, 0x6d,
0x69, 0x6e, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
0x61, 0x64, 0x6d, 0x69, 0x6e, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c,
0x75, 0x73, 0x74, 0x65, 0x72, 0x73, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
0x74, 0x5f, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0e, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12,
0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x71, 0x6f, 0x73, 0x18, 0x06,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x51, 0x6f, 0x73,
0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x77, 0x63, 0x6b, 0x65,
0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
0x57, 0x63, 0x6b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x61, 0x69, 0x72, 0x5f, 0x73, 0x68,
0x61, 0x72, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 0x61, 0x69, 0x72, 0x53,
0x68, 0x61, 0x72, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x70, 0x75, 0x5f,
0x6d, 0x69, 0x6e, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x43,
0x70, 0x75, 0x4d, 0x69, 0x6e, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x70,
0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x43, 0x70, 0x75,
0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x0b, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x4a, 0x6f, 0x62, 0x73, 0x12, 0x1b, 0x0a, 0x09,
0x6d, 0x61, 0x78, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x6d, 0x61, 0x78, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6d, 0x61, 0x78,
0x5f, 0x73, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x0d, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0d, 0x6d, 0x61, 0x78, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62,
0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x77, 0x61, 0x6c, 0x6c, 0x18, 0x0e, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x57, 0x61, 0x6c, 0x6c, 0x12, 0x14, 0x0a, 0x05,
0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x61, 0x6d,
0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e,
0x12, 0x1b, 0x0a, 0x09, 0x71, 0x6f, 0x73, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x11, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x6f, 0x73, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x26, 0x0a,
0x0c, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a,
0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x60, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x55,
0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x12, 0x38, 0x0a, 0x0d, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x2e, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f,
0x6e, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x05, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x29, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x55, 0x73, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65,
0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75,
0x6c, 0x74, 0x42, 0x0a, 0x5a, 0x08, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -548,7 +819,7 @@ func file_idl_slurmdb_user_proto_rawDescGZIP() []byte {
return file_idl_slurmdb_user_proto_rawDescData
}
var file_idl_slurmdb_user_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_idl_slurmdb_user_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_idl_slurmdb_user_proto_goTypes = []interface{}{
(*UserInfoList)(nil), // 0: slurm.UserInfoList
(*UserInfo)(nil), // 1: slurm.UserInfo
@ -558,26 +829,29 @@ var file_idl_slurmdb_user_proto_goTypes = []interface{}{
(*GetUserResp)(nil), // 5: slurm.GetUserResp
(*AddUsersReq)(nil), // 6: slurm.AddUsersReq
(*AddUsersResp)(nil), // 7: slurm.AddUsersResp
(*AssociationInfo)(nil), // 8: slurm.AssociationInfo
(*CoordInfo)(nil), // 9: slurm.CoordInfo
(*WckeyInfo)(nil), // 10: slurm.WckeyInfo
(SlurmVersion)(0), // 11: slurm.SlurmVersion
(*DeleteUsersReq)(nil), // 8: slurm.DeleteUsersReq
(*DeleteUsersResp)(nil), // 9: slurm.DeleteUsersResp
(*AssociationInfo)(nil), // 10: slurm.AssociationInfo
(*CoordInfo)(nil), // 11: slurm.CoordInfo
(*WckeyInfo)(nil), // 12: slurm.WckeyInfo
(SlurmVersion)(0), // 13: slurm.SlurmVersion
}
var file_idl_slurmdb_user_proto_depIdxs = []int32{
1, // 0: slurm.UserInfoList.userInfos:type_name -> slurm.UserInfo
8, // 1: slurm.UserInfo.association_list:type_name -> slurm.AssociationInfo
9, // 2: slurm.UserInfo.coord_list:type_name -> slurm.CoordInfo
10, // 3: slurm.UserInfo.wckey_list:type_name -> slurm.WckeyInfo
11, // 4: slurm.ListUsersReq.slurm_version:type_name -> slurm.SlurmVersion
10, // 1: slurm.UserInfo.association_list:type_name -> slurm.AssociationInfo
11, // 2: slurm.UserInfo.coord_list:type_name -> slurm.CoordInfo
12, // 3: slurm.UserInfo.wckey_list:type_name -> slurm.WckeyInfo
13, // 4: slurm.ListUsersReq.slurm_version:type_name -> slurm.SlurmVersion
1, // 5: slurm.ListUsersResp.user_infos:type_name -> slurm.UserInfo
11, // 6: slurm.GetUserReq.slurm_version:type_name -> slurm.SlurmVersion
13, // 6: slurm.GetUserReq.slurm_version:type_name -> slurm.SlurmVersion
1, // 7: slurm.GetUserResp.user_info:type_name -> slurm.UserInfo
1, // 8: slurm.AddUsersReq.user_info:type_name -> slurm.UserInfo
9, // [9:9] is the sub-list for method output_type
9, // [9:9] is the sub-list for method input_type
9, // [9:9] is the sub-list for extension type_name
9, // [9:9] is the sub-list for extension extendee
0, // [0:9] is the sub-list for field type_name
13, // 8: slurm.AddUsersReq.slurm_version:type_name -> slurm.SlurmVersion
13, // 9: slurm.DeleteUsersReq.slurm_version:type_name -> slurm.SlurmVersion
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_idl_slurmdb_user_proto_init() }
@ -686,6 +960,30 @@ func file_idl_slurmdb_user_proto_init() {
return nil
}
}
file_idl_slurmdb_user_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUsersReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_idl_slurmdb_user_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteUsersResp); 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{
@ -693,7 +991,7 @@ func file_idl_slurmdb_user_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_idl_slurmdb_user_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumMessages: 10,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -87,6 +87,14 @@
}
}
},
"slurmAddAccountResp": {
"type": "object",
"properties": {
"result": {
"type": "string"
}
}
},
"slurmAssocUsageInfo": {
"type": "object"
},
@ -229,6 +237,14 @@
}
}
},
"slurmDeleteAccountResp": {
"type": "object",
"properties": {
"result": {
"type": "string"
}
}
},
"slurmGetAccountResp": {
"type": "object",
"properties": {

View File

@ -31,6 +31,12 @@ service SlurmService {
// get specific account info from slurmdb
rpc GetAccount(GetAccountReq) returns (GetAccountResp);
// add account
rpc AddAccount(AddAccountReq) returns (AddAccountResp);
// delete account
rpc DeleteAccount(DeleteAccountReq) returns (DeleteAccountResp);
// list all qos info from slurmdb
rpc ListQoss(ListQossReq) returns (ListQossResp);

View File

@ -15,6 +15,10 @@ http:
get: "/apis/slurm/listAccounts"
- selector: slurm.SlurmService.GetAccount
get: "/apis/slurm/getAccount"
- selector: slurm.SlurmService.AddAccount
get: "/apis/slurm/addAccount"
- selector: slurm.SlurmService.DeleteAccount
get: "/apis/slurm/deleteAccount"
- selector: slurm.SlurmService.ListQoss
get: "/apis/slurm/listQoss"
- selector: slurm.SlurmService.ListWckeys

View File

@ -30,4 +30,42 @@ message GetAccountReq{
message GetAccountResp {
repeated AccountInfo account_infos = 1;
}
message AddAccountReq{
SlurmVersion slurm_version = 1;
string clusters =2;
string default_qos=3;
string description=4;
string fair_share=5;
string grp_cpu_mins=6;
string grp_cpus=7;
string grp_jobs=8;
string grp_memory=9;
string grp_nodes=10;
string grp_submit_jobs=11;
string grp_wall=12;
string max_cpu_mins=13;
string max_cpus=14;
string max_jobs=15;
string max_nodes=16;
string max_submit_jobs=17;
string max_wall=18;
string names=19;
string organization=20;
string parent=21;
string qos_level=22;
}
message AddAccountResp {
string result = 1;
}
message DeleteAccountReq{
SlurmVersion slurm_version = 1;
string names=2;
}
message DeleteAccountResp {
string result = 1;
}

View File

@ -41,8 +41,35 @@ message GetUserResp {
}
message AddUsersReq{
UserInfo user_info = 1;
SlurmVersion slurm_version = 1;
string accounts=2;
string admin_level=3;
string clusters=4;
string default_account=5;
string default_qos=6;
string default_wckey=7;
string fair_share=8;
string max_cpu_mins=9;
string max_cpus=10;
string max_jobs=11;
string max_nodes=12;
string max_submit_jobs=13;
string max_wall=14;
string names=15;
string partition=16;
string qos_level=17;
}
message AddUsersResp {
int32 result =1;
string result =1;
}
message DeleteUsersReq{
SlurmVersion slurm_version = 1;
string names=2;
}
message DeleteUsersResp {
string result =1;
}

View File

@ -72,6 +72,26 @@ func (s *Server) GetAccount(ctx context.Context, req *slurmpb.GetAccountReq) (*s
return resp, nil
}
// AddAccount return result
func (s *Server) AddAccount(ctx context.Context, req *slurmpb.AddAccountReq) (*slurmpb.AddAccountResp, error) {
resp, err := AddAccount(ctx, req)
if err != nil {
glog.Errorf("Add error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// DeleteAccount return result
func (s *Server) DeleteAccount(ctx context.Context, req *slurmpb.DeleteAccountReq) (*slurmpb.DeleteAccountResp, error) {
resp, err := DeleteAccount(ctx, req)
if err != nil {
glog.Errorf("Delete error %+v", err)
return nil, status.Errorf(codes.Internal, err.Error())
}
return resp, nil
}
// ListQoss return all slurm qos
func (s *Server) ListQoss(ctx context.Context, req *slurmpb.ListQossReq) (*slurmpb.ListQossResp, error) {
resp, err := ListQoss(ctx, req)

View File

@ -60,6 +60,24 @@ func GetAccount(ctx context.Context, req *pbslurm.GetAccountReq) (*pbslurm.GetAc
return resp, nil
}
func AddAccount(ctx context.Context, req *pbslurm.AddAccountReq) (*pbslurm.AddAccountResp, error) {
slurm, _ := slurmer.SelectSlurmVersion(req.SlurmVersion)
if slurm == nil {
return nil, nil
}
resp, _ := slurm.AddAccount(ctx, req)
return resp, nil
}
func DeleteAccount(ctx context.Context, req *pbslurm.DeleteAccountReq) (*pbslurm.DeleteAccountResp, error) {
slurm, _ := slurmer.SelectSlurmVersion(req.SlurmVersion)
if slurm == nil {
return nil, nil
}
resp, _ := slurm.DeleteAccount(ctx, req)
return resp, nil
}
func ListQoss(ctx context.Context, req *pbslurm.ListQossReq) (*pbslurm.ListQossResp, error) {
slurm, _ := slurmer.SelectSlurmVersion(req.SlurmVersion)
if slurm == nil {
@ -68,6 +86,7 @@ func ListQoss(ctx context.Context, req *pbslurm.ListQossReq) (*pbslurm.ListQossR
resp, _ := slurm.ListQoss(ctx, req)
return resp, nil
}
func ListWckeys(ctx context.Context, req *pbslurm.ListWckeysReq) (*pbslurm.ListWckeysResp, error) {
slurm, _ := slurmer.SelectSlurmVersion(req.SlurmVersion)
if slurm == nil {

View File

@ -53,6 +53,7 @@ struct slurmdb_account_rec *account_from_list(struct account_info_msg *list, int
import "C"
import (
pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
"code.gitlink.org.cn/JCCE/PCM.git/common/ssh"
"context"
)
@ -111,3 +112,93 @@ func (slurmStruct SlurmStruct) GetAccount(ctx context.Context, req *pbslurm.GetA
return &resp, nil
}
func (slurmStruct SlurmStruct) AddAccount(ctx context.Context, req *pbslurm.AddAccountReq) (*pbslurm.AddAccountResp, error) {
cmd := "/usr/local/bin/sacctmgr add account "
cmd = cmd + req.Names
if len(req.Clusters) != 0 {
cmd = cmd + " Clusters=" + req.Clusters
}
if len(req.DefaultQos) != 0 {
cmd = cmd + " DefaultQOS=" + req.DefaultQos
}
if len(req.Description) != 0 {
cmd = cmd + " Description=\"" + req.Description + "\""
}
if len(req.FairShare) != 0 {
cmd = cmd + " Fairshare=" + req.FairShare
}
if len(req.GrpCpuMins) != 0 {
cmd = cmd + " GrpCPUMins=" + req.GrpCpuMins
}
if len(req.GrpCpus) != 0 {
cmd = cmd + " GrpCPUs=" + req.GrpCpus
}
if len(req.GrpJobs) != 0 {
cmd = cmd + " GrpJobs=" + req.GrpJobs
}
if len(req.GrpMemory) != 0 {
cmd = cmd + " GrpMemory=" + req.GrpMemory
}
if len(req.GrpNodes) != 0 {
cmd = cmd + " GrpNodes=" + req.GrpNodes
}
if len(req.GrpSubmitJobs) != 0 {
cmd = cmd + " GrpSubmitJob=" + req.GrpSubmitJobs
}
if len(req.GrpWall) != 0 {
cmd = cmd + " GrpWall=" + req.GrpWall
}
if len(req.MaxCpuMins) != 0 {
cmd = cmd + " MaxCPUMins=" + req.MaxCpuMins
}
if len(req.MaxCpus) != 0 {
cmd = cmd + " MaxCPUs=" + req.MaxCpus
}
if len(req.MaxJobs) != 0 {
cmd = cmd + " MaxJobs=" + req.MaxJobs
}
if len(req.MaxNodes) != 0 {
cmd = cmd + " MaxNodes=" + req.MaxNodes
}
if len(req.MaxSubmitJobs) != 0 {
cmd = cmd + " MaxSubmitJobs=" + req.MaxSubmitJobs
}
if len(req.MaxWall) != 0 {
cmd = cmd + " MaxWall=" + req.MaxWall
}
if len(req.Organization) != 0 {
cmd = cmd + " Organization=" + req.Organization
}
if len(req.Parent) != 0 {
cmd = cmd + " Parent=" + req.Parent
}
if len(req.QosLevel) != 0 {
cmd = cmd + " QosLevel=" + req.QosLevel
}
cmd = cmd + " -i"
result := ssh.ExecCommand(cmd)
resp := pbslurm.AddAccountResp{}
resp.Result = result
return &resp, nil
}
func (slurmStruct SlurmStruct) DeleteAccount(ctx context.Context, req *pbslurm.DeleteAccountReq) (*pbslurm.DeleteAccountResp, error) {
cmd := "/usr/local/bin/sacctmgr delete account "
cmd = cmd + req.Names
cmd = cmd + " -i"
result := ssh.ExecCommand(cmd)
resp := pbslurm.DeleteAccountResp{}
resp.Result = result
return &resp, nil
}

View File

@ -57,6 +57,7 @@ struct slurmdb_user_rec *user_from_list(struct user_info_msg *list, int i) {
import "C"
import (
pbslurm "code.gitlink.org.cn/JCCE/PCM.git/adaptor/pcm_slurm/gen/idl"
ssh "code.gitlink.org.cn/JCCE/PCM.git/common/ssh"
"context"
)
@ -117,3 +118,45 @@ func (slurmStruct SlurmStruct) GetUser(ctx context.Context, req *pbslurm.GetUser
return &resp, nil
}
func Queue() {
cli := ssh.Cli{
Addr: "25.8.2.1:22",
User: "nudt_ysz",
Pwd: "nudt_ysz",
}
// 建立连接对象
cl, _ := cli.Connect()
// 退出时关闭连接
defer cl.Client.Close()
_, err := cl.Run(`yhqueue`)
if err != nil {
print("error")
return
}
}
func (slurmStruct SlurmStruct) AddUser(ctx context.Context, req *pbslurm.AddUsersReq) (*pbslurm.AddUsersResp, error) {
cli := ssh.Cli{
Addr: "localhost:22",
User: "root",
Pwd: "123123",
}
// 建立连接对象
cl, _ := cli.Connect()
// 退出时关闭连接
defer cl.Client.Close()
cmd := "sacctmgr add user"
_, err := cl.Run(cmd)
if err != nil {
print("error")
}
resp := pbslurm.AddUsersResp{}
resp.Result = ""
return &resp, nil
}

View File

@ -12,6 +12,8 @@ type Slurmer interface {
GetAssociation(ctx context.Context, req *pbslurm.GetAssociationReq) (resp *pbslurm.GetAssociationResp, err error) //get specific slurm associations
ListAccounts(ctx context.Context, req *pbslurm.ListAccountsReq) (resp *pbslurm.ListAccountsResp, err error) //list slurm accounts
GetAccount(ctx context.Context, req *pbslurm.GetAccountReq) (resp *pbslurm.GetAccountResp, err error) //get specific slurm account
AddAccount(ctx context.Context, req *pbslurm.AddAccountReq) (resp *pbslurm.AddAccountResp, err error) //add slurm account
DeleteAccount(ctx context.Context, req *pbslurm.DeleteAccountReq) (resp *pbslurm.DeleteAccountResp, err error) //delete slurm account
ListQoss(ctx context.Context, req *pbslurm.ListQossReq) (resp *pbslurm.ListQossResp, err error) //list slurm qoss
ListWckeys(ctx context.Context, req *pbslurm.ListWckeysReq) (resp *pbslurm.ListWckeysResp, err error) //list slurm wckeys
GetWckey(ctx context.Context, req *pbslurm.GetWckeyReq) (resp *pbslurm.GetWckeyResp, err error) //list slurm wckeys

70
common/ssh/ssh_util.go Normal file
View File

@ -0,0 +1,70 @@
package ssh
import (
"fmt"
gossh "golang.org/x/crypto/ssh"
"io"
"log"
"net"
"os/exec"
)
// Cli 连接信息
type Cli struct {
User string
Pwd string
Addr string
Client *gossh.Client
Session *gossh.Session
LastResult string
}
// Connect 连接对象
func (c *Cli) Connect() (*Cli, error) {
config := &gossh.ClientConfig{}
config.SetDefaults()
config.User = c.User
config.Auth = []gossh.AuthMethod{gossh.Password(c.Pwd)}
config.HostKeyCallback = func(hostname string, remote net.Addr, key gossh.PublicKey) error { return nil }
client, err := gossh.Dial("tcp", c.Addr, config)
if nil != err {
return c, err
}
c.Client = client
return c, nil
}
// Run 执行shell
func (c Cli) Run(shell string) (string, error) {
if c.Client == nil {
if _, err := c.Connect(); err != nil {
return "", err
}
}
session, err := c.Client.NewSession()
if err != nil {
return "", err
}
// 关闭会话
defer session.Close()
buf, err := session.CombinedOutput(shell)
c.LastResult = string(buf)
return c.LastResult, err
}
func ExecCommand(strCommand string) string {
cmd := exec.Command("/bin/bash", "-c", strCommand)
stdout, _ := cmd.StdoutPipe()
errReader, _ := cmd.StderrPipe()
defer stdout.Close()
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
cmdReader := io.MultiReader(stdout, errReader)
outBytes, _ := io.ReadAll(cmdReader)
if err := cmd.Wait(); err != nil {
fmt.Println("err", err.Error())
}
return string(outBytes)
}

View File

@ -1,20 +1,22 @@
package main
import "slurm/submitjob"
import "slurm"
import (
"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"
import "fmt"
func main(){
if len(os.Args)<4 {
func main() {
if len(os.Args) < 4 {
fmt.Printf("Synthax specify JobID, qos and partition \n")
return
}
var ops submit_job.Update_job_options
id,err := strconv.Atoi(os.Args[1])
if err != nil {
fmt.Printf("Invalid job id (no int) %s\n", os.Args[1] )
id, err := strconv.Atoi(os.Args[1])
if err != nil {
fmt.Printf("Invalid job id (no int) %s\n", os.Args[1])
return
}
@ -22,7 +24,7 @@ func main(){
ops.Partition = os.Args[3]
err2 := submit_job.Update_job(ops, uint32(id))
if err2!= uint32(0) {
if err2 != uint32(0) {
fmt.Printf("error %s \n", slurm.GetErrorString(err2))
}
}