module PBS::Torque

An interface to the C-library of Torque

Constants

BatchOp

Enum for Batch Operation

ERROR_CODES

Defined error codes, valid as of Torque >=4.2.10

Public Class Methods

check_for_error() click to toggle source

Check for any errors set in the errno @return [void]

# File lib/pbs/torque.rb, line 182
def self.check_for_error
  errno = pbs_errno
  self.pbs_errno = 0  # reset error number
  raise_error(errno) if errno > 0
end
lib() click to toggle source

The path to the torque library file @return [String] path to torque library

# File lib/pbs/torque.rb, line 145
def self.lib
  @lib
end
lib=(lib) click to toggle source

Define torque methods using a supplied library @param lib [#to_s, nil] path to library file @return [void]

# File lib/pbs/torque.rb, line 152
def self.lib=(lib)
  @lib = lib ? lib.to_s : 'torque'

  # Set up FFI to use this library
  ffi_lib @lib

  attach_variable :pbs_errno, :int
  attach_variable :pbs_server, :string
  attach_function :pbs_strerror, [ :int ], :string
  attach_function :pbs_default, [], :string
  attach_function :pbs_connect, [ :string ], :int
  attach_function :pbs_disconnect, [ :int ], :int
  attach_function :pbs_deljob, [ :int, :string, :string ], :int
  attach_function :pbs_holdjob, [ :int, :string, :string, :string ], :int
  attach_function :pbs_rlsjob, [ :int, :string, :string, :string ], :int
  attach_function :pbs_statfree, [ BatchStatus.ptr ], :void
  attach_function :pbs_statjob, [ :int, :string, Attrl.ptr, :string ], BatchStatus.ptr
  attach_function :pbs_statnode, [ :int, :string, Attrl.ptr, :string ], BatchStatus.ptr
  attach_function :pbs_statque, [ :int, :string, Attrl.ptr, :string ], BatchStatus.ptr
  attach_function :pbs_statserver, [ :int, Attrl.ptr, :string ], BatchStatus.ptr
  attach_function :pbs_selstat, [ :int, Attropl.ptr, :string ], BatchStatus.ptr

  # FIXME: The space for the job_identifier string is allocated by
  # pbs_submit() and should be released via a call to free() when no longer
  # needed
  attach_function :pbs_submit, [ :int, Attropl.ptr, :string, :string, :string ], :string
end
raise_error(errno) click to toggle source

For a given errno, raise the corresponding error with error message @param errno [Fixnum] the error number @raise [Error] if errno is not 0 @return [void]

# File lib/pbs/torque.rb, line 192
def self.raise_error(errno)
  raise (ERROR_CODES[errno] || PBS::Error), "#{pbs_strerror(errno)}"
end