# DRMAA for Ruby

**URL:** <https://www.ruby-forum.com/t/drmaa-for-ruby/95653>\
**Category:** Ruby\
**Created:** [June 8, 2006, 1:37am UTC](https://www.ruby-forum.com/t/drmaa-for-ruby/95653 "2006-06-08T01:37:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andreas\_Haas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a698b9/32.png) [@Andreas\_Haas](https://www.ruby-forum.com/u/Andreas_Haas)\
**Post date:** [June 8, 2006, 1:37am UTC](https://www.ruby-forum.com/t/drmaa-for-ruby/95653/1 "2006-06-08T01:37:53Z")

</div>

Hi all,

please find under

[http://gridengine.sunsource.net/files/documents/7/90/drmaa\_ruby.tar.gz](http://gridengine.sunsource.net/files/documents/7/90/drmaa_ruby.tar.gz)

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](http://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
