Documentation
¶
Overview ¶
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.
Index ¶
- Constants
- func GetContact() (string, error)
- func GetVersion() (int, int, error)
- func StrError(id ErrorID) string
- type Error
- 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) Args() ([]string, error)
- func (jt *JobTemplate) BlockEmail() (bool, error)
- func (jt *JobTemplate) DeadlineTime() (deadlineTime time.Duration, err error)
- func (jt *JobTemplate) Email() ([]string, error)
- func (jt *JobTemplate) Env() ([]string, 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) String() string
- func (jt *JobTemplate) TransferFiles() (FileTransferMode, error)
- func (jt *JobTemplate) WD() (string, error)
- type PsType
- type Session
- 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) GetAttributeNames() ([]string, error)
- func (s *Session) GetDrmSystem() (string, error)
- func (s *Session) GetDrmaaImplementation() string
- func (s *Session) GetVectorAttributeNames() ([]string, error)
- 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
Constants ¶
const ( // TimeoutWaitForever is a time value of infinit. TimeoutWaitForever int64 = -1 // TimeoutNoWait is a time value for zero. TimeoutNoWait int64 = 0 )
Timeout is either a positive number in seconds or one of those constants.
const ( // Suspend is a control action for suspending a job (usually sending SIGSTOP). Suspend controlType = iota // Resume is a control action fo resuming a suspended job. Resume // Hold is a control action for preventing that a job is going to be scheduled. Hold // Release is a control action for allowing that a job in hold state is allowed to be scheduled. Release // Terminate is a control action for deleting a job. Terminate )
const PlaceholderHomeDirectory string = "$drmaa_hd_ph$"
PlaceholderHomeDirectory is a placeholder for the user's home directory when filling out job template.
const PlaceholderTaskID string = "$drmaa_incr_ph$"
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).
const PlaceholderWorkingDirectory string = "$drmaa_wd_ph$"
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).
Variables ¶
This section is empty.
Functions ¶
func GetContact ¶
GetContact returns the contact string of the DRM system.
func GetVersion ¶
GetVersion returns the version of the DRMAA standard.
Types ¶
type Error ¶
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).
type ErrorID ¶
type ErrorID int
ErrorID is DRMAA error ID representation type
const ( // Success indicates that no errors occurred Success ErrorID = iota // InternalError indicates an error within the DRM InternalError // DrmCommunicationFailure indicates a communication problem DrmCommunicationFailure // AuthFailure indication an error during authentification AuthFailure // InvalidArgument indicates a wrong imput parameter or an unsupported method call InvalidArgument // NoActiveSession indicates an error due to a non valid session state NoActiveSession // NoMemory indicates an OOM situation NoMemory // InvalidContactString indicates a wrong contact string InvalidContactString // DefaultContactStringError indicates an error with the contact string DefaultContactStringError // NoDefaultContactStringSelected indicates an error with the contact string NoDefaultContactStringSelected // DrmsInitFailed indicates an error when establishing a connection to the DRM DrmsInitFailed // AlreadyActiveSession indicates an error with an already existing connection AlreadyActiveSession // DrmsExitError indicates an error when shutting down the connection to the DRM DrmsExitError // InvalidAttributeFormat is an attribute format error InvalidAttributeFormat // InvalidAttributeValue is an attribute value error InvalidAttributeValue // ConflictingAttributeValues is a semantic error with conflicting attribute settings ConflictingAttributeValues // TryLater indicates a temporal problem with the DRM TryLater // DeniedByDrm indicates a permission problem DeniedByDrm // InvalidJob indicates a problem with the job or job ID InvalidJob // ResumeInconsistentState indicates a state problem ResumeInconsistentState // SuspendInconsistentState indicates a state problem SuspendInconsistentState // HoldInconsistentState indicates a state problem HoldInconsistentState // ReleaseInconsistentState indicates a state problem ReleaseInconsistentState // ExitTimeout indicates a timeout issue ExitTimeout // NoRusage indicates an issue with resource usage values NoRusage // NoMoreElements indicates that no more elements are available NoMoreElements )
type FileTransferMode ¶
FileTransferMode determines which files should be staged.
type JobInfo ¶
type JobInfo struct {
// contains filtered or unexported fields
}
JobInfo contains all runtime information about a job.
func (*JobInfo) ExitStatus ¶
ExitStatus returns the exit status of the job.
func (*JobInfo) HasAborted ¶
HasAborted returns if the job was aborted.
func (*JobInfo) HasCoreDump ¶
HasCoreDump returns if the job has generated a core dump.
func (*JobInfo) HasSignaled ¶
HasSignaled returns if the job has been signaled.
func (*JobInfo) ResourceUsage ¶
ResourceUsage returns the resource usage as a map.
func (*JobInfo) TerminationSignal ¶
TerminationSignal returns the termination signal of the job.
type JobTemplate ¶
type JobTemplate struct {
// contains filtered or unexported fields
}
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.
func (*JobTemplate) Args ¶
func (jt *JobTemplate) Args() ([]string, error)
Args returns the arguments set in the job template for the jobs process.
func (*JobTemplate) BlockEmail ¶
func (jt *JobTemplate) BlockEmail() (bool, error)
BlockEmail returns true if BLOCK_EMAIL is set in the job template.
func (*JobTemplate) DeadlineTime ¶
func (jt *JobTemplate) DeadlineTime() (deadlineTime time.Duration, err error)
DeadlineTime returns deadline time. Unsupported in Grid Engine.
func (*JobTemplate) Email ¶
func (jt *JobTemplate) Email() ([]string, error)
Email returns the email addresses set in the job template which are notified on defined events of the underlying job.
func (*JobTemplate) Env ¶
func (jt *JobTemplate) Env() ([]string, error)
Env returns the environment variables set in the job template for the jobs process.
func (*JobTemplate) ErrorPath ¶
func (jt *JobTemplate) ErrorPath() (string, error)
ErrorPath returns the error path set in the job template.
func (*JobTemplate) HardRunDurationLimit ¶
func (jt *JobTemplate) HardRunDurationLimit() (deadlineTime time.Duration, err error)
HardRunDurationLimit returns the hard run-time limit for the job from the job template.
func (*JobTemplate) HardWallclockTimeLimit ¶
func (jt *JobTemplate) HardWallclockTimeLimit() (deadlineTime time.Duration, err error)
HardWallclockTimeLimit returns the wall-clock time set in the job template.
func (*JobTemplate) InputPath ¶
func (jt *JobTemplate) InputPath() (string, error)
InputPath returns the input file of the remote command set in the job template.
func (*JobTemplate) JobName ¶
func (jt *JobTemplate) JobName() (string, error)
JobName returns the name set in the job template.
func (*JobTemplate) JobSubmissionState ¶
func (jt *JobTemplate) JobSubmissionState() (SubmissionState, error)
JobSubmissionState returns the job submission state set in the job template.
func (*JobTemplate) JoinFiles ¶
func (jt *JobTemplate) JoinFiles() (bool, error)
JoinFiles returns if join files is set in the job template.
func (*JobTemplate) NativeSpecification ¶
func (jt *JobTemplate) NativeSpecification() (string, error)
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.
func (*JobTemplate) OutputPath ¶
func (jt *JobTemplate) OutputPath() (string, error)
OutputPath returns the output path set in the job template.
func (*JobTemplate) RemoteCommand ¶
func (jt *JobTemplate) RemoteCommand() (string, error)
RemoteCommand returns the currently set binary which is going to be executed from the job template.
func (*JobTemplate) SetArg ¶
func (jt *JobTemplate) SetArg(arg string) error
SetArg sets a single argument. Simple wrapper for SetArgs([]string{arg}).
func (*JobTemplate) SetArgs ¶
func (jt *JobTemplate) SetArgs(args []string) error
SetArgs sets the arguments for the job executable in the job template.
func (*JobTemplate) SetBlockEmail ¶
func (jt *JobTemplate) SetBlockEmail(blockmail bool) error
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.
func (*JobTemplate) SetDeadlineTime ¶
func (jt *JobTemplate) SetDeadlineTime(deadline time.Duration) error
SetDeadlineTime sets deadline time in job template. Unsupported in Grid Engine.
func (*JobTemplate) SetEmail ¶
func (jt *JobTemplate) SetEmail(emails []string) error
SetEmail sets the emails addresses in the job template used by the cluster scheduler to send emails to.
func (*JobTemplate) SetEnv ¶
func (jt *JobTemplate) SetEnv(envs []string) error
SetEnv sets a set of environment variables inherited from the current environment forwarded to the environment of the job when it is executed.
func (*JobTemplate) SetErrorPath ¶
func (jt *JobTemplate) SetErrorPath(path string) error
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.
func (*JobTemplate) SetHardRunDurationLimit ¶
func (jt *JobTemplate) SetHardRunDurationLimit(limit time.Duration) error
SetHardRunDurationLimit sets a hard run-time limit for the job in the job template.
func (*JobTemplate) SetHardWallclockTimeLimit ¶
func (jt *JobTemplate) SetHardWallclockTimeLimit(limit time.Duration) error
SetHardWallclockTimeLimit sets a hard wall-clock time limit for the job.
func (*JobTemplate) SetInputPath ¶
func (jt *JobTemplate) SetInputPath(path string) error
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.
func (*JobTemplate) SetJobName ¶
func (jt *JobTemplate) SetJobName(jobname string) error
SetJobName sets the name of the job in the job template.
func (*JobTemplate) SetJobSubmissionState ¶
func (jt *JobTemplate) SetJobSubmissionState(state SubmissionState) error
SetJobSubmissionState sets the job submission state (like the hold state) in the job template.
func (*JobTemplate) SetJoinFiles ¶
func (jt *JobTemplate) SetJoinFiles(join bool) error
SetJoinFiles sets that the error and output files of the job have to be joined.
func (*JobTemplate) SetNativeSpecification ¶
func (jt *JobTemplate) SetNativeSpecification(native string) error
SetNativeSpecification sets the native specification (DRM system depended job submission settings) for the job.
func (*JobTemplate) SetOutputPath ¶
func (jt *JobTemplate) SetOutputPath(path string) error
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 ¶
func (jt *JobTemplate) SetRemoteCommand(cmd string) error
SetRemoteCommand sets the path or the name of the binary to be started as a job in the job template.
func (*JobTemplate) SetSoftRunDurationLimit ¶
func (jt *JobTemplate) SetSoftRunDurationLimit(limit time.Duration) error
SetSoftRunDurationLimit sets the soft run-time limit for the job in the job template.
func (*JobTemplate) SetSoftWallclockTimeLimit ¶
func (jt *JobTemplate) SetSoftWallclockTimeLimit(limit time.Duration) error
SetSoftWallclockTimeLimit 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
SetStartTime sets the earliest job start time for the job.
func (*JobTemplate) SetTransferFiles ¶
func (jt *JobTemplate) SetTransferFiles(mode FileTransferMode) error
SetTransferFiles sets the file transfer mode in the job template.
func (*JobTemplate) SetWD ¶
func (jt *JobTemplate) SetWD(dir string) error
SetWD sets the working directory for the job in the job template.
func (*JobTemplate) SoftRunDurationLimit ¶
func (jt *JobTemplate) SoftRunDurationLimit() (deadlineTime time.Duration, err error)
SoftRunDurationLimit returns the soft run-time limit set in the job template.
func (*JobTemplate) SoftWallclockTimeLimit ¶
func (jt *JobTemplate) SoftWallclockTimeLimit() (deadlineTime time.Duration, err error)
SoftWallclockTimeLimit returns the soft wall-clock time limit for the job set in the job template.
func (*JobTemplate) StartTime ¶
func (jt *JobTemplate) StartTime() (time.Time, error)
StartTime returns the job start time set for the job.
func (*JobTemplate) String ¶
func (jt *JobTemplate) String() string
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.
func (*JobTemplate) TransferFiles ¶
func (jt *JobTemplate) TransferFiles() (FileTransferMode, error)
TransferFiles returns the FileTransferModes set in the job template.
func (*JobTemplate) WD ¶
func (jt *JobTemplate) WD() (string, error)
WD returns the working directory set in the job template
type PsType ¶
type PsType int
PsType specifies a job state (output of JobPs()).
const ( // PsUndetermined represents an unknown job state PsUndetermined PsType = iota // PsQueuedActive means the job is queued and eligible to run PsQueuedActive // PsSystemOnHold means the job is put into an hold state by the system PsSystemOnHold // PsUserOnHold means the job is put in the hold state by the user PsUserOnHold // PsUserSystemOnHold means the job is put in the hold state by the system and by the user PsUserSystemOnHold // PsRunning means the job is currently executed PsRunning // PsSystemSuspended means the job is suspended by the DRM PsSystemSuspended // PsUserSuspended means the job is suspended by the user PsUserSuspended // PsUserSystemSuspended means the job is suspended by the DRM and by the user PsUserSystemSuspended // PsDone means the job finished normally PsDone // PsFailed means the job finished and failed PsFailed )
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is a type which represents a DRMAA session.
func MakeSession ¶
MakeSession creates and initializes a new DRMAA session.
func (*Session) AllocateJobTemplate ¶
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.
func (*Session) Control ¶
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 (*Session) DeleteJobTemplate ¶
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.
func (*Session) GetAttributeNames ¶
GetAttributeNames returns a set of supported DRMAA attributes allowed in the job template.
func (*Session) GetDrmSystem ¶
GetDrmSystem returns the DRM system identification string.
func (*Session) GetDrmaaImplementation ¶
GetDrmaaImplementation returns information about the DRMAA implementation.
func (*Session) GetVectorAttributeNames ¶
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.
func (*Session) Init ¶
Init intitializes a DRMAA session. If contact string is "" a new session is created otherwise an existing session is connected.
func (*Session) ReleaseJob ¶
ReleaseJob removes a hold state from a job.
func (*Session) RunBulkJobs ¶
func (s *Session) RunBulkJobs(jt *JobTemplate, start, end, incr int) ([]string, error)
RunBulkJobs submits a job as an array job.
func (*Session) RunJob ¶
func (s *Session) RunJob(jt *JobTemplate) (string, error)
RunJob submits a job in a (initialized) session to the cluster scheduler.
func (*Session) SuspendJob ¶
SuspendJob sends a job suspenion request to the job executor.
func (*Session) Synchronize ¶
Synchronize blocks the programm until the given jobs finshed or a specific timeout is reached.
func (*Session) TerminateJob ¶
TerminateJob sends a job termination request to the job executor.
type SubmissionState ¶
type SubmissionState int
SubmissionState is the initial job state when the job is submitted.
const ( // HoldState is a job submission state which means the job should not be scheduled. HoldState SubmissionState = iota // ActiveState is a job submission state which means the job is allowed to be scheduled. ActiveState )
Directories
¶
Path | Synopsis |
---|---|
examples
|
|
private_gestatus
Package geparser contains functions for parsing Univa Grid Engine qstat -xml output.
|
Package geparser contains functions for parsing Univa Grid Engine qstat -xml output. |