drmaa package - github.com/dgruber/drmaa - Go Packages (original) (raw)

Package drmaa is a job submission library for job schedulers like Univa Grid Engine. It is based on the open Distributed Resource Management Application API standard (version 1). It requires a C library (libdrmaa.so) usually shipped with a job job scheduler.

Timeout is either a positive number in seconds or one of those constants.

View Source

const (

Suspend controlType = [iota](/builtin#iota)

Resume

Hold

Release

Terminate

)

PlaceholderHomeDirectory is a placeholder for the user's home directory when filling out job template.

PlaceholderTaskID is a placeholder for the array job task ID which can be used in the job template (like in the input or output path specification).

PlaceholderWorkingDirectory is a placeholder for the working directory path which can be used in the job template (like in the input or output path specification).

This section is empty.

GetContact returns the contact string of the DRM system.

GetVersion returns the version of the DRMAA standard.

StrError maps an ErrorId to an error string.

type Error struct { Message string ID ErrorID }

Error is a Go DRMAA error type which implements the Go Error interface with the Error() method. Each external error can be casted to a pointer to that struct in order to get more information about the error (the error id).

Error implements the Go error interface for the drmaa.Error type.

ErrorID is DRMAA error ID representation type

const (

Success [ErrorID](#ErrorID) = [iota](/builtin#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

)

type FileTransferMode struct { ErrorStream bool InputStream bool OutputStream bool }

FileTransferMode determines which files should be staged.

JobInfo contains all runtime information about a job.

func (ji *JobInfo) ExitStatus() int64

ExitStatus returns the exit status of the job.

func (ji *JobInfo) HasAborted() bool

HasAborted returns if the job was aborted.

func (ji *JobInfo) HasCoreDump() bool

HasCoreDump returns if the job has generated a core dump.

func (ji *JobInfo) HasExited() bool

HasExited returns if the job has exited.

func (ji *JobInfo) HasSignaled() bool

HasSignaled returns if the job has been signaled.

JobID returns the job id as string.

ResourceUsage returns the resource usage as a map.

func (ji *JobInfo) TerminationSignal() string

TerminationSignal returns the termination signal of the job.

type JobTemplate struct {

}

JobTemplate represents a job template which is required to submit a job. A JobTemplate contains job submission parameters like a name, accounting string, command to execute, it's arguments and so on. In this implementation within a job template a pointer to an allocated C job template is stored which must be freed by the user. The values can only be accessed by the defined methods.

Args returns the arguments set in the job template for the jobs process.

BlockEmail returns true if BLOCK_EMAIL is set in the job template.

DeadlineTime returns deadline time. Unsupported in Grid Engine.

Email returns the email addresses set in the job template which are notified on defined events of the underlying job.

Env returns the environment variables set in the job template for the jobs process.

ErrorPath returns the error path set in the job template.

HardRunDurationLimit returns the hard run-time limit for the job from the job template.

HardWallclockTimeLimit returns the wall-clock time set in the job template.

InputPath returns the input file of the remote command set in the job template.

JobName returns the name set in the job template.

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

JobSubmissionState returns the job submission state set in the job template.

JoinFiles returns if join files is set in the job template.

NativeSpecification returns the native specification set i in the job template. The native specification string is used for injecting DRM specific job submission requests to the system.

OutputPath returns the output path set in the job template.

func (*JobTemplate) RemoteCommand

RemoteCommand returns the currently set binary which is going to be executed from the job template.

SetArg sets a single argument. Simple wrapper for SetArgs([]string{arg}).

SetArgs sets the arguments for the job executable in the job template.

SetBlockEmail set the DRMAA_BLOCK_EMAIL in the job template. When this is set it overrides any default behavior of the that might send emails when a job reached a specific state. This is used to prevent emails are going to be send.

SetDeadlineTime sets deadline time in job template. Unsupported in Grid Engine.

SetEmail sets the emails addresses in the job template used by the cluster scheduler to send emails to.

SetEnv sets a set of environment variables inherited from the current environment forwarded to the environment of the job when it is executed.

SetErrorPath sets the path to a directory or a file which is used as error file or directory. Everything the job writes to standard error (stderr) is written in that file.

SetHardRunDurationLimit sets a hard run-time limit for the job in the job template.

SetHardWallclockTimeLimit sets a hard wall-clock time limit for the job.

SetInputPath sets the input file which the job gets set when it is executed. The content of the file is forwarded as STDIN to the job.

SetJobName sets the name of the job in the job template.

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

SetJobSubmissionState sets the job submission state (like the hold state) in the job template.

SetJoinFiles sets that the error and output files of the job have to be joined.

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

SetOutputPath sets the path to a directory or a file which is used as output file or directory. Everything the job writes to standard output (stdout) is written in that file.

func (*JobTemplate) SetRemoteCommand

SetRemoteCommand sets the path or the name of the binary to be started as a job in the job template.

SetSoftRunDurationLimit sets the soft run-time limit for the job in the job template.

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

SetStartTime sets the earliest job start time for the job.

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

SetTransferFiles sets the file transfer mode in the job template.

SetWD sets the working directory for the job in the job template.

SoftRunDurationLimit returns the soft run-time limit set in the job template.

SoftWallclockTimeLimit returns the soft wall-clock time limit for the job set in the job template.

StartTime returns the job start time set for the job.

String implements the Stringer interface for the JobTemplate. Note that this operation is not very efficient since it needs to get all values out of the C object.

TransferFiles returns the FileTransferModes set in the job template.

WD returns the working directory set in the job template

PsType specifies a job state (output of JobPs()).

const (

PsUndetermined [PsType](#PsType) = [iota](/builtin#iota)

PsQueuedActive

PsSystemOnHold

PsUserOnHold

PsUserSystemOnHold

PsRunning

PsSystemSuspended

PsUserSuspended

PsUserSystemSuspended

PsDone

PsFailed

)

String implements Stringer interface for simplified output of the job state (PsType).

Session is a type which represents a DRMAA session.

MakeSession creates and initializes a new DRMAA session.

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

AllocateJobTemplate allocates a new C drmaa job template. On successful allocation the DeleteJobTemplate() method must be called in order to avoid memory leaks.

Control sends a job modification request, i.e. terminates, suspends, resumes a job or sets it in a the hold state or release it from the job hold state.

func (s *Session) DeleteJobTemplate(jt *JobTemplate) error

DeleteJobTemplate delets (and frees memory) of an allocated job template. Must be called in to prevent memory leaks. JobTemplates are not handled in Go garbage collector.

Exit disengages a session frmo the DRMAA library and cleans it up.

GetAttributeNames returns a set of supported DRMAA attributes allowed in the job template.

GetDrmSystem returns the DRM system identification string.

func (s *Session) GetDrmaaImplementation() string

GetDrmaaImplementation returns information about the DRMAA implementation.

GetVectorAttributeNames returns a set of supported DRMAA vector attributes allowed in a C job template. This functionality is not required for the Go DRMAA implementation.

HoldJob put a job into the hold state.

Init intitializes a DRMAA session. If contact string is "" a new session is created otherwise an existing session is connected.

JobPs returns the current state of a job.

ReleaseJob removes a hold state from a job.

ResumeJob sends a job resume request to the job executor.

RunBulkJobs submits a job as an array job.

RunJob submits a job in a (initialized) session to the cluster scheduler.

SuspendJob sends a job suspenion request to the job executor.

Synchronize blocks the programm until the given jobs finshed or a specific timeout is reached.

TerminateJob sends a job termination request to the job executor.

Wait blocks until the job left the DRM system or a timeout is reached and returns a JobInfo structure.

SubmissionState is the initial job state when the job is submitted.

const (

HoldState [SubmissionState](#SubmissionState) = [iota](/builtin#iota)

ActiveState

)