Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteQueuedJobByID(targets []string) (string, error)
- func DeleteQueuedJobByUsernames(targets []string) (string, error)
- func DoesJobContainTaskGroup(j Job) bool
- func DoesJobContainTaskRange(j Job) bool
- func GetQstatOutput(filters map[string]string) (string, error)
- func IsJobInErrorState(job Job) int
- func IsJobRunning(job Job) int
- type Error
- type Host
- type Job
- type JobInfo
- type JobList
- type PendingJob
- type QueueInfo
- type Resource
- type ResourceList
- func (r ResourceList) CPU() (float64, error)
- func (r ResourceList) FreeMemory() (StorageValue, error)
- func (r ResourceList) FreeSwap() (StorageValue, error)
- func (r ResourceList) FreeVirtualMemory() (StorageValue, error)
- func (r ResourceList) Load(window string) (float64, error)
- func (r ResourceList) MCoreCount() (int64, error)
- func (r ResourceList) MSocketCount() (int64, error)
- func (r ResourceList) MThreadCount() (int64, error)
- func (r ResourceList) MemoryUsed() (StorageValue, error)
- func (r ResourceList) NPLoadAverage() (float64, error)
- func (r ResourceList) NPLoadLong() (float64, error)
- func (r ResourceList) NPLoadMedium() (float64, error)
- func (r ResourceList) NPLoadShort() (float64, error)
- func (r ResourceList) NumberofProcessors() (int32, error)
- func (r ResourceList) ProcessorCount() (int64, error)
- func (r ResourceList) SwapUsed() (StorageValue, error)
- func (r ResourceList) TotalMemory() (StorageValue, error)
- func (r ResourceList) TotalSwap() (StorageValue, error)
- func (r ResourceList) TotalVirtual() (StorageValue, error)
- func (r ResourceList) VirtualUsed() (StorageValue, error)
- type StorageValue
- type Task
- type XMLDataSource
- type XmlContentReader
- type XmlResourceGetter
- type XmlResourceReader
Constants ¶
const ErrInvalidTaskRangeIdentifier = Error("The provided job does not actually indicate a range or group of tasks")
ErrInvalidTaskRangeIdentifier is an error that identifies jobs with a non-range conformant task attribute. Basically means you're trying to extrapolate jobs from a task range that isn't really a task range.
const ( //TASKRANGEIDENTIFIERREGEX is a regex string used for identifying whether <tasks> objects indicate a range of tasks (normally only expressed on pending tasks) TASKRANGEIDENTIFIERREGEX string = `[0-9]{1,}-[0-9]{1,}:[0-9]` )
Variables ¶
var TaskRangeRegex *regexp.Regexp = regexp.MustCompile(TASKRANGEIDENTIFIERREGEX)
TaskRangeRegex is the compiled regular expression used for identifying Tasks that define a pending / unscheduled range
Functions ¶
func DeleteQueuedJobByID ¶
DeleteQueuedJobByID is used to delete (1 or many) jobs by concatenating their IDs together and passing them to qdel
func DeleteQueuedJobByUsernames ¶
DeleteQueuedJobByUsernames is used to delete (1 or many) jobs by concatenating usernames together and feeding them to qdel
func DoesJobContainTaskGroup ¶
DoesJobContainTaskGroup evaluates whether the XML marshalled tasks value contains a group rather than a range of tasks
func DoesJobContainTaskRange ¶
DoesJobContainTaskRange evaluates whether the XML marshalled tasks value contains the regex indicating a sequence of tasks.
func GetQstatOutput ¶
GetQstatOutput is used to pull in XML content from either the QSTAT command or generated data for testing purpoes
func IsJobInErrorState ¶
func IsJobRunning ¶
IsJobRunning returns a int (1 - running) (0 - not)
Types ¶
type Host ¶
type Host struct {
XMLName xml.Name `xml:"Queue-List" json:"-"`
Name string `xml:"name" json:"name"`
QType string `xml:"qtype" json:"qtype"`
SlotsUsed int32 `xml:"slots_used" json:"slots_used"`
SlotsReserved int32 `xml:"slots_rsv" json:"slots_reserved"`
SlotsTotal int32 `xml:"slots_total" json:"slots_total"`
LoadAverage float64 `xml:"load_avg" json:"load_average"`
Resources ResourceList `xml:"resource" json:"resources"`
JobList []Job `xml:"job_list" json:"job_list"`
}
Host is the top-level object (per host) that includes all subsequent data including jobs, resources etc
type Job ¶
type Job struct {
//Because this is a node, we still need the XMLName identifier
XMLName xml.Name `xml:"job_list" json:"-"`
StateAttribute string `xml:"state,attr" json:"state_attribute_text"`
State string `xml:"state" json:"state"`
JBJobNumber int64 `xml:"JB_job_number" json:"jb_job_number"`
JATPriority float64 `xml:"JAT_prio" json:"jat_prio"`
JobName string `xml:"JB_name" json:"jb_name"`
JobOwner string `xml:"JB_owner" json:"jb_owner"`
StartTime string `xml:"JAT_start_time,omitempty" json:"start_time"`
SubmittedTime string `xml:"JB_submission_time,omitempty" json:"submitted_time"`
Slots int32 `xml:"slots" json:"slots"`
Tasks Task `xml:"tasks,omitempty" json:"tasks,omitempty"`
}
Job is the Sun Grid Engine XML Definition for a job running on a specific host, its details and current status
type JobInfo ¶
type JobInfo struct {
XMLName xml.Name `xml:"job_info" json:"-"`
QueueInfo QueueInfo `xml:"queue_info" json:"queue_info"`
PendingJobs PendingJob `xml:"job_info,omitempty" json:"pending_jobs"`
}
JobInfo is the top level object for the SGE Qstat output
func NewJobInfo ¶
NewJobInfo returns the go struct of the qstat output
type JobList ¶
type JobList []Job
JobList is a slice of Jobs that is filterable and otherwise actionable via receiver.
func ExtrapolateTasksToJobs ¶
ExtrapolateTasksToJobs takes the role of finding the range identifier and returning a job list from it (Extrapolated from the task list)
func FilterJobs ¶
FilterJobs is a function allowing you to manually provide a JobList and a filter function to limit the content down.
func GetJobsWithFilter ¶
GetJobsWithFilter allows you to specify a filter at the time of retrieving the JobList
type PendingJob ¶
type PendingJob struct {
XMLName xml.Name `xml:"job_info" json:"-"`
JobList []Job `xml:"job_list" json:"job_list"`
}
PendingJob is a sub tag of job_info (also labeled job_info) which details jobs not yet executing.
type QueueInfo ¶
type QueueInfo struct {
XMLName xml.Name `xml:"queue_info" json:"-"`
Queues []Host `xml:"Queue-List" json:"queue_list"`
}
QueueInfo is the child object for qstat job output
type Resource ¶
type Resource struct {
XMLName xml.Name `xml:"resource" json:"-"`
Name string `xml:"name,attr" json:"name"`
Type string `xml:"type,attr" json:"type"`
Value string `xml:",innerxml"`
}
Resource is a general representation of a system resource attached to a host, identified purely by Key-value pairs. These can be best thought of as Unix Load, Memory resource allocations, etc
type ResourceList ¶
type ResourceList []Resource
ResourceList is a slice of resources primarily used for sourcing internally and setup of receiver based functions
func (ResourceList) CPU ¶
func (r ResourceList) CPU() (float64, error)
CPU returns utilization type cast as a float
func (ResourceList) FreeMemory ¶
func (r ResourceList) FreeMemory() (StorageValue, error)
FreeMemory returns the type safe values for Memory free (in bytes)
func (ResourceList) FreeSwap ¶
func (r ResourceList) FreeSwap() (StorageValue, error)
FreeSwap returns the type casted value for Free Swap Bytes
func (ResourceList) FreeVirtualMemory ¶
func (r ResourceList) FreeVirtualMemory() (StorageValue, error)
FreeVirtualMemory returns the type casted value for Free Virtual Memory Bytes
func (ResourceList) Load ¶
func (r ResourceList) Load(window string) (float64, error)
Load returns the formatted, type safe float value for the Short Load resource. Provide the window of length: load_short load_medium load_long
func (ResourceList) MCoreCount ¶
func (r ResourceList) MCoreCount() (int64, error)
MCoreCount returns the core count type cast as an int64
func (ResourceList) MSocketCount ¶
func (r ResourceList) MSocketCount() (int64, error)
MSocketCount returns the socket count type cast as an int64
func (ResourceList) MThreadCount ¶
func (r ResourceList) MThreadCount() (int64, error)
MThreadCount returns the thread count type cast as an int64
func (ResourceList) MemoryUsed ¶
func (r ResourceList) MemoryUsed() (StorageValue, error)
MemoryUsed returns the type cast value for Memory used in bytes
func (ResourceList) NPLoadAverage ¶
func (r ResourceList) NPLoadAverage() (float64, error)
NPLoadAverage NP Load type cast as float 64
func (ResourceList) NPLoadLong ¶
func (r ResourceList) NPLoadLong() (float64, error)
NPLoadLong NP Load type cast as float 64
func (ResourceList) NPLoadMedium ¶
func (r ResourceList) NPLoadMedium() (float64, error)
NPLoadMedium NP Load type cast as float 64
func (ResourceList) NPLoadShort ¶
func (r ResourceList) NPLoadShort() (float64, error)
NPLoadShort NP Load type cast as float 64
func (ResourceList) NumberofProcessors ¶
func (r ResourceList) NumberofProcessors() (int32, error)
NumberofProcessors is the formatted, type-safe value for the num_proc xml attribute
func (ResourceList) ProcessorCount ¶
func (r ResourceList) ProcessorCount() (int64, error)
ProcessorCount returns the number of processors type cast as integer64
func (ResourceList) SwapUsed ¶
func (r ResourceList) SwapUsed() (StorageValue, error)
SwapUsed returns the type cast value for swap used in bytes
func (ResourceList) TotalMemory ¶
func (r ResourceList) TotalMemory() (StorageValue, error)
TotalMemory returns the Type cast value for Total Memory in bytes
func (ResourceList) TotalSwap ¶
func (r ResourceList) TotalSwap() (StorageValue, error)
TotalSwap returns the Type cast value for Total Swap in bytes
func (ResourceList) TotalVirtual ¶
func (r ResourceList) TotalVirtual() (StorageValue, error)
TotalVirtual returns the Type cast value for the virtual memory total in bytes
func (ResourceList) VirtualUsed ¶
func (r ResourceList) VirtualUsed() (StorageValue, error)
VirtualUsed returns the type cast value for swap used in bytes
type StorageValue ¶
type StorageValue struct {
Size float64 `json:"size"`
Scale string `json:"scale"`
Bytes int64 `json:"bytes"`
}
StorageValue breaks down string metrics from a computer storage standpoint (ie 10.2G) so that it can be calculated to bytes
type Task ¶
type Task struct {
//Mixed type. Can be either a string representation of an int64 OR a string range identifier, eg: 40-55:1 (Jobs 40-55 incremented by 1)
Source string
//Typed representation of the Source if mapped to an integer
TaskID int64
}
Task is an element used for handling task arrays from the grid engine. Here we'll store the raw value (Source) and the TaskID if an individual identifier.
func (*Task) MarshalXML ¶
MarshalXML renders the value back down to the XML structure
func (*Task) UnmarshalXML ¶
UnmarshalXML is a custom marshaller for handling complex logic surrounding task data.
type XMLDataSource ¶
type XMLDataSource struct {
// contains filtered or unexported fields
}
func (*XMLDataSource) Get ¶
func (d *XMLDataSource) Get() (string, error)
type XmlContentReader ¶
type XmlContentReader struct {
// contains filtered or unexported fields
}
func (*XmlContentReader) Read ¶
func (x *XmlContentReader) Read() (string, error)