# Conflicts: # adaptor/PCM-HPC/PCM-AC/rpc/hpcAC/hpcAC.pb.go # adaptor/PCM-HPC/PCM-AC/rpc/hpcAC/hpcAC_grpc.pb.go # adaptor/PCM-HPC/PCM-AC/rpc/hpcacclient/hpcac.go # adaptor/PCM-HPC/PCM-AC/rpc/internal/server/hpcacserver.go # adaptor/PCM-HPC/PCM-AC/rpc/pb/hpcAC.protopull/9/head
| @@ -1,7 +1,7 @@ | |||||
| // Code generated by protoc-gen-go-grpc. DO NOT EDIT. | // Code generated by protoc-gen-go-grpc. DO NOT EDIT. | ||||
| // versions: | // versions: | ||||
| // - protoc-gen-go-grpc v1.2.0 | // - protoc-gen-go-grpc v1.2.0 | ||||
| // - protoc v3.21.12 | |||||
| // - protoc v3.12.4 | |||||
| // source: hpcAC.proto | // source: hpcAC.proto | ||||
| package hpcAC | package hpcAC | ||||
| @@ -28,14 +28,8 @@ type HpcACClient interface { | |||||
| ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) | ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) | ||||
| // Submit job | // Submit job | ||||
| SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) | SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) | ||||
| // file content 查看文件内容 | |||||
| FileContent(ctx context.Context, in *FileDataReq, opts ...grpc.CallOption) (*FileContentResp, error) | |||||
| // queuenames/users/{username} 查询用户可访问队列列表 | |||||
| SelectQueueByUser(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueResp, error) | |||||
| // userquotas/queues 查询队列资源详细信息 | |||||
| QueryQueueDetails(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueDetailsResp, error) | |||||
| // /hpc/openapi/v2/userquotas/userlimit 查询用户资源限制信息 | |||||
| QueryUserQuotasLimit(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*UserQuotasLimitResp, error) | |||||
| // ListJobManager list all job managers | |||||
| ListJobManager(ctx context.Context, in *JobManagerReq, opts ...grpc.CallOption) (*ListJobManagerResp, error) | |||||
| } | } | ||||
| type hpcACClient struct { | type hpcACClient struct { | ||||
| @@ -73,36 +67,9 @@ func (c *hpcACClient) SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...g | |||||
| return out, nil | return out, nil | ||||
| } | } | ||||
| func (c *hpcACClient) FileContent(ctx context.Context, in *FileDataReq, opts ...grpc.CallOption) (*FileContentResp, error) { | |||||
| out := new(FileContentResp) | |||||
| err := c.cc.Invoke(ctx, "/hpcAC.hpcAC/FileContent", in, out, opts...) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return out, nil | |||||
| } | |||||
| func (c *hpcACClient) SelectQueueByUser(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueResp, error) { | |||||
| out := new(QueueResp) | |||||
| err := c.cc.Invoke(ctx, "/hpcAC.hpcAC/SelectQueueByUser", in, out, opts...) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return out, nil | |||||
| } | |||||
| func (c *hpcACClient) QueryQueueDetails(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueDetailsResp, error) { | |||||
| out := new(QueueDetailsResp) | |||||
| err := c.cc.Invoke(ctx, "/hpcAC.hpcAC/QueryQueueDetails", in, out, opts...) | |||||
| if err != nil { | |||||
| return nil, err | |||||
| } | |||||
| return out, nil | |||||
| } | |||||
| func (c *hpcACClient) QueryUserQuotasLimit(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*UserQuotasLimitResp, error) { | |||||
| out := new(UserQuotasLimitResp) | |||||
| err := c.cc.Invoke(ctx, "/hpcAC.hpcAC/QueryUserQuotasLimit", in, out, opts...) | |||||
| func (c *hpcACClient) ListJobManager(ctx context.Context, in *JobManagerReq, opts ...grpc.CallOption) (*ListJobManagerResp, error) { | |||||
| out := new(ListJobManagerResp) | |||||
| err := c.cc.Invoke(ctx, "/hpcAC.hpcAC/ListJobManager", in, out, opts...) | |||||
| if err != nil { | if err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| @@ -119,14 +86,8 @@ type HpcACServer interface { | |||||
| ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error) | ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error) | ||||
| // Submit job | // Submit job | ||||
| SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error) | SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error) | ||||
| // file content 查看文件内容 | |||||
| FileContent(context.Context, *FileDataReq) (*FileContentResp, error) | |||||
| // queuenames/users/{username} 查询用户可访问队列列表 | |||||
| SelectQueueByUser(context.Context, *QueueReq) (*QueueResp, error) | |||||
| // userquotas/queues 查询队列资源详细信息 | |||||
| QueryQueueDetails(context.Context, *QueueReq) (*QueueDetailsResp, error) | |||||
| // /hpc/openapi/v2/userquotas/userlimit 查询用户资源限制信息 | |||||
| QueryUserQuotasLimit(context.Context, *QueueReq) (*UserQuotasLimitResp, error) | |||||
| // ListJobManager list all job managers | |||||
| ListJobManager(context.Context, *JobManagerReq) (*ListJobManagerResp, error) | |||||
| mustEmbedUnimplementedHpcACServer() | mustEmbedUnimplementedHpcACServer() | ||||
| } | } | ||||
| @@ -143,17 +104,8 @@ func (UnimplementedHpcACServer) ListHistoryJob(context.Context, *ListHistoryJobR | |||||
| func (UnimplementedHpcACServer) SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error) { | func (UnimplementedHpcACServer) SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error) { | ||||
| return nil, status.Errorf(codes.Unimplemented, "method SubmitJob not implemented") | return nil, status.Errorf(codes.Unimplemented, "method SubmitJob not implemented") | ||||
| } | } | ||||
| func (UnimplementedHpcACServer) FileContent(context.Context, *FileDataReq) (*FileContentResp, error) { | |||||
| return nil, status.Errorf(codes.Unimplemented, "method FileContent not implemented") | |||||
| } | |||||
| func (UnimplementedHpcACServer) SelectQueueByUser(context.Context, *QueueReq) (*QueueResp, error) { | |||||
| return nil, status.Errorf(codes.Unimplemented, "method SelectQueueByUser not implemented") | |||||
| } | |||||
| func (UnimplementedHpcACServer) QueryQueueDetails(context.Context, *QueueReq) (*QueueDetailsResp, error) { | |||||
| return nil, status.Errorf(codes.Unimplemented, "method QueryQueueDetails not implemented") | |||||
| } | |||||
| func (UnimplementedHpcACServer) QueryUserQuotasLimit(context.Context, *QueueReq) (*UserQuotasLimitResp, error) { | |||||
| return nil, status.Errorf(codes.Unimplemented, "method QueryUserQuotasLimit not implemented") | |||||
| func (UnimplementedHpcACServer) ListJobManager(context.Context, *JobManagerReq) (*ListJobManagerResp, error) { | |||||
| return nil, status.Errorf(codes.Unimplemented, "method ListJobManager not implemented") | |||||
| } | } | ||||
| func (UnimplementedHpcACServer) mustEmbedUnimplementedHpcACServer() {} | func (UnimplementedHpcACServer) mustEmbedUnimplementedHpcACServer() {} | ||||
| @@ -222,74 +174,20 @@ func _HpcAC_SubmitJob_Handler(srv interface{}, ctx context.Context, dec func(int | |||||
| return interceptor(ctx, in, info, handler) | return interceptor(ctx, in, info, handler) | ||||
| } | } | ||||
| func _HpcAC_FileContent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | |||||
| in := new(FileDataReq) | |||||
| if err := dec(in); err != nil { | |||||
| return nil, err | |||||
| } | |||||
| if interceptor == nil { | |||||
| return srv.(HpcACServer).FileContent(ctx, in) | |||||
| } | |||||
| info := &grpc.UnaryServerInfo{ | |||||
| Server: srv, | |||||
| FullMethod: "/hpcAC.hpcAC/FileContent", | |||||
| } | |||||
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { | |||||
| return srv.(HpcACServer).FileContent(ctx, req.(*FileDataReq)) | |||||
| } | |||||
| return interceptor(ctx, in, info, handler) | |||||
| } | |||||
| func _HpcAC_SelectQueueByUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | |||||
| in := new(QueueReq) | |||||
| func _HpcAC_ListJobManager_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | |||||
| in := new(JobManagerReq) | |||||
| if err := dec(in); err != nil { | if err := dec(in); err != nil { | ||||
| return nil, err | return nil, err | ||||
| } | } | ||||
| if interceptor == nil { | if interceptor == nil { | ||||
| return srv.(HpcACServer).SelectQueueByUser(ctx, in) | |||||
| return srv.(HpcACServer).ListJobManager(ctx, in) | |||||
| } | } | ||||
| info := &grpc.UnaryServerInfo{ | info := &grpc.UnaryServerInfo{ | ||||
| Server: srv, | Server: srv, | ||||
| FullMethod: "/hpcAC.hpcAC/SelectQueueByUser", | |||||
| FullMethod: "/hpcAC.hpcAC/ListJobManager", | |||||
| } | } | ||||
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { | handler := func(ctx context.Context, req interface{}) (interface{}, error) { | ||||
| return srv.(HpcACServer).SelectQueueByUser(ctx, req.(*QueueReq)) | |||||
| } | |||||
| return interceptor(ctx, in, info, handler) | |||||
| } | |||||
| func _HpcAC_QueryQueueDetails_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | |||||
| in := new(QueueReq) | |||||
| if err := dec(in); err != nil { | |||||
| return nil, err | |||||
| } | |||||
| if interceptor == nil { | |||||
| return srv.(HpcACServer).QueryQueueDetails(ctx, in) | |||||
| } | |||||
| info := &grpc.UnaryServerInfo{ | |||||
| Server: srv, | |||||
| FullMethod: "/hpcAC.hpcAC/QueryQueueDetails", | |||||
| } | |||||
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { | |||||
| return srv.(HpcACServer).QueryQueueDetails(ctx, req.(*QueueReq)) | |||||
| } | |||||
| return interceptor(ctx, in, info, handler) | |||||
| } | |||||
| func _HpcAC_QueryUserQuotasLimit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { | |||||
| in := new(QueueReq) | |||||
| if err := dec(in); err != nil { | |||||
| return nil, err | |||||
| } | |||||
| if interceptor == nil { | |||||
| return srv.(HpcACServer).QueryUserQuotasLimit(ctx, in) | |||||
| } | |||||
| info := &grpc.UnaryServerInfo{ | |||||
| Server: srv, | |||||
| FullMethod: "/hpcAC.hpcAC/QueryUserQuotasLimit", | |||||
| } | |||||
| handler := func(ctx context.Context, req interface{}) (interface{}, error) { | |||||
| return srv.(HpcACServer).QueryUserQuotasLimit(ctx, req.(*QueueReq)) | |||||
| return srv.(HpcACServer).ListJobManager(ctx, req.(*JobManagerReq)) | |||||
| } | } | ||||
| return interceptor(ctx, in, info, handler) | return interceptor(ctx, in, info, handler) | ||||
| } | } | ||||
| @@ -314,20 +212,8 @@ var HpcAC_ServiceDesc = grpc.ServiceDesc{ | |||||
| Handler: _HpcAC_SubmitJob_Handler, | Handler: _HpcAC_SubmitJob_Handler, | ||||
| }, | }, | ||||
| { | { | ||||
| MethodName: "FileContent", | |||||
| Handler: _HpcAC_FileContent_Handler, | |||||
| }, | |||||
| { | |||||
| MethodName: "SelectQueueByUser", | |||||
| Handler: _HpcAC_SelectQueueByUser_Handler, | |||||
| }, | |||||
| { | |||||
| MethodName: "QueryQueueDetails", | |||||
| Handler: _HpcAC_QueryQueueDetails_Handler, | |||||
| }, | |||||
| { | |||||
| MethodName: "QueryUserQuotasLimit", | |||||
| Handler: _HpcAC_QueryUserQuotasLimit_Handler, | |||||
| MethodName: "ListJobManager", | |||||
| Handler: _HpcAC_ListJobManager_Handler, | |||||
| }, | }, | ||||
| }, | }, | ||||
| Streams: []grpc.StreamDesc{}, | Streams: []grpc.StreamDesc{}, | ||||
| @@ -13,25 +13,18 @@ import ( | |||||
| ) | ) | ||||
| type ( | type ( | ||||
| FileContentResp = hpcAC.FileContentResp | |||||
| FileDataReq = hpcAC.FileDataReq | |||||
| FileDataResp = hpcAC.FileDataResp | |||||
| HistoryJob = hpcAC.HistoryJob | |||||
| Job = hpcAC.Job | |||||
| ListHistoryJobReq = hpcAC.ListHistoryJobReq | |||||
| ListHistoryJobResp = hpcAC.ListHistoryJobResp | |||||
| ListJobReq = hpcAC.ListJobReq | |||||
| ListJobResp = hpcAC.ListJobResp | |||||
| MapAppJobInfo = hpcAC.MapAppJobInfo | |||||
| QueueData = hpcAC.QueueData | |||||
| QueueDetailsData = hpcAC.QueueDetailsData | |||||
| QueueDetailsResp = hpcAC.QueueDetailsResp | |||||
| QueueReq = hpcAC.QueueReq | |||||
| QueueResp = hpcAC.QueueResp | |||||
| SubmitJobReq = hpcAC.SubmitJobReq | |||||
| SubmitJobResp = hpcAC.SubmitJobResp | |||||
| UserQuotasLimitData = hpcAC.UserQuotasLimitData | |||||
| UserQuotasLimitResp = hpcAC.UserQuotasLimitResp | |||||
| HistoryJob = hpcAC.HistoryJob | |||||
| Job = hpcAC.Job | |||||
| JobManager = hpcAC.JobManager | |||||
| JobManagerReq = hpcAC.JobManagerReq | |||||
| ListHistoryJobReq = hpcAC.ListHistoryJobReq | |||||
| ListHistoryJobResp = hpcAC.ListHistoryJobResp | |||||
| ListJobManagerResp = hpcAC.ListJobManagerResp | |||||
| ListJobReq = hpcAC.ListJobReq | |||||
| ListJobResp = hpcAC.ListJobResp | |||||
| MapAppJobInfo = hpcAC.MapAppJobInfo | |||||
| SubmitJobReq = hpcAC.SubmitJobReq | |||||
| SubmitJobResp = hpcAC.SubmitJobResp | |||||
| HpcAC interface { | HpcAC interface { | ||||
| // ListJob list all jobs | // ListJob list all jobs | ||||
| @@ -40,14 +33,8 @@ type ( | |||||
| ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) | ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) | ||||
| // Submit job | // Submit job | ||||
| SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) | SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) | ||||
| // file content 查看文件内容 | |||||
| FileContent(ctx context.Context, in *FileDataReq, opts ...grpc.CallOption) (*FileContentResp, error) | |||||
| // queuenames/users/{username} 查询用户可访问队列列表 | |||||
| SelectQueueByUser(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueResp, error) | |||||
| // userquotas/queues 查询队列资源详细信息 | |||||
| QueryQueueDetails(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueDetailsResp, error) | |||||
| // hpc/openapi/v2/userquotas/userlimit 查询用户资源限制信息 | |||||
| QueryUserQuotasLimit(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*UserQuotasLimitResp, error) | |||||
| // ListJobManager list all job managers | |||||
| ListJobManager(ctx context.Context, in *JobManagerReq, opts ...grpc.CallOption) (*ListJobManagerResp, error) | |||||
| } | } | ||||
| defaultHpcAC struct { | defaultHpcAC struct { | ||||
| @@ -79,26 +66,8 @@ func (m *defaultHpcAC) SubmitJob(ctx context.Context, in *SubmitJobReq, opts ... | |||||
| return client.SubmitJob(ctx, in, opts...) | return client.SubmitJob(ctx, in, opts...) | ||||
| } | } | ||||
| // file content 查看文件内容 | |||||
| func (m *defaultHpcAC) FileContent(ctx context.Context, in *FileDataReq, opts ...grpc.CallOption) (*FileContentResp, error) { | |||||
| // ListJobManager list all job managers | |||||
| func (m *defaultHpcAC) ListJobManager(ctx context.Context, in *JobManagerReq, opts ...grpc.CallOption) (*ListJobManagerResp, error) { | |||||
| client := hpcAC.NewHpcACClient(m.cli.Conn()) | client := hpcAC.NewHpcACClient(m.cli.Conn()) | ||||
| return client.FileContent(ctx, in, opts...) | |||||
| } | |||||
| // queuenames/users/{username} 查询用户可访问队列列表 | |||||
| func (m *defaultHpcAC) SelectQueueByUser(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueResp, error) { | |||||
| client := hpcAC.NewHpcACClient(m.cli.Conn()) | |||||
| return client.SelectQueueByUser(ctx, in, opts...) | |||||
| } | |||||
| // userquotas/queues 查询队列资源详细信息 | |||||
| func (m *defaultHpcAC) QueryQueueDetails(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*QueueDetailsResp, error) { | |||||
| client := hpcAC.NewHpcACClient(m.cli.Conn()) | |||||
| return client.QueryQueueDetails(ctx, in, opts...) | |||||
| } | |||||
| // hpc/openapi/v2/userquotas/userlimit 查询用户资源限制信息 | |||||
| func (m *defaultHpcAC) QueryUserQuotasLimit(ctx context.Context, in *QueueReq, opts ...grpc.CallOption) (*UserQuotasLimitResp, error) { | |||||
| client := hpcAC.NewHpcACClient(m.cli.Conn()) | |||||
| return client.QueryUserQuotasLimit(ctx, in, opts...) | |||||
| return client.ListJobManager(ctx, in, opts...) | |||||
| } | } | ||||
| @@ -0,0 +1,74 @@ | |||||
| package logic | |||||
| import ( | |||||
| "context" | |||||
| "encoding/json" | |||||
| "io" | |||||
| "log" | |||||
| "net/http" | |||||
| "time" | |||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/hpcAC" | |||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/svc" | |||||
| "PCM/adaptor/PCM-HPC/PCM-AC/rpc/internal/util" | |||||
| "github.com/zeromicro/go-zero/core/logx" | |||||
| ) | |||||
| type ListJobManagerLogic struct { | |||||
| ctx context.Context | |||||
| svcCtx *svc.ServiceContext | |||||
| logx.Logger | |||||
| } | |||||
| func NewListJobManagerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListJobManagerLogic { | |||||
| return &ListJobManagerLogic{ | |||||
| ctx: ctx, | |||||
| svcCtx: svcCtx, | |||||
| Logger: logx.WithContext(ctx), | |||||
| } | |||||
| } | |||||
| // ListJobManager list all job managers | |||||
| func (l *ListJobManagerLogic) ListJobManager(in *hpcAC.JobManagerReq) (*hpcAC.ListJobManagerResp, error) { | |||||
| // todo: add your logic here and delete this line | |||||
| var resp hpcAC.ListJobManagerResp | |||||
| jobHistoryUrl := "hpc/openapi/v2/cluster" | |||||
| Gtoken := util.GetToken() | |||||
| c := http.Client{Timeout: time.Duration(3) * time.Second} | |||||
| reqUrl, err := http.NewRequest("GET", "https://api01.hpccube.com:65106/"+jobHistoryUrl, nil) | |||||
| if err != nil { | |||||
| log.Fatal(err) | |||||
| } | |||||
| var token string | |||||
| if util.GetTokenState(Gtoken) { | |||||
| token = Gtoken | |||||
| } else { | |||||
| token = util.GetToken() | |||||
| Gtoken = token | |||||
| } | |||||
| reqUrl.Header.Add("token", token) | |||||
| respUrl, err := c.Do(reqUrl) | |||||
| if err != nil { | |||||
| log.Fatal(err) | |||||
| } | |||||
| body, err := io.ReadAll(respUrl.Body) | |||||
| if err != nil { | |||||
| log.Fatal(err) | |||||
| } | |||||
| if err = json.Unmarshal(body, &resp); err != nil { | |||||
| log.Fatal(err) | |||||
| } | |||||
| return &resp, nil | |||||
| } | |||||
| @@ -40,26 +40,8 @@ func (s *HpcACServer) SubmitJob(ctx context.Context, in *hpcAC.SubmitJobReq) (*h | |||||
| return l.SubmitJob(in) | return l.SubmitJob(in) | ||||
| } | } | ||||
| // file content 查看文件内容 | |||||
| func (s *HpcACServer) FileContent(ctx context.Context, in *hpcAC.FileDataReq) (*hpcAC.FileContentResp, error) { | |||||
| l := logic.NewFileContentLogic(ctx, s.svcCtx) | |||||
| return l.FileContent(in) | |||||
| } | |||||
| // queuenames/users/{username} 查询用户可访问队列列表 | |||||
| func (s *HpcACServer) SelectQueueByUser(ctx context.Context, in *hpcAC.QueueReq) (*hpcAC.QueueResp, error) { | |||||
| l := logic.NewSelectQueueByUserLogic(ctx, s.svcCtx) | |||||
| return l.SelectQueueByUser(in) | |||||
| } | |||||
| // userquotas/queues 查询队列资源详细信息 | |||||
| func (s *HpcACServer) QueryQueueDetails(ctx context.Context, in *hpcAC.QueueReq) (*hpcAC.QueueDetailsResp, error) { | |||||
| l := logic.NewQueryQueueDetailsLogic(ctx, s.svcCtx) | |||||
| return l.QueryQueueDetails(in) | |||||
| } | |||||
| // hpc/openapi/v2/userquotas/userlimit 查询用户资源限制信息 | |||||
| func (s *HpcACServer) QueryUserQuotasLimit(ctx context.Context, in *hpcAC.QueueReq) (*hpcAC.UserQuotasLimitResp, error) { | |||||
| l := logic.NewQueryUserQuotasLimitLogic(ctx, s.svcCtx) | |||||
| return l.QueryUserQuotasLimit(in) | |||||
| // ListJobManager list all job managers | |||||
| func (s *HpcACServer) ListJobManager(ctx context.Context, in *hpcAC.JobManagerReq) (*hpcAC.ListJobManagerResp, error) { | |||||
| l := logic.NewListJobManagerLogic(ctx, s.svcCtx) | |||||
| return l.ListJobManager(in) | |||||
| } | } | ||||
| @@ -3,73 +3,90 @@ syntax = "proto3"; | |||||
| package hpcAC; | package hpcAC; | ||||
| option go_package = "/hpcAC"; | option go_package = "/hpcAC"; | ||||
| /******************cluster Start*************************/ | |||||
| message JobManager{ | |||||
| string job_manager_type = 1; // @gotags: copier:"JobManagerType", json:"JobManagerType" | |||||
| string job_manager_addr = 2; // @gotags: copier:"JobManagerAddr", json:"JobManagerAddr" | |||||
| int64 id = 3; // @gotags: copier:"ID", json:"id" | |||||
| string text = 4; // @gotags: copier:"Text", json:"text" | |||||
| string job_manager_port = 5; // @gotags: copier:"JobManagerPort", json:"JobManagerPort" | |||||
| } | |||||
| message JobManagerReq{ | |||||
| } | |||||
| message ListJobManagerResp{ | |||||
| string code = 1; // @gotags: copier:"Code", json:"code" | |||||
| string msg = 2; // @gotags: copier:"Msg", json:"msg" | |||||
| repeated JobManager job_managers = 3; // @gotags: copier:"JobManagers", json:"data" | |||||
| } | |||||
| /******************cluster End*************************/ | |||||
| /******************Job Start*************************/ | /******************Job Start*************************/ | ||||
| message job{ | message job{ | ||||
| string job_id = 1; // @gotags: copier:"JobId" | |||||
| string job_name = 2; // @gotags: copier:"Name" | |||||
| string job_status = 3; // @gotags: copier:"JobState" | |||||
| string queue = 4; // @gotags: copier:"Partition" | |||||
| string user = 5; // @gotags: copier:"UserId" | |||||
| string node_used = 6; // @gotags: copier:"ExcNodes" | |||||
| int32 proc_num_used = 7; // @gotags: copier:"NumCpus" | |||||
| string job_start_time = 8; // @gotags: copier:"StartTime" | |||||
| string job_run_time = 9; // @gotags: copier:"JobRunTime" | |||||
| string job_manager_id = 10; // @gotags: copier:"JobmanagerId" | |||||
| string job_id = 1; // @gotags: copier:"JobId" | |||||
| string job_name = 2; // @gotags: copier:"Name" | |||||
| string job_status = 3; // @gotags: copier:"JobState" | |||||
| string queue = 4; // @gotags: copier:"Partition" | |||||
| string user = 5; // @gotags: copier:"UserId" | |||||
| string node_used = 6; // @gotags: copier:"ExcNodes" | |||||
| int32 proc_num_used = 7; // @gotags: copier:"NumCpus" | |||||
| string job_start_time = 8; // @gotags: copier:"StartTime" | |||||
| string job_run_time = 9; // @gotags: copier:"JobRunTime" | |||||
| string job_manager_id = 10; // @gotags: copier:"JobmanagerId" | |||||
| string job_manager_name = 11; // @gotags: copier:"JobmanagerName" | string job_manager_name = 11; // @gotags: copier:"JobmanagerName" | ||||
| string job_manager_type = 12; // @gotags: copier:"JobmanagerType" | string job_manager_type = 12; // @gotags: copier:"JobmanagerType" | ||||
| string error_path = 13; // @gotags: copier:"ErrorPath" | |||||
| string output_path = 14; // @gotags: copier:"OutputPath" | |||||
| string work_dir = 15; // @gotags: copier:"WorkDir" | |||||
| string reason = 16; // @gotags: copier:"Reason" | |||||
| string app_type = 17; // @gotags: copier:"AppType" | |||||
| string error_path = 13; // @gotags: copier:"ErrorPath" | |||||
| string output_path = 14; // @gotags: copier:"OutputPath" | |||||
| string work_dir = 15; // @gotags: copier:"WorkDir" | |||||
| string reason = 16; // @gotags: copier:"Reason" | |||||
| string app_type = 17; // @gotags: copier:"AppType" | |||||
| } | } | ||||
| message ListJobReq{ | message ListJobReq{ | ||||
| } | } | ||||
| message ListJobResp{ | message ListJobResp{ | ||||
| uint32 code = 1; // @gotags: copier:"Code" | |||||
| string msg = 2; // @gotags: copier:"Msg" | |||||
| uint32 code = 1; // @gotags: copier:"Code" | |||||
| string msg = 2; // @gotags: copier:"Msg" | |||||
| uint32 record_count = 3; // @gotags: copier:"RecordCount" | uint32 record_count = 3; // @gotags: copier:"RecordCount" | ||||
| repeated job jobs = 4; // @gotags: copier:"Jobs" | |||||
| repeated job jobs = 4; // @gotags: copier:"Jobs" | |||||
| } | } | ||||
| /******************Job End*************************/ | /******************Job End*************************/ | ||||
| /******************History Job Start*************************/ | /******************History Job Start*************************/ | ||||
| message historyJob{ | message historyJob{ | ||||
| string acct_time = 1; // @gotags: copier:"AcctTime" | |||||
| string app_type = 2; // @gotags: copier:"AppType" | |||||
| string job_end_time = 3; // @gotags: copier:"End" | |||||
| string job_exec_host = 4; // @gotags: copier:"Nodes" | |||||
| int32 job_exit_status = 5; // @gotags: copier:"ExitCode" | |||||
| int64 job_id = 6; // @gotags: copier:"JobId" | |||||
| string job_name = 7; // @gotags: copier:"JobName" | |||||
| string job_queue_time = 8; // @gotags: copier:"JobQueueTime" | |||||
| string job_start_time = 9; // @gotags: copier:"Start" | |||||
| string job_state = 10; // @gotags: copier:"State" | |||||
| string acct_time = 1; // @gotags: copier:"AcctTime" | |||||
| string app_type = 2; // @gotags: copier:"AppType" | |||||
| string job_end_time = 3; // @gotags: copier:"End" | |||||
| string job_exec_host = 4; // @gotags: copier:"Nodes" | |||||
| int32 job_exit_status = 5; // @gotags: copier:"ExitCode" | |||||
| int64 job_id = 6; // @gotags: copier:"JobId" | |||||
| string job_name = 7; // @gotags: copier:"JobName" | |||||
| string job_queue_time = 8; // @gotags: copier:"JobQueueTime" | |||||
| string job_start_time = 9; // @gotags: copier:"Start" | |||||
| string job_state = 10; // @gotags: copier:"State" | |||||
| string job_walltime_used = 11; // @gotags: copier:"JobWalltimeUsed" | string job_walltime_used = 11; // @gotags: copier:"JobWalltimeUsed" | ||||
| int64 job_manager_id = 12; // @gotags: copier:"JobManagerId" | |||||
| int32 node_ct = 13; // @gotags: copier:"AllocNodes" | |||||
| string queue = 14; // @gotags: copier:"Partition" | |||||
| string user_name = 15; // @gotags: copier:"User" | |||||
| string workdir = 16; // @gotags: copier:"WorkDir" | |||||
| int64 job_manager_id = 12; // @gotags: copier:"JobManagerId" | |||||
| int32 node_ct = 13; // @gotags: copier:"AllocNodes" | |||||
| string queue = 14; // @gotags: copier:"Partition" | |||||
| string user_name = 15; // @gotags: copier:"User" | |||||
| string workdir = 16; // @gotags: copier:"WorkDir" | |||||
| } | } | ||||
| message ListHistoryJobReq{ | message ListHistoryJobReq{ | ||||
| string startTime = 1;// @gotags: copier:"StartTime" | |||||
| string endTime = 2;// @gotags: copier:"EndTime" | |||||
| string timeType = 3;// @gotags: copier:"TimeType" | |||||
| int32 start = 4;// @gotags: copier:"Start" | |||||
| int32 limit = 5;// @gotags: copier:"Limit" | |||||
| string startTime = 1;// @gotags: copier:"StartTime" | |||||
| string endTime = 2;// @gotags: copier:"EndTime" | |||||
| string timeType = 3;// @gotags: copier:"TimeType" | |||||
| int32 start = 4;// @gotags: copier:"Start" | |||||
| int32 limit = 5;// @gotags: copier:"Limit" | |||||
| int32 isQueryByQueueTime = 6;// @gotags: copier:"IsQueryByQueueTime" | int32 isQueryByQueueTime = 6;// @gotags: copier:"IsQueryByQueueTime" | ||||
| } | } | ||||
| message ListHistoryJobResp{ | message ListHistoryJobResp{ | ||||
| uint32 code = 1; // @gotags: copier:"Code" | |||||
| string msg = 2; // @gotags: copier:"Msg" | |||||
| uint32 code = 1; // @gotags: copier:"Code" | |||||
| string msg = 2; // @gotags: copier:"Msg" | |||||
| uint32 record_count = 3; // @gotags: copier:"RecordCount" | uint32 record_count = 3; // @gotags: copier:"RecordCount" | ||||
| repeated historyJob history_jobs = 4; // @gotags: copier:"HistoryJobs" | repeated historyJob history_jobs = 4; // @gotags: copier:"HistoryJobs" | ||||
| } | } | ||||
| @@ -228,6 +245,8 @@ service hpcAC { | |||||
| //Submit job | //Submit job | ||||
| rpc SubmitJob(SubmitJobReq) returns (SubmitJobResp); | rpc SubmitJob(SubmitJobReq) returns (SubmitJobResp); | ||||
| // ListJobManager list all job managers | |||||
| rpc ListJobManager(JobManagerReq) returns (ListJobManagerResp); | |||||
| //file content 查看文件内容 | //file content 查看文件内容 | ||||
| rpc FileContent(FileDataReq) returns (FileContentResp); | rpc FileContent(FileDataReq) returns (FileContentResp); | ||||