This is a Go DRMAA language binding implementation.
Version 0.2 Changelog: 0.1 - First Release: Proof of Concept 0.2 - Added methods for accessing JobInfo struct. Author: Daniel Gruber, info@gridengine.org, 2012 IT IS FREE TO USE IN ANY ENVIRONMENT FOR ANY USE CASE. IF YOU NEED TO RE-DISTRIBUTE THE LIBRARY OUTSIDE OF YOUR ORGANIZATION (COMPANY/ UNIVERSITY) SIMPLY POINT THE USER TO THE ORIGINAL LOCATION at www.gridengine.eu.
const ( TimeoutWaitForever int64 = -1 TimeoutNoWait int64 = 0 )
Timeout is either a positive number in seconds or one of those constants.
const ( Suspend controlType = iota Resume Hold Release Terminate )
const ( Undetermined jobState = iota QueuedActive SystemOnHold UserOnHold UserSystemOnHold Running SystemSuspended UserSystemSuspended Done Failed )
func GetContact() (string, *Error)
Get contact string.
func GetVersion() (int, int, *Error)
Get the version of the DRMAA standard.
func StrError(id ErrorId) string
Maps an ErrorId to an error string.
type Error struct { Message string Id ErrorId }
GO DRMAA error (implements GO Error interface).
func (ce Error) Error() string
A GO DRMAA error implements GO error interface.
type ErrorId int
DRMAA error IDs.
const ( Success ErrorId = iota InternalError DrmCommunicationFailure AuthFailure InvalidArgument NoActiveSession NoMemory InvalidContactString DefaultContactStringError NoDefaultContactStringSelected DrmsInitFailed AlreadyActiveSession DrmsExitError InvalidAttributeFormat InvalidAttributeValue ConflictingAttributeValues TryLater DeniedByDrm InvalidJob ResumeInconsistentState SuspendInconsistentState HoldInconsistentState ReleaseInconsistentState ExitTimeout NoRusage NoMoreElements NoErrno )
type FileTransferMode struct { ErrorStream bool InputStream bool OutputStream bool }
File transfer mode struct.
type JobInfo struct {
// contains filtered or unexported fields
}
Job information struct.
func (ji *JobInfo) ExitStatus() int64
func (ji *JobInfo) HasAborted() bool
Returns if the job was aborted.
func (ji *JobInfo) HasCoreDump() bool
Returns if the job has generated a core dump.
func (ji *JobInfo) HasExited() bool
Returns if the job has exited.
func (ji *JobInfo) HasSignaled() bool
Returns if the job has been signaled.
func (ji *JobInfo) JobId() string
Returns the job id as string.
func (ji *JobInfo) ResourceUsage() map[string]string
Retursn the resource usage as a map.
func (ji *JobInfo) TerminationSignal() string
Returns the termination signal of the job.
type JobTemplate struct {
// contains filtered or unexported fields
}
func (jt *JobTemplate) BlockEmail() (bool, *Error)
func (jt *JobTemplate) DeadlineTime() (deadlineTime time.Duration, err *Error)
Unsupported in Grid Engine.
func (jt *JobTemplate) ErrorPath() (string, *Error)
func (jt *JobTemplate) HardRunDurationLimit() (deadlineTime time.Duration, err *Error)
Gets the hard run-duration limit for the job in the job template.
func (jt *JobTemplate) HardWallclockTimeLimit() (deadlineTime time.Duration, err *Error)
Gets the wall-clock time set in the job template.
func (jt *JobTemplate) InputPath() (string, *Error)
Returns the set input path ot the remote command in the job template.
func (jt *JobTemplate) JobName() (string, *Error)
Returns the name set in the job template.
func (jt *JobTemplate) JobSubmissionState() (SubmissionState, *Error)
func (jt *JobTemplate) JoinFiles() (bool, *Error)
func (jt *JobTemplate) NativeSpecification() (string, *Error)
Gets the native specificatio set in the job template.
func (jt *JobTemplate) OutputPath() (string, *Error)
func (jt *JobTemplate) RemoteCommand() (string, *Error)
Returns the currently set binary.
func (jt *JobTemplate) SetArg(arg string) *Error
Set single argument. Simple wrapper for SetArgs([]string{arg}).
func (jt *JobTemplate) SetArgs(args []string) *Error
func (jt *JobTemplate) SetBlockEmail(blockmail bool) *Error
func (jt *JobTemplate) SetDeadlineTime(deadline time.Duration) *Error
Unsupported in Grid Engine.
func (jt *JobTemplate) SetEmail(emails []string) *Error
func (jt *JobTemplate) SetEnv(envs []string) *Error
func (jt *JobTemplate) SetErrorPath(path string) *Error
func (jt *JobTemplate) SetHardRunDurationLimit(limit time.Duration) *Error
Sets a hard run-duration limit for the job in the job tempplate.
func (jt *JobTemplate) SetHardWallclockTimeLimit(limit time.Duration) *Error
Sets a hard wall-clock time limit for the job.
func (jt *JobTemplate) SetInputPath(path string) *Error
Sets the input path of the remote command in the job template.
func (jt *JobTemplate) SetJobName(jobname string) *Error
Sets the name of the job in the job template.
func (jt *JobTemplate) SetJobSubmissionState(state SubmissionState) *Error
template attributes
func (jt *JobTemplate) SetJoinFiles(join bool) *Error
Sets that the error and output files have to be joined.
func (jt *JobTemplate) SetNativeSpecification(native string) *Error
Sets the native specification (DRM system depended job submission settings) for the job.
func (jt *JobTemplate) SetOutputPath(path string) *Error
func (jt *JobTemplate) SetRemoteCommand(cmd string) *Error
Sets the name of the binary to start in the job template.
func (jt *JobTemplate) SetSoftRunDurationLimit(limit time.Duration) *Error
Sets the soft run duration limit for the job in the job template.
func (jt *JobTemplate) SetSoftWallclockTimeLimit(limit time.Duration) *Error
Sets a soft wall-clock time limit for the job in the job template.
func (jt *JobTemplate) SetStartTime(time time.Time) *Error
Sets the earliest job start time for the job.
func (jt *JobTemplate) SetTransferFiles(mode FileTransferMode) *Error
func (jt *JobTemplate) SetWD(dir string) *Error
func (jt *JobTemplate) SoftRunDurationLimit() (deadlineTime time.Duration, err *Error)
Gets teh soft run duration limit set in the job template.
func (jt *JobTemplate) SoftWallclockTimeLimit() (deadlineTime time.Duration, err *Error)
Gets a soft wall-clock time limit for the job set in the job template.
func (jt *JobTemplate) StartTime() (time.Time, *Error)
Returns the job start time set for the job.
func (jt *JobTemplate) TransferFiles() (FileTransferMode, *Error)
func (jt *JobTemplate) WD() (string, *Error)
Gets the working directory set in the job template
type PsType int
Job state according to last query.
const ( PsUndetermined PsType = iota PsQueuedActive PsSystemOnHold PsUserOnHold PsUserSystemOnHold PsRunning PsSystemSuspended PsUserSuspended PsUserSystemSuspended PsDone PsFailed )
func (pt PsType) String() string
Job state implements Stringer interface for simple output.
type Session struct {
// contains filtered or unexported fields
}
A DRMAA session.
func MakeSession() (Session, *Error)
Creates and initializes a new DRMAA session.
func (s *Session) AllocateJobTemplate() (jt JobTemplate, err *Error)
Allocates a new job template.
func (s *Session) Control(jobId string, action controlType) *Error
Controls a job, i.e. terminates, suspends, resumes a job or sets it in a the hold state or release it from the hold state.
func (s *Session) DeleteJobTemplate(jt *JobTemplate) *Error
Deletes (and frees memory) of an allocated job template. Must be called in to prevent memory leaks. JobTemplates are not handled in GO garbage collector.
func (s *Session) Exit() *Error
Disengages a session frmo the DRMAA library and cleans it up.
func (s *Session) GetDrmSystem() (string, *Error)
Get the DRM system.
func (s *Session) GetDrmaaImplementation() string
Get information about the DRMAA implementation.
func (s *Session) HoldJob(jobId string) *Error
Simple wrapper for Control(jobId, Hold).
func (s *Session) Init(contactString string) *Error
Initializes a DRMAA session. If contact string is "" a new session is created otherwise an existing session is connected.
func (s *Session) JobPs(jobId string) (PsType, *Error)
Returns the state of a job.
func (s *Session) ReleaseJob(jobId string) *Error
Simple wrapper for Control(jobId, Release).
func (s *Session) ResumeJob(jobId string) *Error
Simple wrapper for Control(jobId, Resume).
func (s *Session) RunBulkJobs(jt *JobTemplate, start, end, incr int) ([]string, *Error)
Submits a job as an array job.
func (s *Session) RunJob(jt *JobTemplate) (string, *Error)
Submits a job in a (initialized) session to the DRM.
func (s *Session) SuspendJob(jobId string) *Error
Simple wrapper for Control(jobId, Suspend).
func (s *Session) Synchronize(jobIds []string, timeout int64, dispose bool) *Error
Blocks the the programm until the given jobs left the system or a specific timeout is reached.
func (s *Session) TerminateJob(jobId string) *Error
Simple wrapper for Control(jobId, Terminate).
func (s *Session) Wait(jobId string, timeout int64) (jobinfo JobInfo, err *Error)
Blocks until the job left the DRM system or a timeout is reached and returns a JobInfo structure.
type SubmissionState int
Initial job state when sub is submitted.
const ( HoldState SubmissionState = iota ActiveState )