Class: Comana::QueueSubmitter
- Inherits:
-
ComputationManager
- Object
- ComputationManager
- Comana::QueueSubmitter
- Defined in:
- lib/comana/queuesubmitter.rb
Defined Under Namespace
Classes: InitializeError, InvalidArgumentError, PrepareNextError
Constant Summary collapse
- SCRIPT =
"script.sh"
- PROLOGUE =
"prologue_script.sh"
- EPILOGUE =
"epilogue_script.sh"
- WALLTIME =
day:hour:minute:second
"7:00:00:00"
Instance Attribute Summary
Attributes inherited from ComputationManager
Instance Method Summary collapse
- #calculate ⇒ Object
-
#finished? ⇒ Boolean
Return true after qsub executed.
-
#initialize(opts) ⇒ QueueSubmitter
constructor
opts is a hash includes data belows: :command => executable command line written in script.
-
#prepare_next ⇒ Object
Raise QueueSubmitter::PrepareNextError when called.
Methods inherited from ComputationManager
#latest_modified_time, #start, #state
Constructor Details
#initialize(opts) ⇒ QueueSubmitter
opts is a hash includes data belows:
:command => executable command line written in script.
:cluster => name of cluster.
:target => calculation as ComputationManager subclass.
Note that this is not target name, to check calculatable.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/comana/queuesubmitter.rb', line 26 def initialize(opts) [:target, :command].each do |symbol| raise InitializeError, "No '#{symbol}' in argument 'opts'" unless opts.has_key?(symbol) #raise InitializeError unless opts.has_key?(symbol) end super(opts[:target].dir) @command = opts[:command] @cluster = opts[:cluster] @num_nodes = opts[:num_nodes] @priority = opts[:priority] @lockdir = "lock_queuesubmitter" end |
Instance Method Details
#calculate ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/comana/queuesubmitter.rb', line 41 def calculate # prologue prologue_path = "#{@dir}/#{PROLOGUE}" File.open(prologue_path, "w") { |io| dump_prologue(io) } FileUtils.chmod(0700, prologue_path) # epilogue epilogue_path = "#{@dir}/#{EPILOGUE}" File.open(epilogue_path, "w") { |io| dump_epilogue(io) } FileUtils.chmod(0700, epilogue_path) # script script_path = "#{@dir}/#{SCRIPT}" File.open(script_path, "w") { |io| dump_script(io) } # run system("cd #{@dir}; qsub -l prologue=#{prologue_path} -l epilogue=#{epilogue_path} #{script_path} > jobid.log") end |
#finished? ⇒ Boolean
Return true after qsub executed.
66 67 68 |
# File 'lib/comana/queuesubmitter.rb', line 66 def finished? Dir.exist? @dir + "/" +@lockdir end |
#prepare_next ⇒ Object
Raise QueueSubmitter::PrepareNextError when called.
61 62 63 |
# File 'lib/comana/queuesubmitter.rb', line 61 def prepare_next raise PrepareNextError end |