This commit is contained in:
450705171@qq.com 2023-02-09 21:49:35 +08:00
parent 912d4ac03c
commit 3fb2fc751a
20 changed files with 2722 additions and 53 deletions

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

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

View File

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

View File

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

View File

@ -0,0 +1,32 @@
// Code generated by goctl. DO NOT EDIT.
package handler
import (
"net/http"
"PCM/app/slurm/slurmCore/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/listDomain",
Handler: ListDomainHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/getDomainSummary",
Handler: GetDomainSummaryHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/listHistoryJob",
Handler: listHistoryJobHandler(serverCtx),
},
},
)
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/app/slurm/slurmCore/api/internal/svc"
"PCM/app/slurm/slurmCore/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type GetDomainSummaryLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewGetDomainSummaryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetDomainSummaryLogic {
return &GetDomainSummaryLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *GetDomainSummaryLogic) GetDomainSummary(req *types.GetDomainSummaryReq) (resp *types.GetDomainSummaryResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"PCM/app/slurm/slurmCore/api/internal/svc"
"PCM/app/slurm/slurmCore/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type ListDomainLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewListDomainLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListDomainLogic {
return &ListDomainLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ListDomainLogic) ListDomain(req *types.ListDomainReq) (resp *types.ListDomainResp, err error) {
// todo: add your logic here and delete this line
return
}

View File

@ -0,0 +1,39 @@
package logic
import (
"PCM/app/slurm/slurmShuguang/rpc/slurmShuguang"
"PCM/common/xerr"
"context"
"github.com/jinzhu/copier"
"github.com/pkg/errors"
"PCM/app/slurm/slurmCore/api/internal/svc"
"PCM/app/slurm/slurmCore/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type ListHistoryJobLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewListHistoryJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListHistoryJobLogic {
return &ListHistoryJobLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ListHistoryJobLogic) ListHistoryJob(req *types.ListHistoryJobReq) (resp *types.ListHistoryJobResp, err error) {
listDbJobsResp, err := l.svcCtx.ShuguangRpc.ListHistoryJob(l.ctx, &slurmShuguang.ListHistoryJobReq{})
if err != nil {
return nil, errors.Wrapf(xerr.NewErrMsg("Failed to get db job list"), "Failed to get db job list err : %v ,req:%+v", err, req)
}
copier.Copy(resp, &listDbJobsResp)
return resp, nil
}

View File

@ -0,0 +1,94 @@
// Code generated by goctl. DO NOT EDIT.
package types
type Domain struct {
DomainName string `json:"domainName"`
SoftStack string `json:"softStack"`
SlurmNum int32 `json:"slurmNum"`
InterfaceCount int32 `json:"interfaceCount"`
RunningJobs int32 `json:"runningJobs"`
}
type DomainSummary struct {
DomainCount int32 `json:"domainCount"`
SoftStackCount int32 `json:"softStackCount"`
}
type HistoryJob struct {
SlurmVersion string `json:"slurmVersion" copier:"SlurmVersion"`
AllocCPU uint32 `json:"allocCPU" copier:"AllocCPU"`
AllocNodes uint32 `json:"allocNodes" copier:"AllocNodes"` //Nodect 分配的节点数 in shuguang
Account string `json:"account" copier:"Account"`
AssocId uint32 `json:"assocId" copier:"AssocId"`
BlockId string `json:"blockId" copier:"BlockId"`
Cluster string `json:"cluster" copier:"Cluster"`
DerivedEc uint32 `json:"derivedEc" copier:"DerivedEc"`
DerivedEs string `json:"derivedEs" copier:"DerivedEs"`
Elapsed uint32 `json:"elapsed" copier:"Elapsed"`
Eligible int64 `json:"eligible" copier:"Eligible"`
End int64 `json:"end" copier:"End"` //JobEndTime 作业结束时间 in shuguang
ExitCode uint32 `json:"exitCode" copier:"ExitCode"` //JobExitStatus 作业退出码 in shuguang
Gid uint32 `json:"gid" copier:"Gid"`
JobId uint32 `json:"jobId" copier:"JobId"` //JobId in shuguang
JobName string `json:"jobName" copier:"JobName"` //JobName in shuguang
Lft uint32 `json:"lft" copier:"Lft"`
Partition string `json:"partition" copier:"Partition"` //Queue 队列名 in shuguang
Nodes string `json:"nodes" copier:"Nodes"` //JobExecHost 作业执行节点 in shuguang
Priority uint32 `json:"priority" copier:"Priority"`
Qosid uint32 `json:"qosid" copier:"Qosid"`
ReqCpus uint32 `json:"reqCpus" copier:"ReqCpus"`
ReqMem uint32 `json:"reqMem" copier:"ReqMem"`
Requid uint32 `json:"requid" copier:"Requid"`
Resvid uint32 `json:"resvid" copier:"Resvid"`
ShowFull uint32 `json:"showFull" copier:"ShowFull"`
Start int64 `json:"start" copier:"Start"` //JobStartTime 作业启动时间 in shuguang
State uint32 `json:"state" copier:"State"` //JobState 作业状态 in shuguang
Submit int64 `json:"submit" copier:"Submit"`
Suspended uint32 `json:"suspended" copier:"Suspended"`
SysCpuSec uint32 `json:"sysCpuSec" copier:"SysCpuSec"`
SysCpuUsec uint32 `json:"sysCpuUsec" copier:"SysCpuUsec"`
Timelimit uint32 `json:"timelimit" copier:"Timelimit"`
TotCpuSec uint32 `json:"totCpuSec" copier:"TotCpuSec"`
TotCpuUsec uint32 `json:"totCpuUsec" copier:"TotCpuUsec"`
TrackSteps uint32 `json:"trackSteps" copier:"TrackSteps"`
Uid uint32 `json:"uid" copier:"Uid"`
User string `json:"user" copier:"User"` //UserName 用户名 in shuguang
UserCpuSec uint32 `json:"userCpuSec" copier:"UserCpuSec"`
UserCpuUsec uint32 `json:"userCpuUsec" copier:"UserCpuUsec"`
Wckey string `json:"wckey" copier:"Wckey"`
Wckeyid uint32 `json:"wckeyid" copier:"Wckeyid"`
WorkDir string `json:"workDir" copier:"WorkDir"` //Workdir 工作空间 in shuguang
AcctTime string `json:"acctTime" copier:"AcctTime"` // 记账时间
AppType string `json:"appType" copier:"AppType"` // 作业应用类型
JobQueueTime string `json:"jobQueueTime" copier:"JobQueueTime"` //作业入队列时间
JobWalltimeUsed string `json:"jobWalltimeUsed" copier:"JobWalltimeUs"` //作业实际使用的Walltime,单位为秒
JobManagerId int `json:"jobmanagerId" copier:"JobManagerId"` //区域id
}
type ListDomainReq struct {
}
type ListDomainResp struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
Domains []Domain `json:"domains"`
}
type GetDomainSummaryReq struct {
}
type GetDomainSummaryResp struct {
Code int32 `json:"code"`
Msg string `json:"msg"`
DomainSummary DomainSummary `json:"domainSummary"`
}
type ListHistoryJobReq struct {
}
type ListHistoryJobResp struct {
Code int32 `json:"code" copier:"Code"`
Msg string `json:"msg" copier:"Msg"`
RecordCount int32 `json:"record_count" copier:"RecordCount"`
HistoryJobs []HistoryJob `json:"history_jobs" copier:"HistoryJobs"`
}

View File

@ -21,56 +21,55 @@ type DomainSummary {
}
type HistoryJob {
SlurmVersion string `json:"slurmVersion"`
AllocCPU uint32 `json:"allocCPU"`
AllocNodes uint32 `json:"allocNodes"` //Nodect 分配的节点数 in shuguang
Account string `json:"account"`
AssocId uint32 `json:"assocId"`
BlockId string `json:"blockId"`
Cluster string `json:"cluster"`
DerivedEc uint32 `json:"derivedEc"`
DerivedEs string `json:"derivedEs"`
Elapsed uint32 `json:"elapsed"`
Eligible int64 `json:"eligible"`
End int64 `json:"end"` //JobEndTime 作业结束时间 in shuguang
ExitCode uint32 `json:"exitCode"` //JobExitStatus 作业退出码 in shuguang
Gid uint32 `json:"gid"`
JobId uint32 `json:"jobId"` //JobId in shuguang
JobName string `json:"jobName"` //JobName in shuguang
Lft uint32 `json:"lft"`
Partition string `json:"partition"` //Queue 队列名 in shuguang
Nodes string `json:"nodes"` //JobExecHost 作业执行节点 in shuguang
Priority uint32 `json:"priority"`
Qosid uint32 `json:"qosid"`
ReqCpus uint32 `json:"reqCpus"`
ReqMem uint32 `json:"reqMem"`
Requid uint32 `json:"requid"`
Resvid uint32 `json:"resvid"`
ShowFull uint32 `json:"showFull"`
Start int64 `json:"start"` //JobStartTime 作业启动时间 in shuguang
State uint32 `json:"state"` //JobState 作业状态 in shuguang
Submit int64 `json:"submit"`
Suspended uint32 `json:"suspended"`
SysCpuSec uint32 `json:"sysCpuSec"`
SysCpuUsec uint32 `json:"sysCpuUsec"`
Timelimit uint32 `json:"timelimit"`
TotCpuSec uint32 `json:"totCpuSec"`
TotCpuUsec uint32 `json:"totCpuUsec"`
TrackSteps uint32 `json:"trackSteps"`
Uid uint32 `json:"uid"`
User string `json:"user"` //UserName 用户名 in shuguang
UserCpuSec uint32 `json:"userCpuSec"`
UserCpuUsec uint32 `json:"userCpuUsec"`
Wckey string `json:"wckey"`
Wckeyid uint32 `json:"wckeyid"`
WorkDir string `json:"workDir"` //Workdir 工作空间 in shuguang
SlurmVersion string `json:"slurmVersion" copier:"SlurmVersion"`
AllocCPU uint32 `json:"allocCPU" copier:"AllocCPU"`
AllocNodes uint32 `json:"allocNodes" copier:"AllocNodes"` //Nodect 分配的节点数 in shuguang
Account string `json:"account" copier:"Account"`
AssocId uint32 `json:"assocId" copier:"AssocId"`
BlockId string `json:"blockId" copier:"BlockId"`
Cluster string `json:"cluster" copier:"Cluster"`
DerivedEc uint32 `json:"derivedEc" copier:"DerivedEc"`
DerivedEs string `json:"derivedEs" copier:"DerivedEs"`
Elapsed uint32 `json:"elapsed" copier:"Elapsed"`
Eligible int64 `json:"eligible" copier:"Eligible"`
End int64 `json:"end" copier:"End"` //JobEndTime 作业结束时间 in shuguang
ExitCode uint32 `json:"exitCode" copier:"ExitCode"` //JobExitStatus 作业退出码 in shuguang
Gid uint32 `json:"gid" copier:"Gid"`
JobId uint32 `json:"jobId" copier:"JobId"` //JobId in shuguang
JobName string `json:"jobName" copier:"JobName"` //JobName in shuguang
Lft uint32 `json:"lft" copier:"Lft"`
Partition string `json:"partition" copier:"Partition"` //Queue 队列名 in shuguang
Nodes string `json:"nodes" copier:"Nodes"` //JobExecHost 作业执行节点 in shuguang
Priority uint32 `json:"priority" copier:"Priority"`
Qosid uint32 `json:"qosid" copier:"Qosid"`
ReqCpus uint32 `json:"reqCpus" copier:"ReqCpus"`
ReqMem uint32 `json:"reqMem" copier:"ReqMem"`
Requid uint32 `json:"requid" copier:"Requid"`
Resvid uint32 `json:"resvid" copier:"Resvid"`
ShowFull uint32 `json:"showFull" copier:"ShowFull"`
Start int64 `json:"start" copier:"Start"` //JobStartTime 作业启动时间 in shuguang
State uint32 `json:"state" copier:"State"` //JobState 作业状态 in shuguang
Submit int64 `json:"submit" copier:"Submit"`
Suspended uint32 `json:"suspended" copier:"Suspended"`
SysCpuSec uint32 `json:"sysCpuSec" copier:"SysCpuSec"`
SysCpuUsec uint32 `json:"sysCpuUsec" copier:"SysCpuUsec"`
Timelimit uint32 `json:"timelimit" copier:"Timelimit"`
TotCpuSec uint32 `json:"totCpuSec" copier:"TotCpuSec"`
TotCpuUsec uint32 `json:"totCpuUsec" copier:"TotCpuUsec"`
TrackSteps uint32 `json:"trackSteps" copier:"TrackSteps"`
Uid uint32 `json:"uid" copier:"Uid"`
User string `json:"user" copier:"User"` //UserName 用户名 in shuguang
UserCpuSec uint32 `json:"userCpuSec" copier:"UserCpuSec"`
UserCpuUsec uint32 `json:"userCpuUsec" copier:"UserCpuUsec"`
Wckey string `json:"wckey" copier:"Wckey"`
Wckeyid uint32 `json:"wckeyid" copier:"Wckeyid"`
WorkDir string `json:"workDir" copier:"WorkDir"` //Workdir 工作空间 in shuguang
/****************parmas from shuguang********************/
AcctTime string `json:"acctTime"` // 记账时间
AppType string `json:"appType"` // 作业应用类型
JobQueueTime string `json:"jobQueueTime"` //作业入队列时间
JobWalltimeUsed string `json:"jobWalltimeUsed"` //作业实际使用的Walltime,单位为秒
JobManagerId int `json:"jobmanagerId"` //区域id
AcctTime string `json:"acctTime" copier:"AcctTime"` // 记账时间
AppType string `json:"appType" copier:"AppType"` // 作业应用类型
JobQueueTime string `json:"jobQueueTime" copier:"JobQueueTime"` //作业入队列时间
JobWalltimeUsed string `json:"jobWalltimeUsed" copier:"JobWalltimeUs"` //作业实际使用的Walltime,单位为秒
JobManagerId int `json:"jobmanagerId" copier:"JobManagerId"` //区域id
/****************parmas from shuguang********************/
}
@ -100,10 +99,10 @@ type (
listHistoryJobReq {
}
listHistoryJobResp {
Code int32 `json:"code"`
Msg string `json:"msg"`
RecordCount int32 `json:"recordCount"`
HistoryJobs []HistoryJob `json:"historyJobs"`
Code int32 `json:"code" copier:"Code"`
Msg string `json:"msg" copier:"Msg"`
RecordCount int32 `json:"record_count" copier:"RecordCount"`
HistoryJobs []HistoryJob `json:"history_jobs" copier:"HistoryJobs"`
}
)

View File

@ -0,0 +1,121 @@
package logic
import (
"PCM/app/slurm/slurmShuguang/rpc/internal/util"
"context"
"io/ioutil"
"log"
"net/http"
"net/url"
"strconv"
"time"
"PCM/app/slurm/slurmShuguang/rpc/internal/svc"
"PCM/app/slurm/slurmShuguang/rpc/slurmShuguang"
"github.com/bitly/go-simplejson"
"github.com/zeromicro/go-zero/core/logx"
)
type ListHistoryJobLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewListHistoryJobLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListHistoryJobLogic {
return &ListHistoryJobLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
// ListHistoryJob list all jobs from slurmdb
func (l *ListHistoryJobLogic) ListHistoryJob(in *slurmShuguang.ListHistoryJobReq) (*slurmShuguang.ListHistoryJobResp, error) {
//tokenUrl := l.svcCtx.Config.TokenUrl
//stateUrl = l.svcCtx.Config.StateUrl
//clusterUrl = l.svcCtx.Config.ClusterUrl
var resp slurmShuguang.ListHistoryJobResp
jobHistoryUrl := "hpc/openapi/v2/historyjobs?"
ClusterId := util.GetClusterId()
Gtoken := util.GetToken()
c := http.Client{Timeout: time.Duration(3) * time.Second}
params := url.Values{}
params.Add("strClusterNameList", strconv.FormatInt(int64(ClusterId), 10))
params.Add("startTime", "2022-11-23 01:01:01")
currentTime := time.Now()
params.Add("endTime", currentTime.Format("2006-01-02 15:04:05"))
params.Add("timeType", "CUSTOM")
params.Add("start", strconv.FormatInt(0, 10))
params.Add("limit", strconv.FormatInt(25, 10))
params.Add("isQueryByQueueTime", "false")
params.Add("strUser", l.svcCtx.Config.ShuguangConf.User)
reqUrl, err := http.NewRequest("GET", "https://api01.hpccube.com:65106/"+jobHistoryUrl+params.Encode(), 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 := ioutil.ReadAll(respUrl.Body)
jsonResult, err := simplejson.NewJson(body)
jsonData := jsonResult.Get("data")
jobHistoryList := jsonResult.Get("data").Get("list")
rows, err := jobHistoryList.Array()
if err != nil {
log.Fatal(err)
}
defer respUrl.Body.Close()
var historyJobs []*slurmShuguang.HistoryJob
for index, _ := range rows {
jobShuguang := jobHistoryList.GetIndex(index)
var job slurmShuguang.HistoryJob
job.JobId = int32(jobShuguang.Get("jobId").MustInt())
job.JobName = jobShuguang.Get("JobName").MustString()
job.Workdir = jobShuguang.Get("workdir").MustString()
job.JobState = jobShuguang.Get("jobState").MustString()
startTime, err := time.Parse(l.svcCtx.Config.ShuguangConf.Layout, jobShuguang.Get("jobStartTime").MustString())
if err == nil {
job.JobStartTime = startTime.String()
}
endTime, err := time.Parse(l.svcCtx.Config.ShuguangConf.Layout, jobShuguang.Get("jobEndTime").MustString())
if err == nil {
job.JobEndTime = endTime.String()
}
historyJobs = append(historyJobs, &job)
}
if jsonResult.Get("code").MustInt() == 0 {
resp.Code = uint32(200)
}
resp.Msg = jsonResult.Get("msg").MustString()
resp.RecordCount = uint32(jsonData.Get("total").MustInt())
resp.HistoryJobs = historyJobs
return &resp, nil
}

View File

@ -0,0 +1,29 @@
// Code generated by goctl. DO NOT EDIT.
// Source: slurmShuguang.proto
package server
import (
"context"
"PCM/app/slurm/slurmShuguang/rpc/internal/logic"
"PCM/app/slurm/slurmShuguang/rpc/internal/svc"
"PCM/app/slurm/slurmShuguang/rpc/slurmShuguang"
)
type SlurmShuguangServer struct {
svcCtx *svc.ServiceContext
slurmShuguang.UnimplementedSlurmShuguangServer
}
func NewSlurmShuguangServer(svcCtx *svc.ServiceContext) *SlurmShuguangServer {
return &SlurmShuguangServer{
svcCtx: svcCtx,
}
}
// ListHistoryJob list all jobs from slurmdb
func (s *SlurmShuguangServer) ListHistoryJob(ctx context.Context, in *slurmShuguang.ListHistoryJobReq) (*slurmShuguang.ListHistoryJobResp, error) {
l := logic.NewListHistoryJobLogic(ctx, s.svcCtx)
return l.ListHistoryJob(in)
}

View File

@ -0,0 +1,13 @@
package svc
import "PCM/app/slurm/slurmShuguang/rpc/internal/config"
type ServiceContext struct {
Config config.Config
}
func NewServiceContext(c config.Config) *ServiceContext {
return &ServiceContext{
Config: c,
}
}

View File

@ -3,7 +3,13 @@ syntax = "proto3";
package slurmShuguang;
option go_package = "/slurmShuguang";
/******************Job(DB) Start*************************/
message apiHistoryJob{
}
message historyJob{
// @gotags: copier:"AcctTime"
string acct_time = 1 ;
@ -43,9 +49,13 @@ message ListHistoryJobReq{
}
message ListHistoryJobResp{
// @gotags: copier:"Code"
uint32 code = 1;
// @gotags: copier:"Msg"
string msg = 2;
// @gotags: copier:"RecordCount"
uint32 record_count = 3;
// @gotags: copier:"HistoryJobs"
repeated historyJob history_jobs = 4;
}

View File

@ -0,0 +1,522 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.19.4
// source: slurmShuguang.proto
package slurmShuguang
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// *****************Job(DB) Start************************
type ApiHistoryJob struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ApiHistoryJob) Reset() {
*x = ApiHistoryJob{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ApiHistoryJob) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ApiHistoryJob) ProtoMessage() {}
func (x *ApiHistoryJob) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ApiHistoryJob.ProtoReflect.Descriptor instead.
func (*ApiHistoryJob) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{0}
}
type HistoryJob struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @gotags: copier:"AcctTime"
AcctTime string `protobuf:"bytes,1,opt,name=acct_time,json=acctTime,proto3" json:"acct_time,omitempty" copier:"AcctTime"`
// @gotags: copier:"AppType"
AppType string `protobuf:"bytes,2,opt,name=app_type,json=appType,proto3" json:"app_type,omitempty" copier:"AppType"`
// @gotags: copier:"End"
JobEndTime string `protobuf:"bytes,3,opt,name=job_end_time,json=jobEndTime,proto3" json:"job_end_time,omitempty" copier:"End"`
// @gotags: copier:"Nodes"
JobExecHost string `protobuf:"bytes,4,opt,name=job_exec_host,json=jobExecHost,proto3" json:"job_exec_host,omitempty" copier:"Nodes"`
// @gotags: copier:"ExitCode"
JobExitStatus int32 `protobuf:"varint,5,opt,name=job_exit_status,json=jobExitStatus,proto3" json:"job_exit_status,omitempty" copier:"ExitCode"`
// @gotags: copier:"JobId"
JobId int32 `protobuf:"varint,6,opt,name=job_id,json=jobId,proto3" json:"job_id,omitempty" copier:"JobId"`
// @gotags: copier:"JobName"
JobName string `protobuf:"bytes,7,opt,name=job_name,json=jobName,proto3" json:"job_name,omitempty" copier:"JobName"`
// @gotags: copier:"JobQueueTime"
JobQueueTime string `protobuf:"bytes,8,opt,name=job_queue_time,json=jobQueueTime,proto3" json:"job_queue_time,omitempty" copier:"JobQueueTime"`
// @gotags: copier:"Start"
JobStartTime string `protobuf:"bytes,9,opt,name=job_start_time,json=jobStartTime,proto3" json:"job_start_time,omitempty" copier:"Start"`
// @gotags: copier:"State"
JobState string `protobuf:"bytes,10,opt,name=job_state,json=jobState,proto3" json:"job_state,omitempty" copier:"State"`
// @gotags: copier:"JobWalltimeUsed"
JobWalltimeUsed string `protobuf:"bytes,11,opt,name=job_walltime_used,json=jobWalltimeUsed,proto3" json:"job_walltime_used,omitempty" copier:"JobWalltimeUsed"`
// @gotags: copier:"JobManagerId"
JobManagerId int32 `protobuf:"varint,12,opt,name=job_manager_id,json=jobManagerId,proto3" json:"job_manager_id,omitempty" copier:"JobManagerId"`
// @gotags: copier:"AllocNodes"
NodeCt int32 `protobuf:"varint,13,opt,name=node_ct,json=nodeCt,proto3" json:"node_ct,omitempty" copier:"AllocNodes"`
// @gotags: copier:"Partition"
Queue string `protobuf:"bytes,14,opt,name=queue,proto3" json:"queue,omitempty" copier:"Partition"`
// @gotags: copier:"User"
UserName string `protobuf:"bytes,15,opt,name=user_name,json=userName,proto3" json:"user_name,omitempty" copier:"User"`
// @gotags: copier:"WorkDir"
Workdir string `protobuf:"bytes,16,opt,name=workdir,proto3" json:"workdir,omitempty" copier:"WorkDir"`
}
func (x *HistoryJob) Reset() {
*x = HistoryJob{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *HistoryJob) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HistoryJob) ProtoMessage() {}
func (x *HistoryJob) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HistoryJob.ProtoReflect.Descriptor instead.
func (*HistoryJob) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{1}
}
func (x *HistoryJob) GetAcctTime() string {
if x != nil {
return x.AcctTime
}
return ""
}
func (x *HistoryJob) GetAppType() string {
if x != nil {
return x.AppType
}
return ""
}
func (x *HistoryJob) GetJobEndTime() string {
if x != nil {
return x.JobEndTime
}
return ""
}
func (x *HistoryJob) GetJobExecHost() string {
if x != nil {
return x.JobExecHost
}
return ""
}
func (x *HistoryJob) GetJobExitStatus() int32 {
if x != nil {
return x.JobExitStatus
}
return 0
}
func (x *HistoryJob) GetJobId() int32 {
if x != nil {
return x.JobId
}
return 0
}
func (x *HistoryJob) GetJobName() string {
if x != nil {
return x.JobName
}
return ""
}
func (x *HistoryJob) GetJobQueueTime() string {
if x != nil {
return x.JobQueueTime
}
return ""
}
func (x *HistoryJob) GetJobStartTime() string {
if x != nil {
return x.JobStartTime
}
return ""
}
func (x *HistoryJob) GetJobState() string {
if x != nil {
return x.JobState
}
return ""
}
func (x *HistoryJob) GetJobWalltimeUsed() string {
if x != nil {
return x.JobWalltimeUsed
}
return ""
}
func (x *HistoryJob) GetJobManagerId() int32 {
if x != nil {
return x.JobManagerId
}
return 0
}
func (x *HistoryJob) GetNodeCt() int32 {
if x != nil {
return x.NodeCt
}
return 0
}
func (x *HistoryJob) GetQueue() string {
if x != nil {
return x.Queue
}
return ""
}
func (x *HistoryJob) GetUserName() string {
if x != nil {
return x.UserName
}
return ""
}
func (x *HistoryJob) GetWorkdir() string {
if x != nil {
return x.Workdir
}
return ""
}
type ListHistoryJobReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ListHistoryJobReq) Reset() {
*x = ListHistoryJobReq{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListHistoryJobReq) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListHistoryJobReq) ProtoMessage() {}
func (x *ListHistoryJobReq) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListHistoryJobReq.ProtoReflect.Descriptor instead.
func (*ListHistoryJobReq) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{2}
}
type ListHistoryJobResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// @gotags: copier:"Code"
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty" copier:"Code"`
// @gotags: copier:"Msg"
Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty" copier:"Msg"`
// @gotags: copier:"RecordCount"
RecordCount uint32 `protobuf:"varint,3,opt,name=record_count,json=recordCount,proto3" json:"record_count,omitempty" copier:"RecordCount"`
// @gotags: copier:"HistoryJobs"
HistoryJobs []*HistoryJob `protobuf:"bytes,4,rep,name=history_jobs,json=historyJobs,proto3" json:"history_jobs,omitempty" copier:"HistoryJobs"`
}
func (x *ListHistoryJobResp) Reset() {
*x = ListHistoryJobResp{}
if protoimpl.UnsafeEnabled {
mi := &file_slurmShuguang_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ListHistoryJobResp) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ListHistoryJobResp) ProtoMessage() {}
func (x *ListHistoryJobResp) ProtoReflect() protoreflect.Message {
mi := &file_slurmShuguang_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ListHistoryJobResp.ProtoReflect.Descriptor instead.
func (*ListHistoryJobResp) Descriptor() ([]byte, []int) {
return file_slurmShuguang_proto_rawDescGZIP(), []int{3}
}
func (x *ListHistoryJobResp) GetCode() uint32 {
if x != nil {
return x.Code
}
return 0
}
func (x *ListHistoryJobResp) GetMsg() string {
if x != nil {
return x.Msg
}
return ""
}
func (x *ListHistoryJobResp) GetRecordCount() uint32 {
if x != nil {
return x.RecordCount
}
return 0
}
func (x *ListHistoryJobResp) GetHistoryJobs() []*HistoryJob {
if x != nil {
return x.HistoryJobs
}
return nil
}
var File_slurmShuguang_proto protoreflect.FileDescriptor
var file_slurmShuguang_proto_rawDesc = []byte{
0x0a, 0x13, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e, 0x67, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67,
0x75, 0x61, 0x6e, 0x67, 0x22, 0x0f, 0x0a, 0x0d, 0x61, 0x70, 0x69, 0x48, 0x69, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x4a, 0x6f, 0x62, 0x22, 0x85, 0x04, 0x0a, 0x0a, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72,
0x79, 0x4a, 0x6f, 0x62, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x74, 0x5f, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x63, 0x63, 0x74, 0x54, 0x69, 0x6d,
0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0c,
0x6a, 0x6f, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x6a, 0x6f, 0x62, 0x45, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x22,
0x0a, 0x0d, 0x6a, 0x6f, 0x62, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18,
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6a, 0x6f, 0x62, 0x45, 0x78, 0x65, 0x63, 0x48, 0x6f,
0x73, 0x74, 0x12, 0x26, 0x0a, 0x0f, 0x6a, 0x6f, 0x62, 0x5f, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6a, 0x6f, 0x62,
0x45, 0x78, 0x69, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, 0x0a, 0x06, 0x6a, 0x6f,
0x62, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49,
0x64, 0x12, 0x19, 0x0a, 0x08, 0x6a, 0x6f, 0x62, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20,
0x01, 0x28, 0x09, 0x52, 0x07, 0x6a, 0x6f, 0x62, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0e,
0x6a, 0x6f, 0x62, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6a, 0x6f, 0x62, 0x51, 0x75, 0x65, 0x75, 0x65, 0x54, 0x69,
0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x6a, 0x6f, 0x62, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f,
0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6a, 0x6f, 0x62, 0x53,
0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6a, 0x6f, 0x62, 0x5f,
0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6a, 0x6f, 0x62,
0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6a, 0x6f, 0x62, 0x5f, 0x77, 0x61, 0x6c,
0x6c, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0f, 0x6a, 0x6f, 0x62, 0x57, 0x61, 0x6c, 0x6c, 0x74, 0x69, 0x6d, 0x65, 0x55, 0x73, 0x65,
0x64, 0x12, 0x24, 0x0a, 0x0e, 0x6a, 0x6f, 0x62, 0x5f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72,
0x5f, 0x69, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x6a, 0x6f, 0x62, 0x4d, 0x61,
0x6e, 0x61, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f,
0x63, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x43, 0x74,
0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x71, 0x75, 0x65, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x4e,
0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x64, 0x69, 0x72, 0x18, 0x10,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x6f, 0x72, 0x6b, 0x64, 0x69, 0x72, 0x22, 0x13, 0x0a,
0x11, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52,
0x65, 0x71, 0x22, 0x9b, 0x01, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x69, 0x73, 0x74, 0x6f,
0x72, 0x79, 0x4a, 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12,
0x21, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18,
0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x0c, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x5f, 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, 0x66, 0x0a, 0x0d, 0x53, 0x6c, 0x75, 0x72, 0x6d, 0x53, 0x68, 0x75, 0x67, 0x75, 0x61, 0x6e,
0x67, 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,
}
var (
file_slurmShuguang_proto_rawDescOnce sync.Once
file_slurmShuguang_proto_rawDescData = file_slurmShuguang_proto_rawDesc
)
func file_slurmShuguang_proto_rawDescGZIP() []byte {
file_slurmShuguang_proto_rawDescOnce.Do(func() {
file_slurmShuguang_proto_rawDescData = protoimpl.X.CompressGZIP(file_slurmShuguang_proto_rawDescData)
})
return file_slurmShuguang_proto_rawDescData
}
var file_slurmShuguang_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_slurmShuguang_proto_goTypes = []interface{}{
(*ApiHistoryJob)(nil), // 0: slurmShuguang.apiHistoryJob
(*HistoryJob)(nil), // 1: slurmShuguang.historyJob
(*ListHistoryJobReq)(nil), // 2: slurmShuguang.ListHistoryJobReq
(*ListHistoryJobResp)(nil), // 3: slurmShuguang.ListHistoryJobResp
}
var file_slurmShuguang_proto_depIdxs = []int32{
1, // 0: slurmShuguang.ListHistoryJobResp.history_jobs:type_name -> slurmShuguang.historyJob
2, // 1: slurmShuguang.SlurmShuguang.ListHistoryJob:input_type -> slurmShuguang.ListHistoryJobReq
3, // 2: slurmShuguang.SlurmShuguang.ListHistoryJob:output_type -> slurmShuguang.ListHistoryJobResp
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_slurmShuguang_proto_init() }
func file_slurmShuguang_proto_init() {
if File_slurmShuguang_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_slurmShuguang_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ApiHistoryJob); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_slurmShuguang_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HistoryJob); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_slurmShuguang_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListHistoryJobReq); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_slurmShuguang_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListHistoryJobResp); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_slurmShuguang_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_slurmShuguang_proto_goTypes,
DependencyIndexes: file_slurmShuguang_proto_depIdxs,
MessageInfos: file_slurmShuguang_proto_msgTypes,
}.Build()
File_slurmShuguang_proto = out.File
file_slurmShuguang_proto_rawDesc = nil
file_slurmShuguang_proto_goTypes = nil
file_slurmShuguang_proto_depIdxs = nil
}

View File

@ -0,0 +1,107 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.19.4
// source: slurmShuguang.proto
package slurmShuguang
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// SlurmShuguangClient is the client API for SlurmShuguang service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type SlurmShuguangClient interface {
// ListHistoryJob list all jobs from slurmdb
ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error)
}
type slurmShuguangClient struct {
cc grpc.ClientConnInterface
}
func NewSlurmShuguangClient(cc grpc.ClientConnInterface) SlurmShuguangClient {
return &slurmShuguangClient{cc}
}
func (c *slurmShuguangClient) ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) {
out := new(ListHistoryJobResp)
err := c.cc.Invoke(ctx, "/slurmShuguang.SlurmShuguang/ListHistoryJob", 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
type SlurmShuguangServer interface {
// ListHistoryJob list all jobs from slurmdb
ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error)
mustEmbedUnimplementedSlurmShuguangServer()
}
// UnimplementedSlurmShuguangServer must be embedded to have forward compatible implementations.
type UnimplementedSlurmShuguangServer struct {
}
func (UnimplementedSlurmShuguangServer) ListHistoryJob(context.Context, *ListHistoryJobReq) (*ListHistoryJobResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListHistoryJob not implemented")
}
func (UnimplementedSlurmShuguangServer) mustEmbedUnimplementedSlurmShuguangServer() {}
// UnsafeSlurmShuguangServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to SlurmShuguangServer will
// result in compilation errors.
type UnsafeSlurmShuguangServer interface {
mustEmbedUnimplementedSlurmShuguangServer()
}
func RegisterSlurmShuguangServer(s grpc.ServiceRegistrar, srv SlurmShuguangServer) {
s.RegisterService(&SlurmShuguang_ServiceDesc, srv)
}
func _SlurmShuguang_ListHistoryJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListHistoryJobReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SlurmShuguangServer).ListHistoryJob(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/slurmShuguang.SlurmShuguang/ListHistoryJob",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SlurmShuguangServer).ListHistoryJob(ctx, req.(*ListHistoryJobReq))
}
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)
var SlurmShuguang_ServiceDesc = grpc.ServiceDesc{
ServiceName: "slurmShuguang.SlurmShuguang",
HandlerType: (*SlurmShuguangServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "ListHistoryJob",
Handler: _SlurmShuguang_ListHistoryJob_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "slurmShuguang.proto",
}

View File

@ -0,0 +1,39 @@
package main
import (
"flag"
"fmt"
"PCM/app/slurm/slurmShuguang/rpc/internal/config"
"PCM/app/slurm/slurmShuguang/rpc/internal/server"
"PCM/app/slurm/slurmShuguang/rpc/internal/svc"
"PCM/app/slurm/slurmShuguang/rpc/slurmShuguang"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/service"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
)
var configFile = flag.String("f", "C:\\Users\\Administrator\\GolandProjects\\PCM\\app\\slurm\\slurmShuguang\\rpc\\etc\\slurmshuguang.yaml", "the config file")
func main() {
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
ctx := svc.NewServiceContext(c)
s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
slurmShuguang.RegisterSlurmShuguangServer(grpcServer, server.NewSlurmShuguangServer(ctx))
if c.Mode == service.DevMode || c.Mode == service.TestMode {
reflection.Register(grpcServer)
}
})
defer s.Stop()
fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
s.Start()
}

View File

@ -0,0 +1,41 @@
// Code generated by goctl. DO NOT EDIT.
// Source: slurmShuguang.proto
package slurmshuguangclient
import (
"context"
"PCM/app/slurm/slurmShuguang/rpc/slurmShuguang"
"github.com/zeromicro/go-zero/zrpc"
"google.golang.org/grpc"
)
type (
ApiHistoryJob = slurmShuguang.ApiHistoryJob
HistoryJob = slurmShuguang.HistoryJob
ListHistoryJobReq = slurmShuguang.ListHistoryJobReq
ListHistoryJobResp = slurmShuguang.ListHistoryJobResp
SlurmShuguang interface {
// ListHistoryJob list all jobs from slurmdb
ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error)
}
defaultSlurmShuguang struct {
cli zrpc.Client
}
)
func NewSlurmShuguang(cli zrpc.Client) SlurmShuguang {
return &defaultSlurmShuguang{
cli: cli,
}
}
// ListHistoryJob list all jobs from slurmdb
func (m *defaultSlurmShuguang) ListHistoryJob(ctx context.Context, in *ListHistoryJobReq, opts ...grpc.CallOption) (*ListHistoryJobResp, error) {
client := slurmShuguang.NewSlurmShuguangClient(m.cli.Conn())
return client.ListHistoryJob(ctx, in, opts...)
}

1
go.mod
View File

@ -14,6 +14,7 @@ require (
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bitly/go-simplejson v0.5.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect

1470
go.sum Normal file

File diff suppressed because it is too large Load Diff