add作业查询state_to_string
This commit is contained in:
parent
88d1826f04
commit
05189bae6f
|
@ -114,3 +114,110 @@ func Get_job(id uint32) pbslurm.JobInfoMsg {
|
|||
|
||||
return go_job_buffer
|
||||
}
|
||||
|
||||
func GetErrorString(errno uint32) string {
|
||||
msg := C.GoString(C.slurm_strerror(C.int(errno)))
|
||||
return msg
|
||||
}
|
||||
|
||||
func Reason_to_string(state uint16) string {
|
||||
switch s := C.uint16_t(state); s {
|
||||
case C.WAIT_NO_REASON:
|
||||
return "None"
|
||||
case C.WAIT_PRIORITY:
|
||||
return "Priority"
|
||||
case C.WAIT_DEPENDENCY:
|
||||
return "Dependency"
|
||||
case C.WAIT_RESOURCES:
|
||||
return "Resources"
|
||||
case C.WAIT_PART_NODE_LIMIT:
|
||||
return "PartitionNodeLimit"
|
||||
case C.WAIT_PART_TIME_LIMIT:
|
||||
return "PartitionTimeLimit"
|
||||
case C.WAIT_PART_DOWN:
|
||||
return "PartitionDown"
|
||||
case C.WAIT_PART_INACTIVE:
|
||||
return "PartitionInactive"
|
||||
case C.WAIT_HELD:
|
||||
return "JobHeldAdmin"
|
||||
case C.WAIT_HELD_USER:
|
||||
return "JobHeldUser"
|
||||
case C.WAIT_TIME:
|
||||
return "BeginTime"
|
||||
case C.WAIT_LICENSES:
|
||||
return "Licenses"
|
||||
case C.WAIT_ASSOC_JOB_LIMIT:
|
||||
return "AssociationJobLimit"
|
||||
case C.WAIT_ASSOC_RESOURCE_LIMIT:
|
||||
return "AssociationResourceLimit"
|
||||
case C.WAIT_ASSOC_TIME_LIMIT:
|
||||
return "AssociationTimeLimit"
|
||||
case C.WAIT_RESERVATION:
|
||||
return "Reservation"
|
||||
case C.WAIT_NODE_NOT_AVAIL:
|
||||
return "ReqNodeNotAvail"
|
||||
case C.WAIT_FRONT_END:
|
||||
return "FrontEndDown"
|
||||
case C.FAIL_DOWN_PARTITION:
|
||||
return "PartitionDown"
|
||||
case C.FAIL_DOWN_NODE:
|
||||
return "NodeDown"
|
||||
case C.FAIL_BAD_CONSTRAINTS:
|
||||
return "BadConstraints"
|
||||
case C.FAIL_SYSTEM:
|
||||
return "SystemFailure"
|
||||
case C.FAIL_LAUNCH:
|
||||
return "JobLaunchFailure"
|
||||
case C.FAIL_EXIT_CODE:
|
||||
return "NonZeroExitCode"
|
||||
case C.FAIL_TIMEOUT:
|
||||
return "TimeLimit"
|
||||
case C.FAIL_INACTIVE_LIMIT:
|
||||
return "InactiveLimit"
|
||||
case C.FAIL_ACCOUNT:
|
||||
return "InvalidAccount"
|
||||
case C.FAIL_QOS:
|
||||
return "InvalidQOS"
|
||||
case C.WAIT_QOS_THRES:
|
||||
return "QOSUsageThreshold"
|
||||
case C.WAIT_QOS_JOB_LIMIT:
|
||||
return "QOSJobLimit"
|
||||
case C.WAIT_QOS_RESOURCE_LIMIT:
|
||||
return "QOSResourceLimit"
|
||||
case C.WAIT_QOS_TIME_LIMIT:
|
||||
return "QOSTimeLimit"
|
||||
}
|
||||
|
||||
return "unkown reason"
|
||||
|
||||
}
|
||||
func State_to_string(state uint32) string {
|
||||
switch s := C.uint32_t(state); s {
|
||||
case C.JOB_PENDING:
|
||||
return "Pending" /* queued waiting for initiation */
|
||||
case C.JOB_RUNNING:
|
||||
return "Running" /* allocated resources and executing */
|
||||
case C.JOB_SUSPENDED:
|
||||
return "Suspended" /* allocated resources, execution suspended */
|
||||
case C.JOB_COMPLETE:
|
||||
return "Complete" /* completed execution successfully */
|
||||
case C.JOB_CANCELLED:
|
||||
return "Cancelled" /* cancelled by user */
|
||||
case C.JOB_FAILED:
|
||||
return "Failed" /* completed execution unsuccessfully */
|
||||
case C.JOB_TIMEOUT:
|
||||
return "Timeout" /* terminated on reaching time limit */
|
||||
case C.JOB_NODE_FAIL:
|
||||
return "Node Fail" /* terminated on node failure */
|
||||
case C.JOB_PREEMPTED:
|
||||
return "Preempted" /* terminated due to preemption */
|
||||
case C.JOB_BOOT_FAIL:
|
||||
return "Node Boot failure" /* terminated due to node boot failure */
|
||||
case C.JOB_DEADLINE:
|
||||
return "Deadline" /* terminated on deadline */
|
||||
case C.JOB_OOM:
|
||||
return "Out of memory" /* experienced out of memory error */
|
||||
}
|
||||
|
||||
return "Unknow status" /* not a real state, last entry in table */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue