import "drmaa"
Overview
Index

Overview

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.

Index

Constants
func GetContact() (string, *Error)
func GetVersion() (int, int, *Error)
func StrError(id ErrorId) string
type Error
    func (ce Error) Error() string
type ErrorId
type FileTransferMode
type JobInfo
    func (ji *JobInfo) ExitStatus() int64
    func (ji *JobInfo) HasAborted() bool
    func (ji *JobInfo) HasCoreDump() bool
    func (ji *JobInfo) HasExited() bool
    func (ji *JobInfo) HasSignaled() bool
    func (ji *JobInfo) JobId() string
    func (ji *JobInfo) ResourceUsage() map[string]string
    func (ji *JobInfo) TerminationSignal() string
type JobTemplate
    func (jt *JobTemplate) BlockEmail() (bool, *Error)
    func (jt *JobTemplate) DeadlineTime() (deadlineTime time.Duration, err *Error)
    func (jt *JobTemplate) ErrorPath() (string, *Error)
    func (jt *JobTemplate) HardRunDurationLimit() (deadlineTime time.Duration, err *Error)
    func (jt *JobTemplate) HardWallclockTimeLimit() (deadlineTime time.Duration, err *Error)
    func (jt *JobTemplate) InputPath() (string, *Error)
    func (jt *JobTemplate) JobName() (string, *Error)
    func (jt *JobTemplate) JobSubmissionState() (SubmissionState, *Error)
    func (jt *JobTemplate) JoinFiles() (bool, *Error)
    func (jt *JobTemplate) NativeSpecification() (string, *Error)
    func (jt *JobTemplate) OutputPath() (string, *Error)
    func (jt *JobTemplate) RemoteCommand() (string, *Error)
    func (jt *JobTemplate) SetArg(arg string) *Error
    func (jt *JobTemplate) SetArgs(args []string) *Error
    func (jt *JobTemplate) SetBlockEmail(blockmail bool) *Error
    func (jt *JobTemplate) SetDeadlineTime(deadline time.Duration) *Error
    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
    func (jt *JobTemplate) SetHardWallclockTimeLimit(limit time.Duration) *Error
    func (jt *JobTemplate) SetInputPath(path string) *Error
    func (jt *JobTemplate) SetJobName(jobname string) *Error
    func (jt *JobTemplate) SetJobSubmissionState(state SubmissionState) *Error
    func (jt *JobTemplate) SetJoinFiles(join bool) *Error
    func (jt *JobTemplate) SetNativeSpecification(native string) *Error
    func (jt *JobTemplate) SetOutputPath(path string) *Error
    func (jt *JobTemplate) SetRemoteCommand(cmd string) *Error
    func (jt *JobTemplate) SetSoftRunDurationLimit(limit time.Duration) *Error
    func (jt *JobTemplate) SetSoftWallclockTimeLimit(limit time.Duration) *Error
    func (jt *JobTemplate) SetStartTime(time time.Time) *Error
    func (jt *JobTemplate) SetTransferFiles(mode FileTransferMode) *Error
    func (jt *JobTemplate) SetWD(dir string) *Error
    func (jt *JobTemplate) SoftRunDurationLimit() (deadlineTime time.Duration, err *Error)
    func (jt *JobTemplate) SoftWallclockTimeLimit() (deadlineTime time.Duration, err *Error)
    func (jt *JobTemplate) StartTime() (time.Time, *Error)
    func (jt *JobTemplate) TransferFiles() (FileTransferMode, *Error)
    func (jt *JobTemplate) WD() (string, *Error)
type PsType
    func (pt PsType) String() string
type Session
    func MakeSession() (Session, *Error)
    func (s *Session) AllocateJobTemplate() (jt JobTemplate, err *Error)
    func (s *Session) Control(jobId string, action controlType) *Error
    func (s *Session) DeleteJobTemplate(jt *JobTemplate) *Error
    func (s *Session) Exit() *Error
    func (s *Session) GetDrmSystem() (string, *Error)
    func (s *Session) GetDrmaaImplementation() string
    func (s *Session) HoldJob(jobId string) *Error
    func (s *Session) Init(contactString string) *Error
    func (s *Session) JobPs(jobId string) (PsType, *Error)
    func (s *Session) ReleaseJob(jobId string) *Error
    func (s *Session) ResumeJob(jobId string) *Error
    func (s *Session) RunBulkJobs(jt *JobTemplate, start, end, incr int) ([]string, *Error)
    func (s *Session) RunJob(jt *JobTemplate) (string, *Error)
    func (s *Session) SuspendJob(jobId string) *Error
    func (s *Session) Synchronize(jobIds []string, timeout int64, dispose bool) *Error
    func (s *Session) TerminateJob(jobId string) *Error
    func (s *Session) Wait(jobId string, timeout int64) (jobinfo JobInfo, err *Error)
type SubmissionState

Package files

drmaa.go

Constants

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

func GetContact() (string, *Error)

Get contact string.

func GetVersion

func GetVersion() (int, int, *Error)

Get the version of the DRMAA standard.

func StrError

func StrError(id ErrorId) string

Maps an ErrorId to an error string.

type Error

type Error struct {
    Message string
    Id      ErrorId
}

GO DRMAA error (implements GO Error interface).

func (Error) Error

func (ce Error) Error() string

A GO DRMAA error implements GO error interface.

type ErrorId

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

type FileTransferMode struct {
    ErrorStream  bool
    InputStream  bool
    OutputStream bool
}

File transfer mode struct.

type JobInfo

type JobInfo struct {
    // contains filtered or unexported fields
}

Job information struct.

func (*JobInfo) ExitStatus

func (ji *JobInfo) ExitStatus() int64

func (*JobInfo) HasAborted

func (ji *JobInfo) HasAborted() bool

Returns if the job was aborted.

func (*JobInfo) HasCoreDump

func (ji *JobInfo) HasCoreDump() bool

Returns if the job has generated a core dump.

func (*JobInfo) HasExited

func (ji *JobInfo) HasExited() bool

Returns if the job has exited.

func (*JobInfo) HasSignaled

func (ji *JobInfo) HasSignaled() bool

Returns if the job has been signaled.

func (*JobInfo) JobId

func (ji *JobInfo) JobId() string

Returns the job id as string.

func (*JobInfo) ResourceUsage

func (ji *JobInfo) ResourceUsage() map[string]string

Retursn the resource usage as a map.

func (*JobInfo) TerminationSignal

func (ji *JobInfo) TerminationSignal() string

Returns the termination signal of the job.

type JobTemplate

type JobTemplate struct {
    // contains filtered or unexported fields
}

func (*JobTemplate) BlockEmail

func (jt *JobTemplate) BlockEmail() (bool, *Error)

func (*JobTemplate) DeadlineTime

func (jt *JobTemplate) DeadlineTime() (deadlineTime time.Duration, err *Error)

Unsupported in Grid Engine.

func (*JobTemplate) ErrorPath

func (jt *JobTemplate) ErrorPath() (string, *Error)

func (*JobTemplate) HardRunDurationLimit

func (jt *JobTemplate) HardRunDurationLimit() (deadlineTime time.Duration, err *Error)

Gets the hard run-duration limit for the job in the job template.

func (*JobTemplate) HardWallclockTimeLimit

func (jt *JobTemplate) HardWallclockTimeLimit() (deadlineTime time.Duration, err *Error)

Gets the wall-clock time set in the job template.

func (*JobTemplate) InputPath

func (jt *JobTemplate) InputPath() (string, *Error)

Returns the set input path ot the remote command in the job template.

func (*JobTemplate) JobName

func (jt *JobTemplate) JobName() (string, *Error)

Returns the name set in the job template.

func (*JobTemplate) JobSubmissionState

func (jt *JobTemplate) JobSubmissionState() (SubmissionState, *Error)

func (*JobTemplate) JoinFiles

func (jt *JobTemplate) JoinFiles() (bool, *Error)

func (*JobTemplate) NativeSpecification

func (jt *JobTemplate) NativeSpecification() (string, *Error)

Gets the native specificatio set in the job template.

func (*JobTemplate) OutputPath

func (jt *JobTemplate) OutputPath() (string, *Error)

func (*JobTemplate) RemoteCommand

func (jt *JobTemplate) RemoteCommand() (string, *Error)

Returns the currently set binary.

func (*JobTemplate) SetArg

func (jt *JobTemplate) SetArg(arg string) *Error

Set single argument. Simple wrapper for SetArgs([]string{arg}).

func (*JobTemplate) SetArgs

func (jt *JobTemplate) SetArgs(args []string) *Error

func (*JobTemplate) SetBlockEmail

func (jt *JobTemplate) SetBlockEmail(blockmail bool) *Error

func (*JobTemplate) SetDeadlineTime

func (jt *JobTemplate) SetDeadlineTime(deadline time.Duration) *Error

Unsupported in Grid Engine.

func (*JobTemplate) SetEmail

func (jt *JobTemplate) SetEmail(emails []string) *Error

func (*JobTemplate) SetEnv

func (jt *JobTemplate) SetEnv(envs []string) *Error

func (*JobTemplate) SetErrorPath

func (jt *JobTemplate) SetErrorPath(path string) *Error

func (*JobTemplate) SetHardRunDurationLimit

func (jt *JobTemplate) SetHardRunDurationLimit(limit time.Duration) *Error

Sets a hard run-duration limit for the job in the job tempplate.

func (*JobTemplate) SetHardWallclockTimeLimit

func (jt *JobTemplate) SetHardWallclockTimeLimit(limit time.Duration) *Error

Sets a hard wall-clock time limit for the job.

func (*JobTemplate) SetInputPath

func (jt *JobTemplate) SetInputPath(path string) *Error

Sets the input path of the remote command in the job template.

func (*JobTemplate) SetJobName

func (jt *JobTemplate) SetJobName(jobname string) *Error

Sets the name of the job in the job template.

func (*JobTemplate) SetJobSubmissionState

func (jt *JobTemplate) SetJobSubmissionState(state SubmissionState) *Error

template attributes

func (*JobTemplate) SetJoinFiles

func (jt *JobTemplate) SetJoinFiles(join bool) *Error

Sets that the error and output files have to be joined.

func (*JobTemplate) SetNativeSpecification

func (jt *JobTemplate) SetNativeSpecification(native string) *Error

Sets the native specification (DRM system depended job submission settings) for the job.

func (*JobTemplate) SetOutputPath

func (jt *JobTemplate) SetOutputPath(path string) *Error

func (*JobTemplate) SetRemoteCommand

func (jt *JobTemplate) SetRemoteCommand(cmd string) *Error

Sets the name of the binary to start in the job template.

func (*JobTemplate) SetSoftRunDurationLimit

func (jt *JobTemplate) SetSoftRunDurationLimit(limit time.Duration) *Error

Sets the soft run duration limit for the job in the job template.

func (*JobTemplate) SetSoftWallclockTimeLimit

func (jt *JobTemplate) SetSoftWallclockTimeLimit(limit time.Duration) *Error

Sets a soft wall-clock time limit for the job in the job template.

func (*JobTemplate) SetStartTime

func (jt *JobTemplate) SetStartTime(time time.Time) *Error

Sets the earliest job start time for the job.

func (*JobTemplate) SetTransferFiles

func (jt *JobTemplate) SetTransferFiles(mode FileTransferMode) *Error

func (*JobTemplate) SetWD

func (jt *JobTemplate) SetWD(dir string) *Error

func (*JobTemplate) SoftRunDurationLimit

func (jt *JobTemplate) SoftRunDurationLimit() (deadlineTime time.Duration, err *Error)

Gets teh soft run duration limit set in the job template.

func (*JobTemplate) SoftWallclockTimeLimit

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 (*JobTemplate) StartTime

func (jt *JobTemplate) StartTime() (time.Time, *Error)

Returns the job start time set for the job.

func (*JobTemplate) TransferFiles

func (jt *JobTemplate) TransferFiles() (FileTransferMode, *Error)

func (*JobTemplate) WD

func (jt *JobTemplate) WD() (string, *Error)

Gets the working directory set in the job template

type PsType

type PsType int

Job state according to last query.

const (
    PsUndetermined PsType = iota
    PsQueuedActive
    PsSystemOnHold
    PsUserOnHold
    PsUserSystemOnHold
    PsRunning
    PsSystemSuspended
    PsUserSuspended
    PsUserSystemSuspended
    PsDone
    PsFailed
)

func (PsType) String

func (pt PsType) String() string

Job state implements Stringer interface for simple output.

type Session

type Session struct {
    // contains filtered or unexported fields
}

A DRMAA session.

func MakeSession

func MakeSession() (Session, *Error)

Creates and initializes a new DRMAA session.

func (*Session) AllocateJobTemplate

func (s *Session) AllocateJobTemplate() (jt JobTemplate, err *Error)

Allocates a new job template.

func (*Session) Control

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 (*Session) DeleteJobTemplate

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 (*Session) Exit

func (s *Session) Exit() *Error

Disengages a session frmo the DRMAA library and cleans it up.

func (*Session) GetDrmSystem

func (s *Session) GetDrmSystem() (string, *Error)

Get the DRM system.

func (*Session) GetDrmaaImplementation

func (s *Session) GetDrmaaImplementation() string

Get information about the DRMAA implementation.

func (*Session) HoldJob

func (s *Session) HoldJob(jobId string) *Error

Simple wrapper for Control(jobId, Hold).

func (*Session) Init

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 (*Session) JobPs

func (s *Session) JobPs(jobId string) (PsType, *Error)

Returns the state of a job.

func (*Session) ReleaseJob

func (s *Session) ReleaseJob(jobId string) *Error

Simple wrapper for Control(jobId, Release).

func (*Session) ResumeJob

func (s *Session) ResumeJob(jobId string) *Error

Simple wrapper for Control(jobId, Resume).

func (*Session) RunBulkJobs

func (s *Session) RunBulkJobs(jt *JobTemplate, start, end, incr int) ([]string, *Error)

Submits a job as an array job.

func (*Session) RunJob

func (s *Session) RunJob(jt *JobTemplate) (string, *Error)

Submits a job in a (initialized) session to the DRM.

func (*Session) SuspendJob

func (s *Session) SuspendJob(jobId string) *Error

Simple wrapper for Control(jobId, Suspend).

func (*Session) Synchronize

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 (*Session) TerminateJob

func (s *Session) TerminateJob(jobId string) *Error

Simple wrapper for Control(jobId, Terminate).

func (*Session) Wait

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

type SubmissionState int

Initial job state when sub is submitted.

const (
    HoldState SubmissionState = iota
    ActiveState
)