181 lines
8.1 KiB
Go
181 lines
8.1 KiB
Go
package slurm
|
|
|
|
type JobOptions struct {
|
|
Script string `json:"script"`
|
|
Job *JobProperties `json:"job"`
|
|
}
|
|
|
|
type JobProperties struct {
|
|
Account string `json:"account"`
|
|
CurrentWorkingDirectory string `json:"current_working_directory"`
|
|
Environment map[string]string `json:"environment"`
|
|
Name string `json:"name"`
|
|
Partition string `json:"partition"`
|
|
StandardError string `json:"standard_error"`
|
|
StandardOutput string `json:"standard_output"`
|
|
NTasks uint32 `json:"ntasks"`
|
|
}
|
|
|
|
type SubmitJobResp struct {
|
|
Meta struct {
|
|
Plugin struct {
|
|
Type string `json:"type"`
|
|
Name string `json:"name"`
|
|
} `json:"plugin"`
|
|
Slurm struct {
|
|
Version struct {
|
|
Major int `json:"major"`
|
|
Micro int `json:"micro"`
|
|
Minor int `json:"minor"`
|
|
} `json:"version"`
|
|
Release string `json:"release"`
|
|
} `json:"Slurm"`
|
|
} `json:"meta"`
|
|
Errors []interface{} `json:"errors"`
|
|
JobId int `json:"job_id"`
|
|
StepId string `json:"step_id"`
|
|
JobSubmitUserMsg string `json:"job_submit_user_msg"`
|
|
}
|
|
|
|
type GetJobReq struct {
|
|
JobId string `json:"job_id"`
|
|
}
|
|
|
|
type GetJobResp struct {
|
|
Errors []struct {
|
|
Description string `json:"description"`
|
|
ErrorNumber int `json:"error_number"`
|
|
Error string `json:"error"`
|
|
Source string `json:"source"`
|
|
} `json:"errors"`
|
|
Jobs []struct {
|
|
Account string `json:"account"`
|
|
AccrueTime int64 `json:"accrue_time"`
|
|
AdminComment string `json:"admin_comment"`
|
|
ArrayJobId string `json:"array_job_id"`
|
|
ArrayTaskId string `json:"array_task_id"`
|
|
ArrayMaxTasks string `json:"array_max_tasks"`
|
|
ArrayTaskString string `json:"array_task_string"`
|
|
AssociationId string `json:"association_id"`
|
|
BatchFeatures string `json:"batch_features"`
|
|
BatchFlag bool `json:"batch_flag"`
|
|
BatchHost string `json:"batch_host"`
|
|
Flags []string `json:"flags"`
|
|
BurstBuffer string `json:"burst_buffer"`
|
|
BurstBufferState string `json:"burst_buffer_state"`
|
|
Cluster string `json:"cluster"`
|
|
ClusterFeatures string `json:"cluster_features"`
|
|
Command string `json:"command"`
|
|
Comment string `json:"comment"`
|
|
Contiguous bool `json:"contiguous"`
|
|
CoreSpec string `json:"core_spec"`
|
|
ThreadSpec string `json:"thread_spec"`
|
|
CoresPerSocket string `json:"cores_per_socket"`
|
|
BillableTres string `json:"billable_tres"`
|
|
CpusPerTask string `json:"cpus_per_task"`
|
|
CpuFrequencyMinimum string `json:"cpu_frequency_minimum"`
|
|
CpuFrequencyMaximum string `json:"cpu_frequency_maximum"`
|
|
CpuFrequencyGovernor string `json:"cpu_frequency_governor"`
|
|
CpusPerTres string `json:"cpus_per_tres"`
|
|
Deadline string `json:"deadline"`
|
|
DelayBoot string `json:"delay_boot"`
|
|
Dependency string `json:"dependency"`
|
|
DerivedExitCode string `json:"derived_exit_code"`
|
|
EligibleTime int64 `json:"eligible_time"`
|
|
EndTime int64 `json:"end_time"`
|
|
ExcludedNodes string `json:"excluded_nodes"`
|
|
ExitCode int `json:"exit_code"`
|
|
Features string `json:"features"`
|
|
FederationOrigin string `json:"federation_origin"`
|
|
FederationSiblingsActive string `json:"federation_siblings_active"`
|
|
FederationSiblingsViable string `json:"federation_siblings_viable"`
|
|
GresDetail []string `json:"gres_detail"`
|
|
GroupId string `json:"group_id"`
|
|
JobId string `json:"job_id"`
|
|
JobResources struct {
|
|
Nodes string `json:"nodes"`
|
|
AllocatedCpus int `json:"allocated_cpus"`
|
|
AllocatedHosts int `json:"allocated_hosts"`
|
|
AllocatedNodes []struct {
|
|
Memory int `json:"memory"`
|
|
} `json:"allocated_nodes"`
|
|
} `json:"job_resources"`
|
|
JobState string `json:"job_state"`
|
|
LastSchedEvaluation string `json:"last_sched_evaluation"`
|
|
Licenses string `json:"licenses"`
|
|
MaxCpus string `json:"max_cpus"`
|
|
MaxNodes string `json:"max_nodes"`
|
|
McsLabel string `json:"mcs_label"`
|
|
MemoryPerTres string `json:"memory_per_tres"`
|
|
Name string `json:"name"`
|
|
Nodes string `json:"nodes"`
|
|
Nice string `json:"nice"`
|
|
TasksPerCore string `json:"tasks_per_core"`
|
|
TasksPerSocket string `json:"tasks_per_socket"`
|
|
TasksPerBoard string `json:"tasks_per_board"`
|
|
Cpus string `json:"cpus"`
|
|
NodeCount string `json:"node_count"`
|
|
Tasks string `json:"tasks"`
|
|
HetJobId string `json:"het_job_id"`
|
|
HetJobIdSet string `json:"het_job_id_set"`
|
|
HetJobOffset string `json:"het_job_offset"`
|
|
Partition string `json:"partition"`
|
|
MemoryPerNode string `json:"memory_per_node"`
|
|
MemoryPerCpu string `json:"memory_per_cpu"`
|
|
MinimumCpusPerNode string `json:"minimum_cpus_per_node"`
|
|
MinimumTmpDiskPerNode string `json:"minimum_tmp_disk_per_node"`
|
|
PreemptTime int64 `json:"preempt_time"`
|
|
PreSusTime int64 `json:"pre_sus_time"`
|
|
Priority string `json:"priority"`
|
|
Profile []string `json:"profile"`
|
|
Qos string `json:"qos"`
|
|
Reboot bool `json:"reboot"`
|
|
RequiredNodes string `json:"required_nodes"`
|
|
Requeue bool `json:"requeue"`
|
|
ResizeTime int64 `json:"resize_time"`
|
|
RestartCnt string `json:"restart_cnt"`
|
|
ResvName string `json:"resv_name"`
|
|
Shared string `json:"shared"`
|
|
ShowFlags []string `json:"show_flags"`
|
|
SocketsPerBoard string `json:"sockets_per_board"`
|
|
SocketsPerNode string `json:"sockets_per_node"`
|
|
StartTime int64 `json:"start_time"`
|
|
StateDescription string `json:"state_description"`
|
|
StateReason string `json:"state_reason"`
|
|
StandardError string `json:"standard_error"`
|
|
StandardInput string `json:"standard_input"`
|
|
StandardOutput string `json:"standard_output"`
|
|
SubmitTime int64 `json:"submit_time"`
|
|
SuspendTime int64 `json:"suspend_time"`
|
|
SystemComment string `json:"system_comment"`
|
|
TimeLimit string `json:"time_limit"`
|
|
TimeMinimum string `json:"time_minimum"`
|
|
ThreadsPerCore string `json:"threads_per_core"`
|
|
TresBind string `json:"tres_bind"`
|
|
TresFreq string `json:"tres_freq"`
|
|
TresPerJob string `json:"tres_per_job"`
|
|
TresPerNode string `json:"tres_per_node"`
|
|
TresPerSocket string `json:"tres_per_socket"`
|
|
TresPerTask string `json:"tres_per_task"`
|
|
TresReqStr string `json:"tres_req_str"`
|
|
TresAllocStr string `json:"tres_alloc_str"`
|
|
UserId string `json:"user_id"`
|
|
UserName string `json:"user_name"`
|
|
Wckey string `json:"wckey"`
|
|
CurrentWorkingDirectory string `json:"current_working_directory"`
|
|
} `json:"jobs"`
|
|
}
|
|
|
|
// CancelJobReq 作业取消请求体
|
|
type CancelJobReq struct {
|
|
JobId string //作业id
|
|
}
|
|
|
|
type Job interface {
|
|
GetJob(getJobReq GetJobReq) (getJobResp GetJobResp, err error)
|
|
ListJob() (getJobResp GetJobResp, err error)
|
|
ListDbJob() (getJobResp GetJobResp, err error)
|
|
SubmitJob(options JobOptions) (submitJobResp SubmitJobResp, err error)
|
|
CancelJob(cancelJobReq CancelJobReq) error
|
|
}
|