coderunner 0.12.5 → 0.12.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/coderunner.gemspec +2 -2
- data/lib/coderunner.rb +4 -6
- data/lib/coderunner/class_methods.rb +3 -3
- data/lib/coderunner/fortran_namelist.rb +9 -6
- data/lib/coderunner/instance_methods.rb +4 -4
- data/lib/coderunner/run.rb +2 -1
- data/lib/coderunner/system_modules/generic_linux.rb +1 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.12.
|
1
|
+
0.12.6
|
data/coderunner.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "coderunner"
|
8
|
-
s.version = "0.12.
|
8
|
+
s.version = "0.12.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Edmund Highcock"]
|
12
|
-
s.date = "2013-06-
|
12
|
+
s.date = "2013-06-17"
|
13
13
|
s.description = "CodeRunner is a framework for the automated running and analysis of simulations. It automatically generates any necessary input files, organises the output data and analyses it. Because it is a modular system, it can easily be customised to work with any system and any simulation code. One of its greatest strengths is that it is independent of any one simulation code; thus it can easily plot and compare the data from different codes."
|
14
14
|
s.email = "edmundhighcock@sourceforge.net"
|
15
15
|
s.executables = ["coderunner"]
|
data/lib/coderunner.rb
CHANGED
@@ -118,19 +118,17 @@ CodeRunner::GLOBAL_BINDING = binding
|
|
118
118
|
|
119
119
|
Log.log_file = nil
|
120
120
|
|
121
|
-
# $sys = 'macosx' if $sys == 'home'
|
122
|
-
# puts $sys; gets
|
123
121
|
|
124
122
|
|
123
|
+
|
124
|
+
class CodeRunner
|
125
|
+
|
125
126
|
####################################
|
126
127
|
# Commmand line processing #
|
127
128
|
####################################
|
128
129
|
|
129
130
|
|
130
131
|
# Here are all the methods that map the command line invocation into the correct class method call
|
131
|
-
|
132
|
-
class CodeRunner
|
133
|
-
|
134
132
|
COMMAND_LINE_FLAGS_WITH_HELP = [
|
135
133
|
["--recalc-all", "-A", GetoptLong::NO_ARGUMENT, %[Causes each directory to be reprocessed, rather than reading the cache of data. Its exact effect depends on the code module being used. By convention it implies that ALL data analysis will be redone.]],
|
136
134
|
["--reprocess-all", "-a", GetoptLong::NO_ARGUMENT, %[Causes each directory to be reprocessed, rather than reading the cache of data. Its exact effect depends on the code module being used. By convention it implies that VERY LITTLE data analysis will be redone.]],
|
@@ -202,7 +200,7 @@ EOF
|
|
202
200
|
["continue_in_new_folder", "cnf", 1, 'Make a new folder in the parent directory and copy all coderunner configuration files to that folder. If options j or f are specified, copy all matching runs to that new folder.', ['folder'], [:j, :f, :U, :N]],
|
203
201
|
["code_runner_execute", "crex", 1, 'Run (within the CodeRunner class) the fragment of Ruby code given.', ['Ruby fragment'], []],
|
204
202
|
["delete", "del", 0, 'Permanently erase all filtered runs.', [], [:j, :F, :U, :N]],
|
205
|
-
["differences_between", "diff",
|
203
|
+
["differences_between", "diff", 0, 'Print a table of all the differences between the input parameters of the filtered ids.', [], [:j, :F, :U, :N]],
|
206
204
|
["directory", "dir", 1, 'Print out the directory for the given run.', ['id'], []],
|
207
205
|
['dumb_film', "dfm", 0, 'Create a film of the specified graphkits using gnuplot "dumb" ASCII terminal.', [], [:F, :G, :g, :U, :N, :j, :f]],
|
208
206
|
["execute", "ex", 1, 'Run (at the top level) the fragment of Ruby code given.', ['Ruby fragment'], []],
|
@@ -76,7 +76,7 @@ class CodeRunner
|
|
76
76
|
runner = fetch_runner(copts)
|
77
77
|
runner.destroy
|
78
78
|
end
|
79
|
-
def self.differences_between(
|
79
|
+
def self.differences_between(copts = {})
|
80
80
|
runner = fetch_runner(copts)
|
81
81
|
runs = runner.filtered_ids.map{|id| runner.run_list[id]}
|
82
82
|
vars = runner.run_class.rcp.variables.dup + runner.run_class.rcp.run_info.dup
|
@@ -684,9 +684,9 @@ EOF
|
|
684
684
|
else
|
685
685
|
runner = @runners[copts[:Y]]
|
686
686
|
end
|
687
|
-
#
|
687
|
+
#p 'reading defaults', runner.recalc_all, DEFAULT_RUNNER_OPTIONS
|
688
688
|
runner.read_defaults
|
689
|
-
#
|
689
|
+
#p 'read defaults', runner.recalc_all
|
690
690
|
|
691
691
|
end #Dir.chdir
|
692
692
|
end
|
@@ -85,7 +85,7 @@ class Run
|
|
85
85
|
@deleted_variables = eval(File.read(folder + '/deleted_variables.rb'), binding, folder + '/deleted_variables.rb')
|
86
86
|
rescue Errno::ENOENT
|
87
87
|
@deleted_variables = {}
|
88
|
-
save_deleted_variables
|
88
|
+
#save_deleted_variables
|
89
89
|
end
|
90
90
|
|
91
91
|
@deleted_variables.keys.each{|var| attr_accessor var}
|
@@ -295,7 +295,9 @@ def self.add_code_variable_to_namelist(namelist, var, value)
|
|
295
295
|
namelist_file = 'namelists.rb'
|
296
296
|
# end
|
297
297
|
raise "This namelist: #{namelist} should have an enumerator and does not have one" if enum and not @namelists[namelist][:enumerator]
|
298
|
-
|
298
|
+
unless ENV['CR_NON_INTERACTIVE']
|
299
|
+
return unless Feedback.get_boolean("An unknown variable has been found in this input file: \n\n\t Namelist: #{namelist}, Name: #{code_name}, Sample Value: #{value.inspect}.\n\nDo you wish to add it to the CodeRunner module? (Recommended: answer yes as long as the variable is not a typo)")
|
300
|
+
end
|
299
301
|
|
300
302
|
while nms = variable_exists?(namelist, var)
|
301
303
|
puts "This variable: #{var} already exists in these namelists: #{nms}. Please give an alternative name for CodeRunner (this will not affect the name that appears in the input file). If you know that the variable has the same meaning in these other namelists, or if you know that none of these namelists will appear at the same time, enter '0' to leave it unchanged."
|
@@ -355,7 +357,7 @@ def self.add_code_variable_to_namelist(namelist, var, value)
|
|
355
357
|
attr_accessor var
|
356
358
|
end
|
357
359
|
save_namelists
|
358
|
-
edit_variable_help(namelist, var)
|
360
|
+
edit_variable_help(namelist, var) unless ENV['CR_NON_INTERACTIVE']
|
359
361
|
# folder = File.dirname(__FILE__)
|
360
362
|
# File.open(folder + '/' + namelist_file, 'w'){|f| f.puts namelists.pretty_inspect}
|
361
363
|
end
|
@@ -988,10 +990,10 @@ def self.update_defaults_from_source_code(source_code_folder = ARGV[-1])
|
|
988
990
|
end
|
989
991
|
|
990
992
|
# string.gsub!(/^.+?:/, '') # Get rid of file names from grep
|
991
|
-
File.open('found1','w'){|f| f.puts string}
|
993
|
+
#File.open('found1','w'){|f| f.puts string}
|
992
994
|
# exit
|
993
995
|
defs = scan_text_for_variables(string)
|
994
|
-
File.open('found2','w'){|f| f.puts defs.pretty_inspect}
|
996
|
+
#File.open('found2','w'){|f| f.puts defs.pretty_inspect}
|
995
997
|
# exit
|
996
998
|
namelists.each do |namelist, hash|
|
997
999
|
hash[:variables].each do |var, varhash|
|
@@ -1043,7 +1045,7 @@ def self.synchronise_variables(source_code_folder = ARGV[2])
|
|
1043
1045
|
all_variables_in_source = {}
|
1044
1046
|
namelist_declarations = {}
|
1045
1047
|
#source.scan(/^\s*namelist\s*\/(?<namelist>\w+)\/(?<variables>(?:(?:&\s*[\n\r]+)|[^!\n\r])*)/) do
|
1046
|
-
source.scan(Regexp.new("#{/^\s*namelist\s
|
1048
|
+
source.scan(Regexp.new("#{/^\s*namelist\s*\/\s*(?<namelist>\w+)\s*\//}(?<variables>#{FORTRAN_SINGLE_LINE})")) do
|
1047
1049
|
namelist = $~[:namelist].to_s.downcase.to_sym
|
1048
1050
|
variables = $~[:variables].gsub(/!.*/, '')
|
1049
1051
|
eputs namelist, variables
|
@@ -1095,6 +1097,7 @@ def self.synchronise_variables(source_code_folder = ARGV[2])
|
|
1095
1097
|
eputs nms.keys.zip(nms.values.map{|vs| vs.size})
|
1096
1098
|
eputs "Namelists to be added to. (Press Enter)"; STDIN.gets
|
1097
1099
|
n = 0
|
1100
|
+
ep nms
|
1098
1101
|
# ep nms.values.sum
|
1099
1102
|
nms.values.sum.each do |var|
|
1100
1103
|
eputs var if variable_exists? var
|
@@ -59,6 +59,9 @@ class CodeRunner
|
|
59
59
|
super(mess)
|
60
60
|
end
|
61
61
|
end
|
62
|
+
# The defaults that are saved in the root folder
|
63
|
+
|
64
|
+
FOLDER_DEFAULTS = [:code, :modlet, :executable, :defaults_file, :project]
|
62
65
|
|
63
66
|
# Parameters important to the submission of a run, which can be set by command line flags. The runner values provide the default values for the submit function, but can be overidden in that function. All the runner does with them is set them as properties of the run to be submitted. It is the run itself for which the options are relevant.
|
64
67
|
|
@@ -66,7 +69,7 @@ class CodeRunner
|
|
66
69
|
|
67
70
|
# A hash containing the defaults for most runner options. They are overridden by any options provided during initialisation. They are mostly set at the command line (in practice, the command line flags are read into the command options, which set these defaults in the function CodeRunner.process_command_options which calls CodeRunner.set_runner_defaults). However, if Code Runner is being scripted, these defaults must be set manually or else the options they specify must be provided when initialising a runner.
|
68
71
|
|
69
|
-
DEFAULT_RUNNER_OPTIONS = ([:conditions, :
|
72
|
+
DEFAULT_RUNNER_OPTIONS = ([:conditions, :sort, :debug, :script_folder, :recalc_all, :multiple_processes, :heuristic_analysis, :test_submission, :reprocess_all, :use_large_cache, :use_large_cache_but_recheck_incomplete, :use_phantom, :no_run, :server, :version, :parameters] + SUBMIT_OPTIONS + FOLDER_DEFAULTS).inject({}){|hash, option| hash[option] = nil; hash}
|
70
73
|
|
71
74
|
# Options that apply across the CodeRunner class
|
72
75
|
|
@@ -232,9 +235,6 @@ class CodeRunner
|
|
232
235
|
|
233
236
|
private :set_max_id
|
234
237
|
|
235
|
-
# The defaults that are saved in the root folder
|
236
|
-
|
237
|
-
FOLDER_DEFAULTS = [:code, :modlet, :executable, :defaults_file, :project]
|
238
238
|
|
239
239
|
# Read any default options contained in the file <tt>.code_runner_script_defaults.rb</tt> in the root folder.
|
240
240
|
|
data/lib/coderunner/run.rb
CHANGED
@@ -410,7 +410,7 @@ end
|
|
410
410
|
|
411
411
|
def defaults_location
|
412
412
|
if @runner.defaults_file
|
413
|
-
location = [
|
413
|
+
location = [rcp.user_defaults_location, rcp.code_module_folder + "/defaults_files"].find{|folder| FileTest.exist? folder and Dir.entries(folder).include? defaults_file_name}
|
414
414
|
raise "Defaults file: #{defaults_file_name} not found" unless location
|
415
415
|
return location
|
416
416
|
else
|
@@ -786,6 +786,7 @@ def self.check_and_update
|
|
786
786
|
@all = (rcp.variables + rcp.results + rcp.run_info) #.each{|v| ALL.push v}
|
787
787
|
# ep "GOT HERE"
|
788
788
|
(@all + [:directory, :run_name, :modlet, :relative_directory]).each{|var| send(:attr_accessor, var)}
|
789
|
+
@user_defaults_location = ENV['HOME'] + "/.coderunner/#{@code}crmod/defaults_files"
|
789
790
|
define_method(:output_file) do
|
790
791
|
return @output_file if @output_file
|
791
792
|
@output_file = super()
|
@@ -15,6 +15,7 @@ end
|
|
15
15
|
|
16
16
|
def run_command
|
17
17
|
if rcp.uses_mpi
|
18
|
+
raise "Number of processors (nprocs) not specified" unless @nprocs
|
18
19
|
return %[time mpirun -np #{@nprocs} #{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}]
|
19
20
|
else
|
20
21
|
return %[#{executable_location}/#{executable_name} #{parameter_string} > #{output_file} 2> #{error_file}]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coderunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: graphkit
|