提交任务部分代码

This commit is contained in:
tzwang 2023-02-20 18:36:12 +08:00
parent f0e1b80e31
commit 844628c9b5
12 changed files with 624 additions and 25 deletions

View File

@ -27,6 +27,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/scheduleTask",
Handler: scheduleTaskHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/submitJob",
Handler: submitJobHandler(serverCtx),
},
},
)
}

View File

@ -0,0 +1,28 @@
package handler
import (
"net/http"
"PCM/adaptor/slurm/slurmCore/api/internal/logic"
"PCM/adaptor/slurm/slurmCore/api/internal/svc"
"PCM/adaptor/slurm/slurmCore/api/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func submitJobHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SubmitJobReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewSubmitJobLogic(r.Context(), svcCtx)
resp, err := l.SubmitJob(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@ -0,0 +1,52 @@
package logic
import (
"PCM/adaptor/slurm/slurmShuguang/rpc/slurmShuguang"
"PCM/common/tool"
"PCM/common/xerr"
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"PCM/adaptor/slurm/slurmCore/api/internal/svc"
"PCM/adaptor/slurm/slurmCore/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SubmitJobLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSubmitJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitJobLogic {
return &SubmitJobLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SubmitJobLogic) SubmitJob(req *types.SubmitJobReq) (resp *types.SubmitJobResp, err error) {
//coreResp := &types.SubmitJobResp{}
version := req.SlurmVersion
switch version {
case "shuguang":
shuguangReq := &slurmShuguang.SubmitJobReq{}
err = copier.CopyWithOption(shuguangReq, req, copier.Option{Converters: tool.Converters})
//shuguangResp, err := l.svcCtx.ShuguangRpc.SubmitJob(l.ctx, shuguangReq)
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to submit job to Shuguang"), "Failed to submit job to Shuguang err : %v ,req:%+v", err, req)
}
case "tianhe":
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to submit job to Tianhe"), "Failed to submit job to Tianhe err : %v ,req:%+v", err, req)
}
}
return resp, nil
}

View File

@ -173,3 +173,33 @@ type ScheduleTaskResp struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
}
type SubmitJobReq struct {
SlurmVersion string `json:"slurmVersion"`
Apptype string `json:"apptype"`
Appname string `json:"appname"`
StrJobManagerID int64 `json:"strJobManagerID"`
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo"`
}
type SubmitJobResp struct {
Job_id int32 `json:"job_id"`
Step_id int32 `json:"step_id"`
Error_code int32 `json:"error_code"`
Code string `json:"code"`
Msg string `json:"msg"`
Data string `json:"data"`
}
type MapAppJobInfo struct {
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
GAP_NNODE string `json:"GAP_NNODE"` //节点个数
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd命令行模式
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长HH:MM:ss
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE基础应用支持填写具体的应用英文名称
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
}

View File

@ -188,6 +188,38 @@ type (
}
)
type (
submitJobReq {
SlurmVersion string `json:"slurmVersion"`
Apptype string `json:"apptype"`
Appname string `json:"appname"`
StrJobManagerID int64 `json:"strJobManagerID"`
MapAppJobInfo MapAppJobInfo `json:"mapAppJobInfo"`
}
submitJobResp {
Job_id int32 `json:"job_id"`
Step_id int32 `json:"step_id"`
Error_code int32 `json:"error_code"`
Code string `json:"code"`
Msg string `json:"msg"`
Data string `json:"data"`
}
MapAppJobInfo {
GAP_CMD_FILE string `json:"GAP_CMD_FILE"` //命令行内容
GAP_NNODE string `json:"GAP_NNODE"` //节点个数
GAP_SUBMIT_TYPE string `json:"GAP_SUBMIT_TYPE"` //cmd命令行模式
GAP_JOB_NAME string `json:"GAP_JOB_NAME"` //作业名称
GAP_WORK_DIR string `json:"GAP_WORK_DIR"` //工作路径
GAP_QUEUE string `json:"GAP_QUEUE"` //队列名称
GAP_WALL_TIME string `json:"GAP_WALL_TIME"` //最大运行时长HH:MM:ss
GAP_APPNAME string `json:"GAP_APPNAME"` //BASE基础应用支持填写具体的应用英文名称
GAP_STD_OUT_FILE string `json:"GAP_STD_OUT_FILE"` //工作路径/std.out.%j
GAP_STD_ERR_FILE string `json:"GAP_STD_ERR_FILE"` //工作路径/std.err.%j
}
)
service slurmcore-api {
@handler listJobHandler
@ -199,4 +231,7 @@ service slurmcore-api {
@handler scheduleTaskHandler
post /scheduleTask (scheduleTaskReq) returns (scheduleTaskResp)
@handler submitJobHandler
get /submitJob (listHistoryJobReq) returns (listHistoryJobResp)
}

View File

@ -12,7 +12,7 @@ import (
"github.com/zeromicro/go-zero/rest"
)
var configFile = flag.String("f", "adaptor/slurm/slurmCore/api/etc/slurmcore-api.yaml", "the config file")
var configFile = flag.String("f", "C:\\Users\\admin\\Documents\\122\\jcce\\pcm\\adaptor\\slurm\\slurmCore\\api\\etc\\slurmcore-api.yaml", "the config file")
func main() {
flag.Parse()

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/adaptor/slurm/slurmShuguang/rpc/internal/svc"
"PCM/adaptor/slurm/slurmShuguang/rpc/slurmShuguang"
"github.com/zeromicro/go-zero/core/logx"
)
type SubmitJobLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewSubmitJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SubmitJobLogic {
return &SubmitJobLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *SubmitJobLogic) SubmitJob(in *slurmShuguang.SubmitJobReq) (*slurmShuguang.SubmitJobResp, error) {
// todo: add your logic here and delete this line
return &slurmShuguang.SubmitJobResp{}, nil
}

View File

@ -33,3 +33,8 @@ func (s *SlurmShuguangServer) ListHistoryJob(ctx context.Context, in *slurmShugu
l := logic.NewListHistoryJobLogic(ctx, s.svcCtx)
return l.ListHistoryJob(in)
}
func (s *SlurmShuguangServer) SubmitJob(ctx context.Context, in *slurmShuguang.SubmitJobReq) (*slurmShuguang.SubmitJobResp, error) {
l := logic.NewSubmitJobLogic(ctx, s.svcCtx)
return l.SubmitJob(in)
}

View File

@ -75,6 +75,34 @@ message ListHistoryJobResp{
}
/******************History Job End*************************/
/******************Job(Submit) Start*************************/
message SubmitJobReq{
string apptype = 1;
string appname = 2;
int64 strJobManagerID = 3;
MapAppJobInfo mapAppJobInfo = 4;
}
message SubmitJobResp{
string Code = 1;
string Msg = 2;
string Data = 3;
}
message MapAppJobInfo{
string GAP_CMD_FILE = 1; //
string GAP_NNODE = 2; //
string GAP_SUBMIT_TYPE = 3; //cmd
string GAP_JOB_NAME = 4; //
string GAP_WORK_DIR = 5; //
string GAP_QUEUE = 6; //
string GAP_WALL_TIME = 7; //HH:MM:ss
string GAP_APPNAME = 8; //BASE
string GAP_STD_OUT_FILE = 9; ///std.out.%j
string GAP_STD_ERR_FILE = 10; ///std.err.%j
}
/******************Job(Submit) End*************************/
// Slurm Services for Shuguang Branch
service SlurmShuguang {
@ -85,4 +113,6 @@ service SlurmShuguang {
//ListHistoryJob list all history jobs
rpc ListHistoryJob(ListHistoryJobReq) returns (ListHistoryJobResp);
rpc SubmitJob(SubmitJobReq) returns (SubmitJobResp);
}

View File

@ -631,6 +631,260 @@ func (x *ListHistoryJobResp) GetHistoryJobs() []*HistoryJob {
return nil
}
// *****************Job(Submit) Start************************
type SubmitJobReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Apptype string `protobuf:"bytes,1,opt,name=apptype,proto3" json:"apptype,omitempty"`
Appname string `protobuf:"bytes,2,opt,name=appname,proto3" json:"appname,omitempty"`
StrJobManagerID int64 `protobuf:"varint,3,opt,name=strJobManagerID,proto3" json:"strJobManagerID,omitempty"`
MapAppJobInfo *MapAppJobInfo `protobuf:"bytes,4,opt,name=mapAppJobInfo,proto3" json:"mapAppJobInfo,omitempty"`
}
func (x *SubmitJobReq) Reset() {
*x = SubmitJobReq{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SubmitJobReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SubmitJobReq) ProtoMessage() {}
func (x *SubmitJobReq) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_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 SubmitJobReq.ProtoReflect.Descriptor instead.
func (*SubmitJobReq) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{6}
}
func (x *SubmitJobReq) GetApptype() string {
if x != nil {
return x.Apptype
}
return ""
}
func (x *SubmitJobReq) GetAppname() string {
if x != nil {
return x.Appname
}
return ""
}
func (x *SubmitJobReq) GetStrJobManagerID() int64 {
if x != nil {
return x.StrJobManagerID
}
return 0
}
func (x *SubmitJobReq) GetMapAppJobInfo() *MapAppJobInfo {
if x != nil {
return x.MapAppJobInfo
}
return nil
}
type SubmitJobResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Code string `protobuf:"bytes,1,opt,name=Code,proto3" json:"Code,omitempty"`
Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"`
Data string `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`
}
func (x *SubmitJobResp) Reset() {
*x = SubmitJobResp{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SubmitJobResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SubmitJobResp) ProtoMessage() {}
func (x *SubmitJobResp) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_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 SubmitJobResp.ProtoReflect.Descriptor instead.
func (*SubmitJobResp) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{7}
}
func (x *SubmitJobResp) GetCode() string {
if x != nil {
return x.Code
}
return ""
}
func (x *SubmitJobResp) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
func (x *SubmitJobResp) GetData() string {
if x != nil {
return x.Data
}
return ""
}
type MapAppJobInfo struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
GAP_CMD_FILE string `protobuf:"bytes,1,opt,name=GAP_CMD_FILE,json=GAPCMDFILE,proto3" json:"GAP_CMD_FILE,omitempty"` //命令行内容
GAP_NNODE string `protobuf:"bytes,2,opt,name=GAP_NNODE,json=GAPNNODE,proto3" json:"GAP_NNODE,omitempty"` //节点个数
GAP_SUBMIT_TYPE string `protobuf:"bytes,3,opt,name=GAP_SUBMIT_TYPE,json=GAPSUBMITTYPE,proto3" json:"GAP_SUBMIT_TYPE,omitempty"` //cmd命令行模式
GAP_JOB_NAME string `protobuf:"bytes,4,opt,name=GAP_JOB_NAME,json=GAPJOBNAME,proto3" json:"GAP_JOB_NAME,omitempty"` //作业名称
GAP_WORK_DIR string `protobuf:"bytes,5,opt,name=GAP_WORK_DIR,json=GAPWORKDIR,proto3" json:"GAP_WORK_DIR,omitempty"` //工作路径
GAP_QUEUE string `protobuf:"bytes,6,opt,name=GAP_QUEUE,json=GAPQUEUE,proto3" json:"GAP_QUEUE,omitempty"` //队列名称
GAP_WALL_TIME string `protobuf:"bytes,7,opt,name=GAP_WALL_TIME,json=GAPWALLTIME,proto3" json:"GAP_WALL_TIME,omitempty"` //最大运行时长HH:MM:ss
GAP_APPNAME string `protobuf:"bytes,8,opt,name=GAP_APPNAME,json=GAPAPPNAME,proto3" json:"GAP_APPNAME,omitempty"` //BASE基础应用支持填写具体的应用英文名称
GAP_STD_OUT_FILE string `protobuf:"bytes,9,opt,name=GAP_STD_OUT_FILE,json=GAPSTDOUTFILE,proto3" json:"GAP_STD_OUT_FILE,omitempty"` //工作路径/std.out.%j
GAP_STD_ERR_FILE string `protobuf:"bytes,10,opt,name=GAP_STD_ERR_FILE,json=GAPSTDERRFILE,proto3" json:"GAP_STD_ERR_FILE,omitempty"` //工作路径/std.err.%j
}
func (x *MapAppJobInfo) Reset() {
*x = MapAppJobInfo{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *MapAppJobInfo) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*MapAppJobInfo) ProtoMessage() {}
func (x *MapAppJobInfo) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_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 MapAppJobInfo.ProtoReflect.Descriptor instead.
func (*MapAppJobInfo) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{8}
}
func (x *MapAppJobInfo) GetGAP_CMD_FILE() string {
if x != nil {
return x.GAP_CMD_FILE
}
return ""
}
func (x *MapAppJobInfo) GetGAP_NNODE() string {
if x != nil {
return x.GAP_NNODE
}
return ""
}
func (x *MapAppJobInfo) GetGAP_SUBMIT_TYPE() string {
if x != nil {
return x.GAP_SUBMIT_TYPE
}
return ""
}
func (x *MapAppJobInfo) GetGAP_JOB_NAME() string {
if x != nil {
return x.GAP_JOB_NAME
}
return ""
}
func (x *MapAppJobInfo) GetGAP_WORK_DIR() string {
if x != nil {
return x.GAP_WORK_DIR
}
return ""
}
func (x *MapAppJobInfo) GetGAP_QUEUE() string {
if x != nil {
return x.GAP_QUEUE
}
return ""
}
func (x *MapAppJobInfo) GetGAP_WALL_TIME() string {
if x != nil {
return x.GAP_WALL_TIME
}
return ""
}
func (x *MapAppJobInfo) GetGAP_APPNAME() string {
if x != nil {
return x.GAP_APPNAME
}
return ""
}
func (x *MapAppJobInfo) GetGAP_STD_OUT_FILE() string {
if x != nil {
return x.GAP_STD_OUT_FILE
}
return ""
}
func (x *MapAppJobInfo) GetGAP_STD_ERR_FILE() string {
if x != nil {
return x.GAP_STD_ERR_FILE
}
return ""
}
var File_slurmShuguang_proto protoreflect.FileDescriptor
var file_slurmShuguang_proto_rawDesc = []byte{
@ -733,19 +987,62 @@ var file_slurmShuguang_proto_rawDesc = []byte{
0x6a, 0x6f, 0x62, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x68, 0x69, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x0b, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f,
0x62, 0x73, 0x32, 0xa8, 0x01, 0x0a, 0x0d, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67,
0x75, 0x61, 0x6e, 0x67, 0x12, 0x40, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x62, 0x12,
0x19, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e,
0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4a,
0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x20, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69, 0x73,
0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x73, 0x6c, 0x75,
0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48,
0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x42, 0x10, 0x5a,
0x0e, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x62, 0x73, 0x22, 0xb0, 0x01, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62,
0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x61, 0x70, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
0x61, 0x70, 0x70, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x73, 0x74, 0x72, 0x4a, 0x6f,
0x62, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
0x52, 0x0f, 0x73, 0x74, 0x72, 0x4a, 0x6f, 0x62, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x49,
0x44, 0x12, 0x42, 0x0a, 0x0d, 0x6d, 0x61, 0x70, 0x41, 0x70, 0x70, 0x4a, 0x6f, 0x62, 0x49, 0x6e,
0x66, 0x6f, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d,
0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4d, 0x61, 0x70, 0x41, 0x70, 0x70, 0x4a,
0x6f, 0x62, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0d, 0x6d, 0x61, 0x70, 0x41, 0x70, 0x70, 0x4a, 0x6f,
0x62, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x49, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a,
0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73,
0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04,
0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61,
0x22, 0xee, 0x02, 0x0a, 0x0d, 0x4d, 0x61, 0x70, 0x41, 0x70, 0x70, 0x4a, 0x6f, 0x62, 0x49, 0x6e,
0x66, 0x6f, 0x12, 0x20, 0x0a, 0x0c, 0x47, 0x41, 0x50, 0x5f, 0x43, 0x4d, 0x44, 0x5f, 0x46, 0x49,
0x4c, 0x45, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x41, 0x50, 0x43, 0x4d, 0x44,
0x46, 0x49, 0x4c, 0x45, 0x12, 0x1b, 0x0a, 0x09, 0x47, 0x41, 0x50, 0x5f, 0x4e, 0x4e, 0x4f, 0x44,
0x45, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x47, 0x41, 0x50, 0x4e, 0x4e, 0x4f, 0x44,
0x45, 0x12, 0x26, 0x0a, 0x0f, 0x47, 0x41, 0x50, 0x5f, 0x53, 0x55, 0x42, 0x4d, 0x49, 0x54, 0x5f,
0x54, 0x59, 0x50, 0x45, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x47, 0x41, 0x50, 0x53,
0x55, 0x42, 0x4d, 0x49, 0x54, 0x54, 0x59, 0x50, 0x45, 0x12, 0x20, 0x0a, 0x0c, 0x47, 0x41, 0x50,
0x5f, 0x4a, 0x4f, 0x42, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
0x0a, 0x47, 0x41, 0x50, 0x4a, 0x4f, 0x42, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x20, 0x0a, 0x0c, 0x47,
0x41, 0x50, 0x5f, 0x57, 0x4f, 0x52, 0x4b, 0x5f, 0x44, 0x49, 0x52, 0x18, 0x05, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0a, 0x47, 0x41, 0x50, 0x57, 0x4f, 0x52, 0x4b, 0x44, 0x49, 0x52, 0x12, 0x1b, 0x0a,
0x09, 0x47, 0x41, 0x50, 0x5f, 0x51, 0x55, 0x45, 0x55, 0x45, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
0x52, 0x08, 0x47, 0x41, 0x50, 0x51, 0x55, 0x45, 0x55, 0x45, 0x12, 0x22, 0x0a, 0x0d, 0x47, 0x41,
0x50, 0x5f, 0x57, 0x41, 0x4c, 0x4c, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x18, 0x07, 0x20, 0x01, 0x28,
0x09, 0x52, 0x0b, 0x47, 0x41, 0x50, 0x57, 0x41, 0x4c, 0x4c, 0x54, 0x49, 0x4d, 0x45, 0x12, 0x1f,
0x0a, 0x0b, 0x47, 0x41, 0x50, 0x5f, 0x41, 0x50, 0x50, 0x4e, 0x41, 0x4d, 0x45, 0x18, 0x08, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0a, 0x47, 0x41, 0x50, 0x41, 0x50, 0x50, 0x4e, 0x41, 0x4d, 0x45, 0x12,
0x27, 0x0a, 0x10, 0x47, 0x41, 0x50, 0x5f, 0x53, 0x54, 0x44, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x46,
0x49, 0x4c, 0x45, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x47, 0x41, 0x50, 0x53, 0x54,
0x44, 0x4f, 0x55, 0x54, 0x46, 0x49, 0x4c, 0x45, 0x12, 0x27, 0x0a, 0x10, 0x47, 0x41, 0x50, 0x5f,
0x53, 0x54, 0x44, 0x5f, 0x45, 0x52, 0x52, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x18, 0x0a, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0d, 0x47, 0x41, 0x50, 0x53, 0x54, 0x44, 0x45, 0x52, 0x52, 0x46, 0x49, 0x4c,
0x45, 0x32, 0xf0, 0x01, 0x0a, 0x0d, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75,
0x61, 0x6e, 0x67, 0x12, 0x40, 0x0a, 0x07, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f, 0x62, 0x12, 0x19,
0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c,
0x69, 0x73, 0x74, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x1a, 0x2e, 0x73, 0x6c, 0x75, 0x72,
0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4a, 0x6f,
0x62, 0x52, 0x65, 0x73, 0x70, 0x12, 0x55, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69, 0x73,
0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x20, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53,
0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69, 0x73, 0x74,
0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x21, 0x2e, 0x73, 0x6c, 0x75, 0x72,
0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69,
0x73, 0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x12, 0x46, 0x0a, 0x09,
0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62, 0x12, 0x1b, 0x2e, 0x73, 0x6c, 0x75, 0x72,
0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74,
0x4a, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x1a, 0x1c, 0x2e, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68,
0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74, 0x4a, 0x6f, 0x62,
0x52, 0x65, 0x73, 0x70, 0x42, 0x10, 0x5a, 0x0e, 0x2f, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68,
0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -760,7 +1057,7 @@ func file_slurmShuguang_proto_rawDescGZIP() []byte {
return file_slurmShuguang_proto_rawDescData
}
var file_slurmShuguang_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_slurmShuguang_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_slurmShuguang_proto_goTypes = []interface{}{
(*Job)(nil), // 0: slurmShuguang.job
(*ListJobReq)(nil), // 1: slurmShuguang.ListJobReq
@ -768,19 +1065,25 @@ var file_slurmShuguang_proto_goTypes = []interface{}{
(*HistoryJob)(nil), // 3: slurmShuguang.historyJob
(*ListHistoryJobReq)(nil), // 4: slurmShuguang.ListHistoryJobReq
(*ListHistoryJobResp)(nil), // 5: slurmShuguang.ListHistoryJobResp
(*SubmitJobReq)(nil), // 6: slurmShuguang.SubmitJobReq
(*SubmitJobResp)(nil), // 7: slurmShuguang.SubmitJobResp
(*MapAppJobInfo)(nil), // 8: slurmShuguang.MapAppJobInfo
}
var file_slurmShuguang_proto_depIdxs = []int32{
0, // 0: slurmShuguang.ListJobResp.jobs:type_name -> slurmShuguang.job
3, // 1: slurmShuguang.ListHistoryJobResp.history_jobs:type_name -> slurmShuguang.historyJob
1, // 2: slurmShuguang.SlurmShuguang.ListJob:input_type -> slurmShuguang.ListJobReq
4, // 3: slurmShuguang.SlurmShuguang.ListHistoryJob:input_type -> slurmShuguang.ListHistoryJobReq
2, // 4: slurmShuguang.SlurmShuguang.ListJob:output_type -> slurmShuguang.ListJobResp
5, // 5: slurmShuguang.SlurmShuguang.ListHistoryJob:output_type -> slurmShuguang.ListHistoryJobResp
4, // [4:6] is the sub-list for method output_type
2, // [2:4] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
8, // 2: slurmShuguang.SubmitJobReq.mapAppJobInfo:type_name -> slurmShuguang.MapAppJobInfo
1, // 3: slurmShuguang.SlurmShuguang.ListJob:input_type -> slurmShuguang.ListJobReq
4, // 4: slurmShuguang.SlurmShuguang.ListHistoryJob:input_type -> slurmShuguang.ListHistoryJobReq
6, // 5: slurmShuguang.SlurmShuguang.SubmitJob:input_type -> slurmShuguang.SubmitJobReq
2, // 6: slurmShuguang.SlurmShuguang.ListJob:output_type -> slurmShuguang.ListJobResp
5, // 7: slurmShuguang.SlurmShuguang.ListHistoryJob:output_type -> slurmShuguang.ListHistoryJobResp
7, // 8: slurmShuguang.SlurmShuguang.SubmitJob:output_type -> slurmShuguang.SubmitJobResp
6, // [6:9] is the sub-list for method output_type
3, // [3:6] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_slurmShuguang_proto_init() }
@ -861,6 +1164,42 @@ func file_slurmShuguang_proto_init() {
return nil
}
}
file_slurmShuguang_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitJobReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_slurmShuguang_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SubmitJobResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_slurmShuguang_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*MapAppJobInfo); 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{
@ -868,7 +1207,7 @@ func file_slurmShuguang_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_slurmShuguang_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},

View File

@ -26,6 +26,7 @@ type SlurmShuguangClient interface {
ListJob(ctx context.Context, in *ListJobReq, opts ...grpc.CallOption) (*ListJobResp, error)
// ListHistoryJob list all history jobs
ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error)
SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error)
}
type slurmShuguangClient struct {
@ -54,6 +55,15 @@ func (c *slurmShuguangClient) ListHistoryJob(ctx context.Context, in *ListHistor
return out, nil
}
func (c *slurmShuguangClient) SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) {
out := new(SubmitJobResp)
err := c.cc.Invoke(ctx, "/slurmShuguang.SlurmShuguang/SubmitJob", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// SlurmShuguangServer is the server API for SlurmShuguang service.
// All implementations must embed UnimplementedSlurmShuguangServer
// for forward compatibility
@ -62,6 +72,7 @@ type SlurmShuguangServer interface {
ListJob(context.Context, *ListJobReq) (*ListJobResp, error)
// ListHistoryJob list all history jobs
ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error)
SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error)
mustEmbedUnimplementedSlurmShuguangServer()
}
@ -75,6 +86,9 @@ func (UnimplementedSlurmShuguangServer) ListJob(context.Context, *ListJobReq) (*
func (UnimplementedSlurmShuguangServer) ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListHistoryJob not implemented")
}
func (UnimplementedSlurmShuguangServer) SubmitJob(context.Context, *SubmitJobReq) (*SubmitJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method SubmitJob not implemented")
}
func (UnimplementedSlurmShuguangServer) mustEmbedUnimplementedSlurmShuguangServer() {}
// UnsafeSlurmShuguangServer may be embedded to opt out of forward compatibility for this service.
@ -124,6 +138,24 @@ func _SlurmShuguang_ListHistoryJob_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler)
}
func _SlurmShuguang_SubmitJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SubmitJobReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SlurmShuguangServer).SubmitJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/slurmShuguang.SlurmShuguang/SubmitJob",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SlurmShuguangServer).SubmitJob(ctx, req.(*SubmitJobReq))
}
return interceptor(ctx, in, info, handler)
}
// SlurmShuguang_ServiceDesc is the grpc.ServiceDesc for SlurmShuguang service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -139,6 +171,10 @@ var SlurmShuguang_ServiceDesc = grpc.ServiceDesc{
MethodName: "ListHistoryJob",
Handler: _SlurmShuguang_ListHistoryJob_Handler,
},
{
MethodName: "SubmitJob",
Handler: _SlurmShuguang_SubmitJob_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "slurmShuguang.proto",

View File

@ -19,12 +19,16 @@ type (
ListHistoryJobResp = slurmShuguang.ListHistoryJobResp
ListJobReq = slurmShuguang.ListJobReq
ListJobResp = slurmShuguang.ListJobResp
MapAppJobInfo = slurmShuguang.MapAppJobInfo
SubmitJobReq = slurmShuguang.SubmitJobReq
SubmitJobResp = slurmShuguang.SubmitJobResp
SlurmShuguang interface {
// ListJob list all jobs
ListJob(ctx context.Context, in *ListJobReq, opts ...grpc.CallOption) (*ListJobResp, error)
// ListHistoryJob list all history jobs
ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error)
SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error)
}
defaultSlurmShuguang struct {
@ -49,3 +53,8 @@ func (m *defaultSlurmShuguang) ListHistoryJob(ctx context.Context, in *ListHisto
client := slurmShuguang.NewSlurmShuguangClient(m.cli.Conn())
return client.ListHistoryJob(ctx, in, opts...)
}
func (m *defaultSlurmShuguang) SubmitJob(ctx context.Context, in *SubmitJobReq, opts ...grpc.CallOption) (*SubmitJobResp, error) {
client := slurmShuguang.NewSlurmShuguangClient(m.cli.Conn())
return client.SubmitJob(ctx, in, opts...)
}