style(frontend): gofmt the apiserver and xcecli sources

Formatting only (gofmt -w on the 29 non-vendored, non-generated files
gofmt -l reported); swag-generated apiserver/docs/docs.go left as is.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-02 09:33:16 +00:00
parent b57ce6d6a9
commit 3615c7c0fb
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
29 changed files with 1280 additions and 1285 deletions

View file

@ -1,22 +1,22 @@
package models
type ClusterResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []ClusterInfo `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
type ClusterInfo struct {
ClusterName string `json:"cluster_name"`
Version string `json:"version"`
Status string `json:"status"`
ControllerName string `json:"controller_name"`
Resources interface{} `json:"resources"`
HostTypes interface{} `json:"host_types"`
HostModels interface{} `json:"host_models"`
ClusterAdmins interface{} `json:"cluster_admins"`
}
package models
type ClusterResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []ClusterInfo `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
type ClusterInfo struct {
ClusterName string `json:"cluster_name"`
Version string `json:"version"`
Status string `json:"status"`
ControllerName string `json:"controller_name"`
Resources interface{} `json:"resources"`
HostTypes interface{} `json:"host_types"`
HostModels interface{} `json:"host_models"`
ClusterAdmins interface{} `json:"cluster_admins"`
}

View file

@ -1,172 +1,172 @@
package models
const (
HEADER_HOST_NAME = "HOST_NAME"
HEADER_HOST_STATUS = "STATUS"
HEADER_HOST_NCPUS = "NCPUS"
HEADER_HOST_MAX_SLOT = "MAX_SLOT"
HEADER_HOST_NUM_RUN = "NUM_RUN"
HEADER_HOST_NUM_SSUSP = "NUM_SSUSP"
HEADER_HOST_NUM_USUSP = "NUM_USUSP"
HEADER_HOST_HOST_TYPE = "HOST_TYPE"
// host details info
HEADER_HOST_CPUF = "CPUF"
HEADER_HOST_JLU = "JL/U"
HEADER_HOST_MAX = "MAX"
HEADER_HOST_NJOBS = "NJOBS"
HEADER_HOST_RUN = "RUN"
HEADER_HOST_SSUSP = "SSUSP"
HEADER_HOST_USUSP = "USUSP"
HEADER_HOST_RSV = "RSV"
HEADER_HOST_DISPT_WINDOW = "DISPATCH_WINDOW"
// second line
HEADER_HOST_R15S = "r15s"
HEADER_HOST_R1M = "r1m"
HEADER_HOST_R15M = "r15m"
HEADER_HOST_UT = "ut"
HEADER_HOST_PG = "pg"
HEADER_HOST_IO = "io"
HEADER_HOST_LS = "ls"
HEADER_HOST_IT = "it"
HEADER_HOST_TMP = "tmp"
HEADER_HOST_SWP = "swp"
HEADER_HOST_MEM = "mem"
HEADER_HOST_SLOTS = "slots"
)
var HostDetailHeaders = []string{
HEADER_HOST_STATUS,
HEADER_HOST_CPUF,
HEADER_HOST_JLU,
HEADER_HOST_MAX,
HEADER_HOST_NJOBS,
HEADER_HOST_RUN,
HEADER_HOST_SSUSP,
HEADER_HOST_USUSP,
HEADER_HOST_RSV,
HEADER_HOST_DISPT_WINDOW,
}
var HostLoadSchedulingHeaders = []string{
HEADER_HOST_R15S,
HEADER_HOST_R1M,
HEADER_HOST_R15M,
HEADER_HOST_UT,
HEADER_HOST_PG,
HEADER_HOST_IO,
HEADER_HOST_LS,
HEADER_HOST_IT,
HEADER_HOST_TMP,
HEADER_HOST_SWP,
HEADER_HOST_MEM,
HEADER_HOST_SLOTS,
}
// HostsResponse define the data structure in the host query response
type HostsResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []XCEHost `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
// Host define the data structure in the host info\
type XCEHost struct {
HostID int64 `json:"host_id"`
HostName string `json:"host_name"`
HostStatus string `json:"host_status"`
HostModel string `json:"host_model"`
HostType string `json:"host_type"`
HostGroup string `json:"host_group"`
Flag int `json:"flag"`
CPUFactor float64 `json:"cpu_factor"`
DisptWindow interface{} `json:"dispt_window"`
NumCPUs int `json:"num_cpus"`
MaxSlot int `json:"max_slot"`
MaxMem int `json:"max_mem"`
MaxSwap int `json:"max_swap"`
MaxTmp int `json:"max_tmp"`
NumDisk int `json:"num_disk"`
NumRun int `json:"num_run"`
NumSSusp int `json:"num_ssusp"`
NumUSusp int `json:"num_ususp"`
NumDone int `json:"num_done"`
AffTopo interface{} `json:"aff_topo"` // JSONB
GPUTopo interface{} `json:"gpu_topo"` // JSONB
SchedStop SchedStop `json:"sched_stop"` // JSONB
RealLoad interface{} `json:"real_load"`
// ResourceValues carries this host's live per-resource wire values
// (r15s/r1m/r15m/ut/pg/io/ls/it/tmp/swp/mem/slots, among others), the
// same set the C scheduler's own "info worker" REPL command shows --
// populated by the apiserver from the worker's own resval pushes.
ResourceValues []ResourceDistributionInfo `json:"resource_values"`
}
// ResourceDistributionInfo mirrors apiserver/models.ResourceDistributionInfo's
// JSON shape -- one resource's current value for one host/worker.
type ResourceDistributionInfo struct {
ResourceName string `json:"res_name"`
IsDynamic bool `json:"is_dynamic"`
ValueType int `json:"value_type"`
BooleanValue bool `json:"boolean_value"`
StringValue string `json:"string_value"`
NumericValue float64 `json:"numeric_value"`
Location string `json:"location"`
}
var HostFieldsMap = map[string]string{
HEADER_HOST_NAME: "host_name",
HEADER_HOST_STATUS: "host_status",
HEADER_HOST_NCPUS: "num_cores",
HEADER_HOST_MAX_SLOT: "max_slot",
HEADER_HOST_NUM_RUN: "num_run",
HEADER_HOST_NUM_SSUSP: "num_ssusp",
HEADER_HOST_NUM_USUSP: "num_ususp",
HEADER_HOST_HOST_TYPE: "host_type",
}
type SchedStop struct {
Ls string `json:"ls"` // Load Sharing
Pg string `json:"pg"` // Page
R1m string `json:"r1m"` // Recent 1 minute
Tmp string `json:"tmp"` // Temporary
}
type HostControlRequest struct {
ControlAction string `json:"action" binding:"required"` //control action
Hostname []string `json:"host_name" binding:"required"` //host name
Comment string `json:"comment"` //comment
}
type HostControlResponse struct {
Data struct {
Accepted []*HostControlResponseItem `json:"accepted"`
Failed []*HostControlResponseItem `json:"failed"`
} `json:"data"`
}
type HostControlResponseItem struct {
HostName string `json:"host_name"`
Msg string `json:"msg"`
}
func (h *XCEHost) UnmarshalJSON(data []byte) error {
type Alias XCEHost
var a Alias
if err := UnmarshalOrderMapRow(data, &a); err != nil {
return err
}
*h = XCEHost(a)
return nil
}
type ResReqSelectRequest struct {
Select string `json:"select"`
Order string `json:"order,omitempty"`
Limit int `json:"limit,omitempty"`
PageToken string `json:"page_token,omitempty"`
}
package models
const (
HEADER_HOST_NAME = "HOST_NAME"
HEADER_HOST_STATUS = "STATUS"
HEADER_HOST_NCPUS = "NCPUS"
HEADER_HOST_MAX_SLOT = "MAX_SLOT"
HEADER_HOST_NUM_RUN = "NUM_RUN"
HEADER_HOST_NUM_SSUSP = "NUM_SSUSP"
HEADER_HOST_NUM_USUSP = "NUM_USUSP"
HEADER_HOST_HOST_TYPE = "HOST_TYPE"
// host details info
HEADER_HOST_CPUF = "CPUF"
HEADER_HOST_JLU = "JL/U"
HEADER_HOST_MAX = "MAX"
HEADER_HOST_NJOBS = "NJOBS"
HEADER_HOST_RUN = "RUN"
HEADER_HOST_SSUSP = "SSUSP"
HEADER_HOST_USUSP = "USUSP"
HEADER_HOST_RSV = "RSV"
HEADER_HOST_DISPT_WINDOW = "DISPATCH_WINDOW"
// second line
HEADER_HOST_R15S = "r15s"
HEADER_HOST_R1M = "r1m"
HEADER_HOST_R15M = "r15m"
HEADER_HOST_UT = "ut"
HEADER_HOST_PG = "pg"
HEADER_HOST_IO = "io"
HEADER_HOST_LS = "ls"
HEADER_HOST_IT = "it"
HEADER_HOST_TMP = "tmp"
HEADER_HOST_SWP = "swp"
HEADER_HOST_MEM = "mem"
HEADER_HOST_SLOTS = "slots"
)
var HostDetailHeaders = []string{
HEADER_HOST_STATUS,
HEADER_HOST_CPUF,
HEADER_HOST_JLU,
HEADER_HOST_MAX,
HEADER_HOST_NJOBS,
HEADER_HOST_RUN,
HEADER_HOST_SSUSP,
HEADER_HOST_USUSP,
HEADER_HOST_RSV,
HEADER_HOST_DISPT_WINDOW,
}
var HostLoadSchedulingHeaders = []string{
HEADER_HOST_R15S,
HEADER_HOST_R1M,
HEADER_HOST_R15M,
HEADER_HOST_UT,
HEADER_HOST_PG,
HEADER_HOST_IO,
HEADER_HOST_LS,
HEADER_HOST_IT,
HEADER_HOST_TMP,
HEADER_HOST_SWP,
HEADER_HOST_MEM,
HEADER_HOST_SLOTS,
}
// HostsResponse define the data structure in the host query response
type HostsResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []XCEHost `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
// Host define the data structure in the host info\
type XCEHost struct {
HostID int64 `json:"host_id"`
HostName string `json:"host_name"`
HostStatus string `json:"host_status"`
HostModel string `json:"host_model"`
HostType string `json:"host_type"`
HostGroup string `json:"host_group"`
Flag int `json:"flag"`
CPUFactor float64 `json:"cpu_factor"`
DisptWindow interface{} `json:"dispt_window"`
NumCPUs int `json:"num_cpus"`
MaxSlot int `json:"max_slot"`
MaxMem int `json:"max_mem"`
MaxSwap int `json:"max_swap"`
MaxTmp int `json:"max_tmp"`
NumDisk int `json:"num_disk"`
NumRun int `json:"num_run"`
NumSSusp int `json:"num_ssusp"`
NumUSusp int `json:"num_ususp"`
NumDone int `json:"num_done"`
AffTopo interface{} `json:"aff_topo"` // JSONB
GPUTopo interface{} `json:"gpu_topo"` // JSONB
SchedStop SchedStop `json:"sched_stop"` // JSONB
RealLoad interface{} `json:"real_load"`
// ResourceValues carries this host's live per-resource wire values
// (r15s/r1m/r15m/ut/pg/io/ls/it/tmp/swp/mem/slots, among others), the
// same set the C scheduler's own "info worker" REPL command shows --
// populated by the apiserver from the worker's own resval pushes.
ResourceValues []ResourceDistributionInfo `json:"resource_values"`
}
// ResourceDistributionInfo mirrors apiserver/models.ResourceDistributionInfo's
// JSON shape -- one resource's current value for one host/worker.
type ResourceDistributionInfo struct {
ResourceName string `json:"res_name"`
IsDynamic bool `json:"is_dynamic"`
ValueType int `json:"value_type"`
BooleanValue bool `json:"boolean_value"`
StringValue string `json:"string_value"`
NumericValue float64 `json:"numeric_value"`
Location string `json:"location"`
}
var HostFieldsMap = map[string]string{
HEADER_HOST_NAME: "host_name",
HEADER_HOST_STATUS: "host_status",
HEADER_HOST_NCPUS: "num_cores",
HEADER_HOST_MAX_SLOT: "max_slot",
HEADER_HOST_NUM_RUN: "num_run",
HEADER_HOST_NUM_SSUSP: "num_ssusp",
HEADER_HOST_NUM_USUSP: "num_ususp",
HEADER_HOST_HOST_TYPE: "host_type",
}
type SchedStop struct {
Ls string `json:"ls"` // Load Sharing
Pg string `json:"pg"` // Page
R1m string `json:"r1m"` // Recent 1 minute
Tmp string `json:"tmp"` // Temporary
}
type HostControlRequest struct {
ControlAction string `json:"action" binding:"required"` //control action
Hostname []string `json:"host_name" binding:"required"` //host name
Comment string `json:"comment"` //comment
}
type HostControlResponse struct {
Data struct {
Accepted []*HostControlResponseItem `json:"accepted"`
Failed []*HostControlResponseItem `json:"failed"`
} `json:"data"`
}
type HostControlResponseItem struct {
HostName string `json:"host_name"`
Msg string `json:"msg"`
}
func (h *XCEHost) UnmarshalJSON(data []byte) error {
type Alias XCEHost
var a Alias
if err := UnmarshalOrderMapRow(data, &a); err != nil {
return err
}
*h = XCEHost(a)
return nil
}
type ResReqSelectRequest struct {
Select string `json:"select"`
Order string `json:"order,omitempty"`
Limit int `json:"limit,omitempty"`
PageToken string `json:"page_token,omitempty"`
}

View file

@ -60,8 +60,6 @@ var JobLoadSchedulingHeaders = []string{
HEADER_JOB_MEM,
}
// for array jobs
const (
HEADER_ARRAY_JOB_JOBID = "JOBID"
@ -93,96 +91,96 @@ type Jsonb struct {
// Job define the data structure in the job info
type QueryJob struct {
JobID int64 `json:"job_id"`
SubmitUser string `json:"submit_user"`
JobStatus string `json:"job_status"`
JobName string `json:"job_name"`
Command string `json:"command"`
QueueName string `json:"queue_name"`
ProjectName string `json:"project_name"`
UserGroup string `json:"user_group"`
LicenseProject string `json:"license_project"`
JobDescription string `json:"job_description"`
Resreq string `json:"resreq"`
RsvID string `json:"rsv_id"`
SLA string `json:"sla"`
MaxNumProcessors int `json:"maxnum_processors"`
NumProcessors int `json:"num_processors"`
AskedHosts string `json:"asked_hosts"`
BeginTime string `json:"begin_time"`
TermTime string `json:"term_time"`
UserPriority int `json:"user_priority"`
DependCond string `json:"depend_cond"`
SubmitTime int64 `json:"submit_time"`
ReserveTime int64 `json:"reserve_time"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
JobRusage string `json:"job_rusage"`
MaxMem float64 `json:"max_mem"`
AvgMem float64 `json:"avg_mem"`
UsedMem float64 `json:"used_mem"`
CPUTime int `json:"cpu_time"`
PeakCPUTime int `json:"peak_cpu_time"`
PeakCPUDuration float64 `json:"peak_cpu_duration"`
MemEfficiency float64 `json:"mem_efficiency"` // Memory efficiency in percentage
AvgCPUEfficiency float64 `json:"avg_cpu_efficiency"` // Average CPU efficiency in percentage
PeakCPUEfficiency float64 `json:"peak_cpu_efficiency"` // Peak CPU efficiency in percentage
NumHosts int `json:"num_hosts"` // Number of hosts used by the job
FirstHost string `json:"first_host"` // First host where the job ran
AllocSlot string `json:"alloc_slots"` // Allocated slot information
Duration int `json:"duration"`
Umask int `json:"umask"`
CWD string `json:"cwd"`
SubmitHomeDir string `json:"submit_home_dir"`
FromHost string `json:"from_host"`
ExecHosts ExecHosts `json:"exec_hosts"`
JobID int64 `json:"job_id"`
SubmitUser string `json:"submit_user"`
JobStatus string `json:"job_status"`
JobName string `json:"job_name"`
Command string `json:"command"`
QueueName string `json:"queue_name"`
ProjectName string `json:"project_name"`
UserGroup string `json:"user_group"`
LicenseProject string `json:"license_project"`
JobDescription string `json:"job_description"`
Resreq string `json:"resreq"`
RsvID string `json:"rsv_id"`
SLA string `json:"sla"`
MaxNumProcessors int `json:"maxnum_processors"`
NumProcessors int `json:"num_processors"`
AskedHosts string `json:"asked_hosts"`
BeginTime string `json:"begin_time"`
TermTime string `json:"term_time"`
UserPriority int `json:"user_priority"`
DependCond string `json:"depend_cond"`
SubmitTime int64 `json:"submit_time"`
ReserveTime int64 `json:"reserve_time"`
StartTime int64 `json:"start_time"`
EndTime int64 `json:"end_time"`
JobRusage string `json:"job_rusage"`
MaxMem float64 `json:"max_mem"`
AvgMem float64 `json:"avg_mem"`
UsedMem float64 `json:"used_mem"`
CPUTime int `json:"cpu_time"`
PeakCPUTime int `json:"peak_cpu_time"`
PeakCPUDuration float64 `json:"peak_cpu_duration"`
MemEfficiency float64 `json:"mem_efficiency"` // Memory efficiency in percentage
AvgCPUEfficiency float64 `json:"avg_cpu_efficiency"` // Average CPU efficiency in percentage
PeakCPUEfficiency float64 `json:"peak_cpu_efficiency"` // Peak CPU efficiency in percentage
NumHosts int `json:"num_hosts"` // Number of hosts used by the job
FirstHost string `json:"first_host"` // First host where the job ran
AllocSlot string `json:"alloc_slots"` // Allocated slot information
Duration int `json:"duration"`
Umask int `json:"umask"`
CWD string `json:"cwd"`
SubmitHomeDir string `json:"submit_home_dir"`
FromHost string `json:"from_host"`
ExecHosts ExecHosts `json:"exec_hosts"`
ExitStatus ExitStatusValue `json:"exit_status"`
ExecUID int `json:"exec_uid"`
ExecHome string `json:"exec_home"`
ExecCWD string `json:"exec_cwd"`
ExecUserName string `json:"exec_user_name"`
JobPriority int `json:"job_priority"`
ChargedSAAP string `json:"charged_SAAP"`
PreExecCmd string `json:"pre_exec_cmd"`
PostExecCmd string `json:"post_exec_cmd"`
RequeueErrorValues string `json:"requeue_error_values"`
NumLicenses int `json:"num_licenses"`
LicenseNames []string `json:"license_names"`
RunTime int `json:"run_time"`
RunTimeEstimation int `json:"run_time_estimation"`
MigThreshold int `json:"mig_threshold"`
ChkpntPeriod int `json:"chkpnt_period"`
ChkpntDir string `json:"chkpnt_dir"`
OutDir string `json:"out_dir"`
InFile string `json:"in_file"`
OutFile string `json:"out_file"`
ErrFile string `json:"err_file"`
MailUser string `json:"mail_user"`
LoginShell string `json:"login_shell"`
ExceptList string `json:"except_list"`
RLimits64 []int64 `json:"rlimits64"`
SubEnvVars string `json:"sub_env_vars"`
PendingReason string `json:"pending_reason"`
JobStartInfo string `json:"job_start_info"`
JobExecInfo string `json:"job_exec_info"`
CoreLimit float64 `json:"core_limit"`
CPULimit string `json:"cpu_limit"`
RunLimit string `json:"run_limit"`
FileLimit float64 `json:"file_limit"`
DataLimit float64 `json:"data_limit"`
StackLimit float64 `json:"stack_limit"`
MemLimit float64 `json:"mem_limit"`
SwapLimit float64 `json:"swap_limit"`
ProcessLimit float64 `json:"process_limit"`
ThreadLimit float64 `json:"thread_limit"`
NumFiles int `json:"num_files"`
ArrayIdx int `json:"array_idx"` //
UniqueJobID int64 `json:"unique_job_id"` //
ExtendData JobExtendData `json:"extend_data"`
InteractiveJobURL string `json:"interactive_job_url"`
PGIDs IntSlice `json:"pgids"`
PID IntSlice `json:"pids"`
LaunchType string `json:"launch_type"`
ExecUID int `json:"exec_uid"`
ExecHome string `json:"exec_home"`
ExecCWD string `json:"exec_cwd"`
ExecUserName string `json:"exec_user_name"`
JobPriority int `json:"job_priority"`
ChargedSAAP string `json:"charged_SAAP"`
PreExecCmd string `json:"pre_exec_cmd"`
PostExecCmd string `json:"post_exec_cmd"`
RequeueErrorValues string `json:"requeue_error_values"`
NumLicenses int `json:"num_licenses"`
LicenseNames []string `json:"license_names"`
RunTime int `json:"run_time"`
RunTimeEstimation int `json:"run_time_estimation"`
MigThreshold int `json:"mig_threshold"`
ChkpntPeriod int `json:"chkpnt_period"`
ChkpntDir string `json:"chkpnt_dir"`
OutDir string `json:"out_dir"`
InFile string `json:"in_file"`
OutFile string `json:"out_file"`
ErrFile string `json:"err_file"`
MailUser string `json:"mail_user"`
LoginShell string `json:"login_shell"`
ExceptList string `json:"except_list"`
RLimits64 []int64 `json:"rlimits64"`
SubEnvVars string `json:"sub_env_vars"`
PendingReason string `json:"pending_reason"`
JobStartInfo string `json:"job_start_info"`
JobExecInfo string `json:"job_exec_info"`
CoreLimit float64 `json:"core_limit"`
CPULimit string `json:"cpu_limit"`
RunLimit string `json:"run_limit"`
FileLimit float64 `json:"file_limit"`
DataLimit float64 `json:"data_limit"`
StackLimit float64 `json:"stack_limit"`
MemLimit float64 `json:"mem_limit"`
SwapLimit float64 `json:"swap_limit"`
ProcessLimit float64 `json:"process_limit"`
ThreadLimit float64 `json:"thread_limit"`
NumFiles int `json:"num_files"`
ArrayIdx int `json:"array_idx"` //
UniqueJobID int64 `json:"unique_job_id"` //
ExtendData JobExtendData `json:"extend_data"`
InteractiveJobURL string `json:"interactive_job_url"`
PGIDs IntSlice `json:"pgids"`
PID IntSlice `json:"pids"`
LaunchType string `json:"launch_type"`
}
var JobFieldsMap = map[string]string{

View file

@ -1,124 +1,124 @@
package models
const (
HEADER_QUEUE_NAME = "QUEUE_NAME"
HEADER_QUEUE_PRIORITY = "PRIORITY"
HEADER_QUEUE_STATUS = "QUEUE_STATUS"
HEADER_QUEUE_NUM_PEND = "NUM_PEND"
HEADER_QUEUE_NUM_RUN = "NUM_RUN"
HEADER_QUEUE_NUM_SSUSP = "NUM_SSUSP"
HEADER_QUEUE_NUM_USUSP = "NUM_USUSP"
HEADER_QUEUE_NUM_DONE = "NUM_DONE"
// queue detail info
HEADER_QUEUE_PRIO = "PRIO"
HEADER_QUEUE_NICE = "NICE"
HEADER_QUEUE_MAX = "MAX"
HEADER_QUEUE_JLU = "JL/U"
HEADER_QUEUE_JLP = "JL/P"
HEADER_QUEUE_JLH = "JL/H"
HEADER_QUEUE_NJOBS = "NJOBS"
HEADER_QUEUE_PEND = "PEND"
HEADER_QUEUE_RUN = "RUN"
HEADER_QUEUE_SSUSP = "SSUSP"
HEADER_QUEUE_USUSP = "USUSP"
HEADER_QUEUE_RSV = "RSV"
// second line
HEADER_QUEUE_R15S = "r15s"
HEADER_QUEUE_R1M = "r1m"
HEADER_QUEUE_R15M = "r15m"
HEADER_QUEUE_UT = "ut"
HEADER_QUEUE_PG = "pg"
HEADER_QUEUE_IO = "io"
HEADER_QUEUE_LS = "ls"
HEADER_QUEUE_IT = "it"
HEADER_QUEUE_TMP = "tmp"
HEADER_QUEUE_SWP = "swp"
HEADER_QUEUE_MEM = "mem"
)
var QueueDetailHeaders = []string{
HEADER_QUEUE_PRIO,
HEADER_QUEUE_NICE,
HEADER_QUEUE_STATUS,
HEADER_QUEUE_MAX,
HEADER_QUEUE_JLU,
HEADER_QUEUE_JLP,
HEADER_QUEUE_JLH,
HEADER_QUEUE_NJOBS,
HEADER_QUEUE_PEND,
HEADER_QUEUE_RUN,
HEADER_QUEUE_SSUSP,
HEADER_QUEUE_USUSP,
HEADER_QUEUE_RSV,
}
var QueueLoadSchedulingHeaders = []string{
HEADER_QUEUE_R15S,
HEADER_QUEUE_R1M,
HEADER_QUEUE_R15M,
HEADER_QUEUE_UT,
HEADER_QUEUE_PG,
HEADER_QUEUE_IO,
HEADER_QUEUE_LS,
HEADER_QUEUE_IT,
HEADER_QUEUE_TMP,
HEADER_QUEUE_SWP,
HEADER_QUEUE_MEM,
}
// QueuesResponse define the data structure in the queue query response
type QueuesResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []DBQueueInfo `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
var QueueFieldsMap = map[string]string{
HEADER_QUEUE_NAME: "queue_name",
HEADER_QUEUE_PRIORITY: "priority",
HEADER_QUEUE_STATUS: "queue_status",
HEADER_QUEUE_NUM_PEND: "num_pend",
HEADER_QUEUE_NUM_RUN: "num_run",
HEADER_QUEUE_NUM_SSUSP: "num_ssusp",
HEADER_QUEUE_NUM_USUSP: "num_ususp",
HEADER_QUEUE_NUM_DONE: "num_done",
}
// DBQueueInfo define the data structure in the queue info
type DBQueueInfo struct {
QueueName string `json:"queue_name"`
QueueStatus string `json:"queue_status"`
Priority int `json:"priority"`
Description string `json:"description"`
NumPend int `json:"num_pend"`
NumRun int `json:"num_run"`
NumSSusp int `json:"num_ssusp"`
NumUSusp int `json:"num_ususp"`
NumDone int `json:"num_done"`
FSInfo map[string]interface{} `json:"fs_info"` // JSONB
}
type QueueControlRequest struct {
ControlAction string `json:"action" binding:"required"` //control action
QueueName []string `json:"queue_name" binding:"required"` //queue name
Comment string `json:"comment"` //comment
}
type QueueControlResponse struct {
Data struct {
Accepted []*QueueControlResponseItem `json:"accepted"`
Failed []*QueueControlResponseItem `json:"failed"`
} `json:"data"`
}
type QueueControlResponseItem struct {
QueueName string `json:"queue_name"`
Msg string `json:"msg"`
}
package models
const (
HEADER_QUEUE_NAME = "QUEUE_NAME"
HEADER_QUEUE_PRIORITY = "PRIORITY"
HEADER_QUEUE_STATUS = "QUEUE_STATUS"
HEADER_QUEUE_NUM_PEND = "NUM_PEND"
HEADER_QUEUE_NUM_RUN = "NUM_RUN"
HEADER_QUEUE_NUM_SSUSP = "NUM_SSUSP"
HEADER_QUEUE_NUM_USUSP = "NUM_USUSP"
HEADER_QUEUE_NUM_DONE = "NUM_DONE"
// queue detail info
HEADER_QUEUE_PRIO = "PRIO"
HEADER_QUEUE_NICE = "NICE"
HEADER_QUEUE_MAX = "MAX"
HEADER_QUEUE_JLU = "JL/U"
HEADER_QUEUE_JLP = "JL/P"
HEADER_QUEUE_JLH = "JL/H"
HEADER_QUEUE_NJOBS = "NJOBS"
HEADER_QUEUE_PEND = "PEND"
HEADER_QUEUE_RUN = "RUN"
HEADER_QUEUE_SSUSP = "SSUSP"
HEADER_QUEUE_USUSP = "USUSP"
HEADER_QUEUE_RSV = "RSV"
// second line
HEADER_QUEUE_R15S = "r15s"
HEADER_QUEUE_R1M = "r1m"
HEADER_QUEUE_R15M = "r15m"
HEADER_QUEUE_UT = "ut"
HEADER_QUEUE_PG = "pg"
HEADER_QUEUE_IO = "io"
HEADER_QUEUE_LS = "ls"
HEADER_QUEUE_IT = "it"
HEADER_QUEUE_TMP = "tmp"
HEADER_QUEUE_SWP = "swp"
HEADER_QUEUE_MEM = "mem"
)
var QueueDetailHeaders = []string{
HEADER_QUEUE_PRIO,
HEADER_QUEUE_NICE,
HEADER_QUEUE_STATUS,
HEADER_QUEUE_MAX,
HEADER_QUEUE_JLU,
HEADER_QUEUE_JLP,
HEADER_QUEUE_JLH,
HEADER_QUEUE_NJOBS,
HEADER_QUEUE_PEND,
HEADER_QUEUE_RUN,
HEADER_QUEUE_SSUSP,
HEADER_QUEUE_USUSP,
HEADER_QUEUE_RSV,
}
var QueueLoadSchedulingHeaders = []string{
HEADER_QUEUE_R15S,
HEADER_QUEUE_R1M,
HEADER_QUEUE_R15M,
HEADER_QUEUE_UT,
HEADER_QUEUE_PG,
HEADER_QUEUE_IO,
HEADER_QUEUE_LS,
HEADER_QUEUE_IT,
HEADER_QUEUE_TMP,
HEADER_QUEUE_SWP,
HEADER_QUEUE_MEM,
}
// QueuesResponse define the data structure in the queue query response
type QueuesResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Count int `json:"count"`
Rows []DBQueueInfo `json:"rows"`
Page_token string `json:"page_token"`
} `json:"data"`
}
var QueueFieldsMap = map[string]string{
HEADER_QUEUE_NAME: "queue_name",
HEADER_QUEUE_PRIORITY: "priority",
HEADER_QUEUE_STATUS: "queue_status",
HEADER_QUEUE_NUM_PEND: "num_pend",
HEADER_QUEUE_NUM_RUN: "num_run",
HEADER_QUEUE_NUM_SSUSP: "num_ssusp",
HEADER_QUEUE_NUM_USUSP: "num_ususp",
HEADER_QUEUE_NUM_DONE: "num_done",
}
// DBQueueInfo define the data structure in the queue info
type DBQueueInfo struct {
QueueName string `json:"queue_name"`
QueueStatus string `json:"queue_status"`
Priority int `json:"priority"`
Description string `json:"description"`
NumPend int `json:"num_pend"`
NumRun int `json:"num_run"`
NumSSusp int `json:"num_ssusp"`
NumUSusp int `json:"num_ususp"`
NumDone int `json:"num_done"`
FSInfo map[string]interface{} `json:"fs_info"` // JSONB
}
type QueueControlRequest struct {
ControlAction string `json:"action" binding:"required"` //control action
QueueName []string `json:"queue_name" binding:"required"` //queue name
Comment string `json:"comment"` //comment
}
type QueueControlResponse struct {
Data struct {
Accepted []*QueueControlResponseItem `json:"accepted"`
Failed []*QueueControlResponseItem `json:"failed"`
} `json:"data"`
}
type QueueControlResponseItem struct {
QueueName string `json:"queue_name"`
Msg string `json:"msg"`
}
func (q *DBQueueInfo) UnmarshalJSON(data []byte) error {
type Alias DBQueueInfo