Sha256: a467a9d7d5077a32c0d0e8bab79617bf5366550a690195d1dfe805fb829e05eb

Contents?: true

Size: 1.34 KB

Versions: 24

Compression:

Stored size: 1.34 KB

Contents

class CodeRunner

  # A module containing methods for submitting runs using the CodeRunner
  # launcher. Typically this would be used on a home Linux system or in
  # an interactive session on a supercomputer.
  module Launcher
    def launcher_prefix
		  ENV['CODE_RUNNER_LAUNCHER']
    end
    def use_launcher
      launcher_prefix and launcher_prefix.size > 0
    end
    def queue_status_launcher
			#%x[cat #{CodeRunner.launcher_directory}/queue_status.txt | grep sh]  +
			#%x[cat #{CodeRunner.launcher_directory}/queue_status2.txt | grep sh] 
			%x[cat #{CodeRunner.launcher_directory}/queue_status.txt ]  +
			%x[cat #{CodeRunner.launcher_directory}/queue_status2.txt ] 
    end 
    def execute_launcher
			launch_id = "#{Time.now.to_i}#{$$}"
			fname = "#{CodeRunner.launcher_directory}/#{launch_id}"
			File.open(fname + '.start', 'w'){|file| file.print "cd #{Dir.pwd};", run_command, "\n"}
			sleep 2 until FileTest.exist? fname + '.pid'
			pid = File.read(fname + '.pid').to_i
			FileUtils.rm fname + '.pid'
			return pid
    end
    def cancel_job_launcher
			fname = CodeRunner.launcher_directory + "/#{$$}.stop"
			File.open(fname, 'w'){|file| file.puts "\n"}
    end
    def error_file_launcher
      return "#{executable_name}.#{job_identifier}.e"
    end
    def output_file_launcher
      return "#{executable_name}.#{job_identifier}.o"
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
coderunner-0.18.0 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.11 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.10 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.9 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.8 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.7 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.6 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.5 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.4 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.3 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.2 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.1 lib/coderunner/system_modules/launcher.rb
coderunner-0.17.0 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.20 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.19 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.18 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.17 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.16 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.15 lib/coderunner/system_modules/launcher.rb
coderunner-0.16.14 lib/coderunner/system_modules/launcher.rb