Forum: Ruby DRMAA for Ruby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Andreas Haas (Guest)
on 2006-06-08 03:37
(Received via mailing list)
Hi all,

please find under


http://gridengine.sunsource.net/files/documents/7/...

a Ruby binding for DRMAA based on Ruby/DL.

DRMAA is an interface standard for job submission and control
to Distributed Resource Manager (DRM) systems such as Condor,
PBS/OpenPBS/Torque, Platform LSF, Sun's N1 Grid Engine and
others.

The example below possibly illustrates best how DRMAA can
be used to run jobs: A short sleeper-job is submitted one times
as sequential job and then 20 times as a bulk job to the DRM.
Once the jobs are done their exit status gets nicely reported.

Documentation is contained in drmaa.rb, but you shouldn't expect it
to be complete. The best resource for DRMAA as such is the "language
independent specification" on www.drmaa.org. Besides looking
into the documentationof the implementing DRM certainly is not a
bad idea.

Best regards,
Andreas

#!/usr/bin/ruby

require 'drmaa'

class Sleeper < DRMAA::JobTemplate
    def initialize
       super
       self.set_command("/bin/sleep")
       self.set_arg(["1"])
       self.set_stdout(":/dev/null")
       self.set_join(true)
    end
end

version = DRMAA.version
drm = DRMAA.drm_system
impl = DRMAA.drmaa_implementation
contact = DRMAA.contact
puts "DRMAA #{drm} v #{version} impl #{impl} contact #{contact}"

session = DRMAA::Session.new

t = Sleeper.new

jobid = session.run(t)
puts "job: " + jobid

session.run_bulk(t, 1, 20).each { |job|
    puts "job: " + job
}

session.wait_each{ |info|
    if ! info.wifexited?
       puts "failed: " + info.job
    else
       puts info.job + " returned with " + info.wexitstatus.to_s
    end
}

exit 0
This topic is locked and can not be replied to.