Updated 2019-02-21

Run Ruby on the Cluster

Overview

  • In the PBS script load ruby with module load ruby/2.5.1.

Tip

You can use module avail ruby to see what versions of ruby are available.

  • In the computation part of your PBS script, enter the folder where you have stored the Ruby script (using cd). If it is in the same dir you have/are submitting the PBS script from, you can use cd $PBS_O_WORKDIR
  • To run the Ruby script, use ruby <rubyScriptName.rb> to run the script.

Walkthrough: Run Ruby on the Cluster

  • This walkthrough will use a simple Ruby script that prints "Hello World"
  • Ruby script: helloWorld.rb
  • PBS script: ruby.pbs
  • You can transfer the files to your account on the cluster to follow along. The file transfer guide may be helpful.

Part 1: The PBS Script

#PBS -N ruby
#PBS -l nodes=1:ppn=2
#PBS -l walltime=1:00
#PBS -q force-6
#PBS -j oe
#PBS -o ruby.out

cd $PBS_O_WORKDIR
module load ruby/2.5.1
ruby helloWorld.rb
  • The #PBS directives are standard, requesting just 1 minute of walltime and 1 node with 2 cores. More on #PBS directives can be found in the PBS guide
  • $PBS_O_WORKDIR is simply a variable that represents the directory you submit the PBS script from.

Warning

Make sure the ruby script you want to run (in this case, helloWorld.rb) is in the same directory you put the PBS script.

  • ruby helloWorld.rb runs the script

Part 2: Submit Job and Check Status

  • Make sure you're in the dir that contains the PBS Script
  • Submit as normal, with qsub <pbs script name>. In this case qsub ruby.pbs
  • Check job status with qstat -u <gtusername3> -n, replacing "gtusername3" with your gt username
  • You can delete the job with qdel 22182721 , replacing the number with the jobid returned after running qsub

Part 3: Collecting Results

  • In the directory where you submitted the PBS script, you should see a ruby.out file. Use cat ruby.out or open the file in a text editor to take a look.
  • ruby.out should look like this:
---------------------------------------
Begin PBS Prologue Wed Sep 19 13:38:14 EDT 2018
Job ID:     22470152.shared-sched.pace.gatech.edu
User ID:    shollister7
Job name:   ruby
Queue:      force-6
End PBS Prologue Wed Sep 19 13:38:14 EDT 2018
---------------------------------------
Hello World!
---------------------------------------
Begin PBS Epilogue Wed Sep 19 13:38:14 EDT 2018
Job ID:     22470152.shared-sched.pace.gatech.edu
User ID:    shollister7
Job name:   ruby
Resources:  neednodes=1:ppn=2,nodes=1:ppn=2,walltime=00:01:00

  • After the result files are produced, you can move the files off the cluster, refer to the file transfer guide for help.
  • Congratulations! You successfully ran a Ruby script on the cluster.