Module: CodeRunner::GenericLinux
- Includes:
- Launcher
- Included in:
- Saturne
- Defined in:
- lib/coderunner/system_modules/generic_linux.rb
Instance Method Summary
collapse
Methods included from Launcher
#cancel_job_launcher, #error_file_launcher, #execute_launcher, #launcher_prefix, #output_file_launcher, #queue_status_launcher, #use_launcher
Instance Method Details
#cancel_job ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 70
def cancel_job
children = `ps --ppid #@job_no`.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
system "kill #{@job_no}"
children.each do |pid|
system "kill #{pid}"
end
end
|
#error_file ⇒ Object
78
79
80
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 78
def error_file
return "#{executable_name}.#{job_identifier}.e"
end
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 30
def execute
log 'execute_submission'
if prefix = ENV['CODE_RUNNER_LAUNCHER']
launch_id = "#{Time.now.to_i}#{$$}"
fname = CodeRunner.launcher_directory + "/#{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
system run_command
pid = -1
end
return pid
end
|
#output_file ⇒ Object
82
83
84
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 82
def output_file
return "#{executable_name}.#{job_identifier}.o"
end
|
#queue_status ⇒ Object
@@ruby_command = “ruby1.9”
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 8
def queue_status
if use_launcher
queue_status_launcher
else
if methods.include?(:rcp) and rcp.uses_mpi? and rcp.uses_mpi
return %x[ps -e -U #{Process.uid} | grep mpi] + %x[ps -e -U #{Process.uid} | grep -G '\\bsh\\b'] + %x[ps -e -U #{Process.uid} -o pid,user,cmd | grep coderunner].grep(/launch/)
else
return %x[ps -e -U #{Process.uid} | grep '#{executable_name}'] + %x[ps -e -U #{Process.uid} | grep -G '\\bsh\\b']
end
end
end
|
#run_command ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/coderunner/system_modules/generic_linux.rb', line 20
def run_command
crenv = @code_run_environment ? @code_run_environment + ";" : nil
if rcp.uses_mpi
raise "Number of processors (nprocs) not specified" unless @nprocs
return %[#{crenv} time mpirun -np #{@nprocs} #{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}]
else
return %[#{crenv} #{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}]
end
end
|