Class: ServerScripts::BatchJob
- Inherits:
-
Object
- Object
- ServerScripts::BatchJob
- Defined in:
- lib/server_scripts.rb
Instance Attribute Summary collapse
-
#additional_commands ⇒ Object
Returns the value of attribute additional_commands.
-
#enable_intel_itac ⇒ Object
Returns the value of attribute enable_intel_itac.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#err_file ⇒ Object
Returns the value of attribute err_file.
-
#executable ⇒ Object
Returns the value of attribute executable.
-
#executor ⇒ Object
Returns the value of attribute executor.
-
#intel_vtune_fname ⇒ Object
Returns the value of attribute intel_vtune_fname.
-
#job_fname ⇒ Object
readonly
Returns the value of attribute job_fname.
-
#job_name ⇒ Object
Returns the value of attribute job_name.
-
#modules ⇒ Object
Returns the value of attribute modules.
-
#node_type ⇒ Object
Returns the value of attribute node_type.
-
#nodes ⇒ Object
Returns the value of attribute nodes.
-
#npernode ⇒ Object
Returns the value of attribute npernode.
-
#nprocs ⇒ Object
Returns the value of attribute nprocs.
-
#options ⇒ Object
Returns the value of attribute options.
-
#out_file ⇒ Object
Returns the value of attribute out_file.
-
#run_cmd ⇒ Object
Returns the value of attribute run_cmd.
-
#source_bashrc ⇒ Object
Returns the value of attribute source_bashrc.
-
#system ⇒ Object
readonly
Returns the value of attribute system.
-
#wall_time ⇒ Object
Returns the value of attribute wall_time.
Instance Method Summary collapse
-
#initialize(job_fname) {|_self| ... } ⇒ BatchJob
constructor
A new instance of BatchJob.
- #set_env(var, value) ⇒ Object
- #submit! ⇒ Object
- #write_job_script! ⇒ Object
Constructor Details
#initialize(job_fname) {|_self| ... } ⇒ BatchJob
Returns a new instance of BatchJob.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/server_scripts.rb', line 50 def initialize job_fname @job_fname = job_fname @job_name = "sample" @out_file = "sample_out.log" @err_file = "sample_err.log" @wall_time = "1:00:00" @node_type = NodeType::FULL @nodes = 1 @npernode = 1 @nprocs = nil @run_cmd = nil @executor = :vanilla @env = {} @executable = "./a.out" @job_script = nil @enable_intel_itac = false @additional_commands = [] @modules = [] @source_bashrc = true yield self end |
Instance Attribute Details
#additional_commands ⇒ Object
Returns the value of attribute additional_commands.
40 41 42 |
# File 'lib/server_scripts.rb', line 40 def additional_commands @additional_commands end |
#enable_intel_itac ⇒ Object
Returns the value of attribute enable_intel_itac.
41 42 43 |
# File 'lib/server_scripts.rb', line 41 def enable_intel_itac @enable_intel_itac end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
46 47 48 |
# File 'lib/server_scripts.rb', line 46 def env @env end |
#err_file ⇒ Object
Returns the value of attribute err_file.
32 33 34 |
# File 'lib/server_scripts.rb', line 32 def err_file @err_file end |
#executable ⇒ Object
Returns the value of attribute executable.
39 40 41 |
# File 'lib/server_scripts.rb', line 39 def executable @executable end |
#executor ⇒ Object
Returns the value of attribute executor.
39 40 41 |
# File 'lib/server_scripts.rb', line 39 def executor @executor end |
#intel_vtune_fname ⇒ Object
Returns the value of attribute intel_vtune_fname.
42 43 44 |
# File 'lib/server_scripts.rb', line 42 def intel_vtune_fname @intel_vtune_fname end |
#job_fname ⇒ Object (readonly)
Returns the value of attribute job_fname.
47 48 49 |
# File 'lib/server_scripts.rb', line 47 def job_fname @job_fname end |
#job_name ⇒ Object
Returns the value of attribute job_name.
30 31 32 |
# File 'lib/server_scripts.rb', line 30 def job_name @job_name end |
#modules ⇒ Object
Returns the value of attribute modules.
44 45 46 |
# File 'lib/server_scripts.rb', line 44 def modules @modules end |
#node_type ⇒ Object
Returns the value of attribute node_type.
34 35 36 |
# File 'lib/server_scripts.rb', line 34 def node_type @node_type end |
#nodes ⇒ Object
Returns the value of attribute nodes.
36 37 38 |
# File 'lib/server_scripts.rb', line 36 def nodes @nodes end |
#npernode ⇒ Object
Returns the value of attribute npernode.
37 38 39 |
# File 'lib/server_scripts.rb', line 37 def npernode @npernode end |
#nprocs ⇒ Object
Returns the value of attribute nprocs.
38 39 40 |
# File 'lib/server_scripts.rb', line 38 def nprocs @nprocs end |
#options ⇒ Object
Returns the value of attribute options.
35 36 37 |
# File 'lib/server_scripts.rb', line 35 def @options end |
#out_file ⇒ Object
Returns the value of attribute out_file.
31 32 33 |
# File 'lib/server_scripts.rb', line 31 def out_file @out_file end |
#run_cmd ⇒ Object
Returns the value of attribute run_cmd.
39 40 41 |
# File 'lib/server_scripts.rb', line 39 def run_cmd @run_cmd end |
#source_bashrc ⇒ Object
Returns the value of attribute source_bashrc.
43 44 45 |
# File 'lib/server_scripts.rb', line 43 def source_bashrc @source_bashrc end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
48 49 50 |
# File 'lib/server_scripts.rb', line 48 def system @system end |
#wall_time ⇒ Object
Returns the value of attribute wall_time.
33 34 35 |
# File 'lib/server_scripts.rb', line 33 def wall_time @wall_time end |
Instance Method Details
#set_env(var, value) ⇒ Object
73 74 75 76 |
# File 'lib/server_scripts.rb', line 73 def set_env var, value raise ArgumentError, "Env #{var} is already set to #{value}." if @env[var] @env[var] = value end |
#submit! ⇒ Object
83 84 85 86 |
# File 'lib/server_scripts.rb', line 83 def submit! write_job_script! Kernel.system(@system.job_submit_cmd(batch_script: @job_fname)) end |
#write_job_script! ⇒ Object
78 79 80 81 |
# File 'lib/server_scripts.rb', line 78 def write_job_script! generate_job_script! unless @job_script File.write(@job_fname, @job_script) end |