func GetAdvanceReservationID(v *InternalJobStatus) int {
	return v.Jobinf.Element.JbAr
}
GetAdvanceReservationID returns the advance reservation ID the job has
requested.
package geparser
import (
	"encoding/xml"
	"fmt"
	"github.com/dgruber/drmaa"
	"log"
	"os/exec"
	"strconv"
	"time"
)
var cachedJobStatus = map[string]jobStatusCache{}
func getValidJobStatusFromCache(jobID string) (ijs InternalJobStatus, found bool) {
	if cachedJobStatus == nil {
		return ijs, false
	}
	if cjs, found := cachedJobStatus[jobID]; found {
		lastUpdate := time.Since(cjs.lastUpdate)
		if lastUpdate.Seconds() <= 5 {
			return cjs.jobStatus, true
		}
	}
	return ijs, false
}
func Unix(value, unused int64) time.Time {
	if value > 631152000000 {
		return time.Unix(int64(value/1000), 0)
	}
	return time.Unix(value, 0)
}
type JBEnvElem struct {
	VAvariable string `xml:"VA_variable"`
	VAvalue string `xml:"VA_value"`
	VAaccessSpecifier int `xml:"VA_access_specifier"`
}
type JBEnvList struct {
	JBEnvElement []JBEnvElem `xml:"element"`
}
type JBJobArgsElement struct {
	STname string `xml:"ST_name"`
	STpos int `xml:"ST_pos"`
	STaccessSpecifier int `xml:"ST_access_specifier"`
}
type JBJobArgs struct {
	JBjobArgs []JBJobArgsElement `xml:"element"`
}
type JATScaledElements struct {
	UAname string `xml:"UA_name"`
	UAvalue string `xml:"UA_value"`
}
type JATScaledUsageList struct {
	JATscaled82 []JATScaledElements `xml:"Events"`
	JATscaled []JATScaledElements `xml:"scaled"`
}
type JGBinding struct {
	JGbindingElement BNElement `xml:"binding"`
}
type GDILElement struct {
	JGqname string `xml:"JG_qname"`
	JGqversion string `xml:"JG_qversion"`
	JGqhostname string `xml:"JG_qhostname"`
	JGslots int `xml:"JG_slots"`
	JGqueue string `xml:"JG_queue"`
	JGtagslavejob int `xml:"JG_tag_slave_job"`
	JGticket float64 `xml:"JG_ticket"`
	JGoticket float64 `xml:"JG_oticket"`
	JGfticket float64 `xml:"JG_fticket"`
	JGsticket float64 `xml:"JG_sticket"`
	JGjcoticket float64 `xml:"JG_jcoticket"`
	JGjcfticket float64 `xml:"JG_jcfticket"`
	JGbinding JGBinding `xml:"JG_binding"`
}
type JATGDIL struct {
	GdilElement []GDILElement `xml:"element"`
}
type JBJaSublist struct {
	JATstatus int `xml:"JAT_status"`
	JATtasknumber int `xml:"JAT_task_number"`
	JATscaledusagelist JATScaledUsageList `xml:"JAT_scaled_usage_list"`
	JATstarttime int64 `xml:"JAT_start_time"`
	JATgranteddestinidentifierlist JATGDIL `xml:"JAT_granted_destin_identifier_list"`
}
type JBJaTasks struct {
	JaTaskSublist82 []JBJaSublist `xml:"element"`
	JaTaskSublist []JBJaSublist `xml:"ulong_sublist"`
}
type TaskidRange struct {
	RNmin int `xml:"RN_min"`
	RNmax int `xml:"RN_max"`
	RNstep int `xml:"RN_step"`
}
type JBJAStructure struct {
	TaskIDrange TaskidRange `xml:"task_id_range"`
}
type BNElement struct {
	BNstrategy string `xml:"BN_strategy"`
	BNtype int `xml:"BN_type"`
	BNparameterN int `xml:"BN_parameter_n"`
	BNparameterSocket int `xml:"BN_parameter_socket"`
	BNparameterCoreOffset int `xml:"BN_parameter_core_offset"`
	BNparameterStridingStepSize int `xml:"BN_parameter_striding_step_size"`
	BNparameterExplicit string `xml:"BN_parameter_explicit"`
	BNparameterNlocal int `xml:"BN_parameter_nlocal"`
}
type JBBinding struct {
	BindingElement BNElement `xml:"element"`
}
type MRElement struct {
	User string `xml:"MR_user"`
	Host string `xml:"MR_host"`
}
type JBMailList struct {
	MailElement []MRElement `xml:"element"`
}
type JBHard struct {
	HardResourceRequest []HardElement `xml:"element"`
}
type HardElement struct {
	Name string `xml:"CE_name"`
	ValType int `xml:"CE_valtype"`
	StringVal string `xml:"CE_stringval"`
	DoubleVal float64 `xml:"CE_doubleval"`
	Consumable int `xml:"CE_consumable"`
}
type RangeElement struct {
	RnMin int64 `xml:"RN_min"`
	RnMax int64 `xml:"RN_max"`
	RnStep int64 `xml:"RN_step"`
}
type JBPERange struct {
	Range RangeElement `xml:"element"`
}
type Element struct {
	JbJobNumber int64 `xml:"JB_job_number"`
	JbAr int `xml:"JB_ar"`
	JbExecFile string `xml:"JB_exec_file"`
	JbSubmissionTime string `xml:"JB_submission_time"`
	JbOwner string `xml:"JB_owner"`
	JbUID int `xml:"JB_uid"`
	JbGroup string `xml:"JB_group"`
	JbGid int `xml:"JB_gid"`
	JbAccount string `xml:"JB_account"`
	JbMergeStderr bool `xml:"JB_merge_stderr"`
	JbNotify string `xml:"JB_notify"`
	JbJobName string `xml:"JB_job_name"`
	JbJobShare int `xml:"JB_job_share"`
	JbEnvList JBEnvList `xml:"JB_env_list"`
	JbJobArgs JBJobArgs `xml:"JB_job_args"`
	JbScriptFile string `xml:"JB_script_file"`
	JbJaTasks JBJaTasks `xml:"JB_ja_tasks"`
	JbDeadline int64 `xml:"JB_deadline"`
	JbExecutionTime int64 `xml:"JB_execution_time"`
	JbCheckpointAttr string `xml:"JB_checkpoint_attr"`
	JbCheckpointIntvl int `xml:"JB_checkpoint_interval"`
	JbReserve bool `xml:"JB_reserve"`
	JbMailOptions string `xml:"JB_mail_options"`
	JbPriority int `xml:"JB_priority"`
	JbRestart int `xml:"JB_restart"`
	JbVerify int `xml:"JB_verify"`
	JbScriptSize int `xml:"JB_script_size"`
	JbVerifySuitableQueues int `xml:"JB_verify_suitable_queues"`
	JbSoftWallclockGmt int `xml:"JB_soft_wallclock_gmt"`
	JbHardWallclockGmt int `xml:"JB_hard_wallclock_gmt"`
	JbHardResourceRequest JBHard `xml:"JB_hard_resource_list"`
	JbOverrideTickets int `xml:"JB_override_tickets"`
	JbVersion int `xml:"JB_version"`
	JbJaStructure JBJAStructure `xml:"JB_ja_structure"`
	JbType int `xml:"JB_type"`
	JbBinding JBBinding `xml:"JB_binding"`
	JbMbind int `xml:"JB_mbind"`
	JbIsBinary bool `xml:"JB_is_binary"`
	JbNoShell bool `xml:"JB_no_shell"`
	JbIsArray bool `xml:"JB_is_array"`
	JbIsImmediate bool `xml:"JB_is_immediate"`
	JbJcName string `xml:"JB_jc_name"`
	JbMailList JBMailList `xml:"JB_mail_list"`
	JbPe string `xml:"JB_pe"`
	JbPeRange JBPERange `xml:"JB_pe_range"`
}
type DjobInfo struct {
	Element Element `xml:"element"`
}
type InternalJobStatus struct {
	XMLName xml.Name `xml:"detailed_job_info"`
	Jobinf DjobInfo `xml:"djob_info"`
}
type GDIL struct {
	QueueName string
	Slots int
	Ticket float64
	OverrideTicket float64
	FunctionalTicket float64
	SharetreeTicket float64
}
type QstatJob struct {
	JBjobnumber int64 `xml:"JB_job_number"`
	JATprio float64 `xml:"JAT_prio"`
	JBname string `xml:"JB_name"`
	JBowner string `xml:"JB_owner"`
	State string `xml:"state"`
	JATstarttime string `xml:"JAT_start_time"`
	QueueName string `xml:"queue_name"`
	JClassName string `xml:"jclass_name"`
	Slots int64 `xml:"slots"`
}
type QstatJobInfoList struct {
	XMLName xml.Name `xml:"job_info"`
	JobList []QstatJob `xml:"queue_info>job_list"`
}
func GetJobName(v *InternalJobStatus) string {
	return v.Jobinf.Element.JbJobName
}
func GetJobNumber(v *InternalJobStatus) int64 {
	return v.Jobinf.Element.JbJobNumber
}
func GetExecFileName(v *InternalJobStatus) string {
	return v.Jobinf.Element.JbExecFile
}
func GetJobArgs(v *InternalJobStatus) []string {
	args := make([]string, len(v.Jobinf.Element.JbJobArgs.JBjobArgs))
	for _, i := range v.Jobinf.Element.JbJobArgs.JBjobArgs {
		args = append(args, i.STname)
	}
	return args
}
func GetScriptFile(v *InternalJobStatus) string {
	return v.Jobinf.Element.JbScriptFile
}