Module: CodeRunner::Macosx
- Defined in:
- lib/coderunner/system_modules/macosx.rb
Instance Method Summary collapse
- #cancel_job ⇒ Object
- #error_file ⇒ Object
- #execute ⇒ Object
- #output_file ⇒ Object
-
#queue_status ⇒ Object
@@ruby_command = “ruby1.9”.
- #run_command ⇒ Object
Instance Method Details
#cancel_job ⇒ Object
34 35 36 |
# File 'lib/coderunner/system_modules/macosx.rb', line 34 def cancel_job `kill #{@job_no}` end |
#error_file ⇒ Object
38 39 40 |
# File 'lib/coderunner/system_modules/macosx.rb', line 38 def error_file return executable_name + ".sh.e" end |
#execute ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/coderunner/system_modules/macosx.rb', line 17 def execute log 'execute_submission' if ENV['CODE_RUNNER_LAUNCHER'] launch_id = "#{Time.now.to_i}#{$$}" fname = ENV['HOME'] + "/.coderunner_to_launch/#{launch_id}" File.open(fname + '.start', 'w'){|file| file.puts "cd #{Dir.pwd};#{run_command}"} sleep 1 until FileTest.exist? fname + '.pid' pid = File.read(fname + '.pid').to_i FileUtils.rm fname + '.pid' else pid = Kernel.spawn(run_command + " & ") end return nil # pid end |
#output_file ⇒ Object
42 43 44 |
# File 'lib/coderunner/system_modules/macosx.rb', line 42 def output_file return executable_name + ".sh.o" end |
#queue_status ⇒ Object
@@ruby_command = “ruby1.9”
5 6 7 |
# File 'lib/coderunner/system_modules/macosx.rb', line 5 def queue_status %x[ps].grep(Regexp.new(Regexp.escape(executable_name))) #Can't put grep in the shell command because it will grep itself - OS X displays the entire command in ps! end |
#run_command ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/coderunner/system_modules/macosx.rb', line 9 def run_command if rcp.uses_mpi return %[mpirun -np #{@nprocs} #{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}] else return %[#{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}] end end |