Class: TORQUE::Qsub
- Inherits:
-
Object
- Object
- TORQUE::Qsub
- Defined in:
- lib/torque_rm/qsub.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
(also: #when)
Returns the value of attribute a.
-
#A ⇒ Object
(also: #account)
Returns the value of attribute A.
-
#b ⇒ Object
Returns the value of attribute b.
-
#c ⇒ Object
(also: #checkpoint)
Returns the value of attribute c.
-
#C ⇒ Object
Returns the value of attribute C.
-
#d ⇒ Object
(also: #wd, #working_directory)
Returns the value of attribute d.
-
#D ⇒ Object
(also: #root_directory)
Returns the value of attribute D.
-
#e ⇒ Object
(also: #stderr)
Returns the value of attribute e.
-
#f ⇒ Object
Returns the value of attribute f.
-
#gres ⇒ Object
Returns the value of attribute gres.
-
#h ⇒ Object
Returns the value of attribute h.
-
#I ⇒ Object
Returns the value of attribute I.
-
#id ⇒ Object
Returns the value of attribute id.
-
#j ⇒ Object
Returns the value of attribute j.
-
#k ⇒ Object
Returns the value of attribute k.
-
#l ⇒ Object
config.
-
#m ⇒ Object
Returns the value of attribute m.
-
#M ⇒ Object
(also: #email)
Returns the value of attribute M.
-
#N ⇒ Object
(also: #name)
Returns the value of attribute N.
- #nodes ⇒ Object
-
#o ⇒ Object
(also: #stdout)
Returns the value of attribute o.
-
#p ⇒ Object
Returns the value of attribute p.
-
#P ⇒ Object
(also: #run_as_user)
Returns the value of attribute P.
-
#ppn ⇒ Object
(also: #cpus)
Returns the value of attribute ppn.
-
#procs ⇒ Object
Returns the value of attribute procs.
-
#q ⇒ Object
(also: #queue)
Returns the value of attribute q.
-
#r ⇒ Object
(also: #rerunnable)
Returns the value of attribute r.
-
#S ⇒ Object
(also: #shell)
Returns the value of attribute S.
-
#script ⇒ Object
Returns the value of attribute script.
-
#t ⇒ Object
Returns the value of attribute t.
-
#u ⇒ Object
(also: #user_list)
Returns the value of attribute u.
-
#V ⇒ Object
(also: #exports)
Returns the value of attribute V.
-
#v ⇒ Object
(also: #variable_list)
Returns the value of attribute v.
-
#W ⇒ Object
Returns the value of attribute W.
-
#walltime ⇒ Object
Returns the value of attribute walltime.
-
#X ⇒ Object
(also: #additional_attributes)
Returns the value of attribute X.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
-
#config(&block) ⇒ Object
initialize.
-
#initialize(opts = {}, &block) ⇒ Qsub
constructor
A new instance of Qsub.
-
#rm ⇒ Object
delete this job from the queue.
-
#stat ⇒ Object
get the stats for this job.
-
#submit(opts = {dry: false}) ⇒ Object
Create a qsub job on the remote server and then submits it return the job_id from qsub and set it as a job variable.
- #to_s ⇒ Object
Constructor Details
#initialize(opts = {}, &block) ⇒ Qsub
Returns a new instance of Qsub.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/torque_rm/qsub.rb', line 72 def initialize(opts={}, &block) @id = nil # configure when the job is submitted @a =opts[:a] || opts[:date_time] @A = opts[:A] || opts[:account] @b = opts[:b] @c = validate_checkpoint(opts[:c] || opts[:checkpoint]) @C = opts[:C] || opts[:directive_prefix] @d = opts[:d] || opts[:working_directory] # PBS_O_INITDIR @D = opts[:D] || opts[:root_directory] # PBS_O_ROOTDIR @e = opts[:e] || opts[:stderr] # [hostname:]path_name @f = opts[:f] || opts[:fault_tolerant] # boolean @h = opts[:h] || opts[:user_hold] # boolean @I = opts[:I] || opts[:interactive] @j = opts[:j] || opts[:join_stdout_stderr] @k = validate_keep(opts) # check manual because I'm not going to implement this now. @l = opts[:l] @nodes = opts[:nodes] @walltime = opts[:walltime] @gres = opts[:gres] @ppn = opts[:ppn] @procs = opts[:procs] @m = (opts) @M = opts[:M] || opts[:email] @N = opts[:N] || opts[:name] @o = opts[:o] || opts[:stdout] # [hostname:]path_name @p = validate_priority(opts) # between -1024, +1023 @P = opts[:P] || opts[:root_as_user] @q = opts[:q] || opts[:queue] @r = opts[:r] || opts[:rerunnable] # y|n @S = opts[:S] || opts[:shell] @t = opts[:t] || opts[:array_request] @u = opts[:u] || opts[:user_list] @v = opts[:v] || opts[:variable_list] @V = opts[:V] || opts[:exports] #this is just a boolean @W = opts[:W] || opts[:additional_attributes] # to DEVELOP, chaining jobs together. @X = opts[:X] || opts[:X_forwardning] # boolean @z = opts[:z] || opts[:no_jobid] @script = opts[:script] if block_given? if block.arity == 1 yield self end end end |
Instance Attribute Details
#a ⇒ Object Also known as: when
Returns the value of attribute a.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def a @a end |
#A ⇒ Object Also known as: account
Returns the value of attribute A.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def A @A end |
#b ⇒ Object
Returns the value of attribute b.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def b @b end |
#c ⇒ Object Also known as: checkpoint
Returns the value of attribute c.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def c @c end |
#C ⇒ Object
Returns the value of attribute C.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def C @C end |
#d ⇒ Object Also known as: wd, working_directory
Returns the value of attribute d.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def d @d end |
#D ⇒ Object Also known as: root_directory
Returns the value of attribute D.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def D @D end |
#e ⇒ Object Also known as: stderr
Returns the value of attribute e.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def e @e end |
#f ⇒ Object
Returns the value of attribute f.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def f @f end |
#gres ⇒ Object
Returns the value of attribute gres.
20 21 22 |
# File 'lib/torque_rm/qsub.rb', line 20 def gres @gres end |
#h ⇒ Object
Returns the value of attribute h.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def h @h end |
#I ⇒ Object
Returns the value of attribute I.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def I @I end |
#id ⇒ Object
Returns the value of attribute id.
21 22 23 |
# File 'lib/torque_rm/qsub.rb', line 21 def id @id end |
#j ⇒ Object
Returns the value of attribute j.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def j @j end |
#k ⇒ Object
Returns the value of attribute k.
18 19 20 |
# File 'lib/torque_rm/qsub.rb', line 18 def k @k end |
#l ⇒ Object
config
129 130 131 |
# File 'lib/torque_rm/qsub.rb', line 129 def l @l end |
#m ⇒ Object
Returns the value of attribute m.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def m @m end |
#M ⇒ Object Also known as: email
Returns the value of attribute M.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def M @M end |
#N ⇒ Object Also known as: name
Returns the value of attribute N.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def N @N end |
#nodes ⇒ Object
138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/torque_rm/qsub.rb', line 138 def nodes str_nodes = if @nodes @nodes elsif ppn "nodes=1" end if ppn str_nodes << ':' << "ppn=#{ppn}" elsif procs str_nodes << '+' << "procs=#{procs}" end end |
#o ⇒ Object Also known as: stdout
Returns the value of attribute o.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def o @o end |
#p ⇒ Object
Returns the value of attribute p.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def p @p end |
#P ⇒ Object Also known as: run_as_user
Returns the value of attribute P.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def P @P end |
#ppn ⇒ Object Also known as: cpus
Returns the value of attribute ppn.
20 21 22 |
# File 'lib/torque_rm/qsub.rb', line 20 def ppn @ppn end |
#procs ⇒ Object
Returns the value of attribute procs.
20 21 22 |
# File 'lib/torque_rm/qsub.rb', line 20 def procs @procs end |
#q ⇒ Object Also known as: queue
Returns the value of attribute q.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def q @q end |
#r ⇒ Object Also known as: rerunnable
Returns the value of attribute r.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def r @r end |
#S ⇒ Object Also known as: shell
Returns the value of attribute S.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def S @S end |
#script ⇒ Object
Returns the value of attribute script.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def script @script end |
#t ⇒ Object
Returns the value of attribute t.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def t @t end |
#u ⇒ Object Also known as: user_list
Returns the value of attribute u.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def u @u end |
#V ⇒ Object Also known as: exports
Returns the value of attribute V.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def V @V end |
#v ⇒ Object Also known as: variable_list
Returns the value of attribute v.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def v @v end |
#W ⇒ Object
Returns the value of attribute W.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def W @W end |
#walltime ⇒ Object
Returns the value of attribute walltime.
20 21 22 |
# File 'lib/torque_rm/qsub.rb', line 20 def walltime @walltime end |
#X ⇒ Object Also known as: additional_attributes
Returns the value of attribute X.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def X @X end |
#z ⇒ Object
Returns the value of attribute z.
19 20 21 |
# File 'lib/torque_rm/qsub.rb', line 19 def z @z end |
Instance Method Details
#config(&block) ⇒ Object
initialize
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/torque_rm/qsub.rb', line 118 def config(&block) if block_given? if block.arity == 1 yield self else instance_eval &block self end end end |
#rm ⇒ Object
delete this job from the queue
188 189 190 191 192 193 194 |
# File 'lib/torque_rm/qsub.rb', line 188 def rm if id.nil? warn("No job submitted") else TORQUE::Qdel.rm(id) end end |
#stat ⇒ Object
get the stats for this job
177 178 179 180 181 182 183 184 |
# File 'lib/torque_rm/qsub.rb', line 177 def stat if id.nil? warn("No job submitted") else @qstat = @qstat || TORQUE::Qstat.new @qstat.query(job_id: id) end end |
#submit(opts = {dry: false}) ⇒ Object
Create a qsub job on the remote server and then submits it return the job_id from qsub and set it as a job variable. :dry => true will only transfer the file to the destination server and will not submit the job to the scheduler
the job object will not have an id associated.
171 172 173 174 |
# File 'lib/torque_rm/qsub.rb', line 171 def submit(opts={dry: false}) TORQUE.server.file_upload StringIO.new(to_s), script_absolute_filename @id = TORQUE.server.qsub(script_absolute_filename).first unless opts[:dry] == true end |
#to_s ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/torque_rm/qsub.rb', line 154 def to_s pbs_script = "" [:a, :A,:b,:c,:C,:d,:D,:e,:f,:h,:I,:j,:k,:l,:m,:M,:N,:o,:p,:P,:q,:r,:S,:t,:u,:v,:V,:W,:X,:z].each do |option| value = send(option) pbs_script << "#PBS -#{option} #{value}\n" unless value.nil? end pbs_script << "#{script}" unless script.nil? if script.nil? warn("You are converting this qsub job into a script without a real code.") end pbs_script end |