Updated 2021-05-17
Run Ruby on the Cluster¶
Overview¶
- In the
PBS
script load ruby withmodule 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 (usingcd
). If it is in the same dir you have/are submitting thePBS
script from, you can usecd $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 -A [Account]
#PBS -l nodes=1:ppn=2
#PBS -l walltime=1:00
#PBS -q inferno
#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 caseqsub 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 aruby.out
file. Usecat 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: inferno
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.