coderunner 0.12.10 → 0.12.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.12.10
1
+ 0.12.11
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.10"
8
+ s.version = "0.12.11"
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-26"
12
+ s.date = "2013-06-27"
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"]
@@ -382,10 +382,11 @@ class CodeRunner
382
382
 
383
383
  # p run_class_name
384
384
 
385
+ return recursive_const_get(run_class_name) if SETUP_RUN_CLASSES.include?(run_class_name) #constants.include? (run_class_name).to_sym unless options[:force] #and const_get(run_class_name).rcp.code?
386
+ #return const_get(run_class_name) if constants.include? (run_class_name).to_sym unless options[:force] #and const_get(run_class_name).rcp.code?
387
+ SETUP_RUN_CLASSES.push run_class_name #.downcase
385
388
  FileUtils.makedirs(ENV['HOME'] + "/.coderunner/#{code}crmod/")
386
389
  FileUtils.makedirs(ENV['HOME'] + "/.coderunner/#{code}crmod/defaults_files")
387
- return const_get(run_class_name) if constants.include? (run_class_name).to_sym unless options[:force]
388
- SETUP_RUN_CLASSES.push run_class_name.downcase
389
390
 
390
391
  #Create the run_class, a special dynamically created class which knows how to process runs of the given code on the current system.
391
392
  #run.rb contains the basic methods of the class
@@ -409,6 +410,7 @@ class CodeRunner
409
410
  # ep get_run_class_name(code, nil)
410
411
  run_class = const_get(get_run_class_name(code, nil))
411
412
  run_class.instance_variable_set(:@code, code)
413
+ run_class.instance_variable_set(:@sys, SYS)
412
414
 
413
415
  raise "#{run_class} must inherit from CodeRunner::Run: its ancestors are: #{run_class.ancestors}" unless run_class.ancestors.include? Run
414
416
 
@@ -105,18 +105,24 @@ end
105
105
  @my_class = the_class
106
106
  end
107
107
  def method_missing(method, value=nil)
108
+ #eputs 'STARTING'
108
109
  if method.to_s =~ /=$/
109
110
  raise 'rcps should not be set outside class methods'
110
111
  @my_class.instance_variable_set("@"+method.to_s.sub(/=/, ''), value)
111
112
  else
112
113
  the_class = @my_class
113
114
  loop do
114
- # p the_class, method
115
+ #p the_class, method
115
116
  # p the_class.instance_variables
116
117
  # p the_class.instance_variables.map{|v| the_class.instance_variable_get(v)}
117
- return the_class.instance_variable_get("@"+method.to_s) if the_class.instance_variables.include?(("@"+method.to_s).to_sym)
118
- the_class = the_class.superclass
119
- return nil unless the_class
118
+ if method.to_s =~ /\?$/
119
+ return false unless the_class
120
+ return true if the_class.instance_variables.include?(("@"+method.to_s.sub(/\?$/,'')).to_sym)
121
+ else
122
+ raise NoMethodError.new("Run class property #{method} not found.") unless the_class
123
+ return the_class.instance_variable_get("@"+method.to_s) if the_class.instance_variables.include?(("@"+method.to_s).to_sym)
124
+ end
125
+ the_class = the_class.superclass
120
126
  end
121
127
 
122
128
  end
@@ -645,7 +651,7 @@ def prepare_submission(options={})
645
651
  generate_input_file
646
652
 
647
653
  File.open(".code_runner_version.txt", 'w'){|file| file.puts CODE_RUNNER_VERSION}
648
- File.open("code_runner_modlet.rb", 'w'){|file| file.puts rcp.modlet_source} if rcp.modlet_required
654
+ #File.open("code_runner_modlet.rb", 'w'){|file| file.puts rcp.modlet_source} if rcp.modlet_required
649
655
  end
650
656
  @dir_name = nil
651
657
 
@@ -768,7 +774,7 @@ def self.check_and_update
768
774
  raise CRFatal.new("#{v} not defined correctly: class is #{rcp[v].class} instead of one of #{class_list.to_s}") unless class_list.include? rcp[v].class
769
775
  end
770
776
 
771
- @readout_list = (rcp.variables+rcp.results) unless rcp.readout_list
777
+ @readout_list = (rcp.variables+rcp.results) unless rcp.readout_list?
772
778
 
773
779
  raise "
774
780
 
@@ -802,7 +808,9 @@ to your code module.
802
808
  @all = (rcp.variables + rcp.results + rcp.run_info) #.each{|v| ALL.push v}
803
809
  # ep "GOT HERE"
804
810
  (@all + [:directory, :run_name, :modlet, :relative_directory]).each{|var| send(:attr_accessor, var)}
805
- @user_defaults_location = ENV['HOME'] + "/.coderunner/#{@code}crmod/defaults_files"
811
+ eputs "Checking and updating"
812
+ @user_defaults_location = ENV['HOME'] + "/.coderunner/#{rcp.code}crmod/defaults_files"
813
+ eputs ' user_defaults_location', rcp.user_defaults_location
806
814
  define_method(:output_file) do
807
815
  return @output_file if @output_file
808
816
  @output_file = super()
@@ -25,6 +25,8 @@ class CodeRunner
25
25
 
26
26
  @uses_mpi = false
27
27
 
28
+ #@readout_list = @variables + @results
29
+
28
30
  @code_module_folder = folder = File.dirname(File.expand_path(__FILE__)) # i.e. the directory this file is in
29
31
 
30
32
  def process_directory_code_specific
data/test/helper.rb CHANGED
@@ -13,6 +13,9 @@ require 'shoulda'
13
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
14
  $LOAD_PATH.unshift(File.dirname(__FILE__))
15
15
  require 'coderunner'
16
+ require 'cubecalccrmod'
17
+ require 'cubecalccrmod/sleep'
18
+
16
19
 
17
20
  class Test::Unit::TestCase
18
21
  end
@@ -25,6 +25,12 @@ class TestSubmission < Test::Unit::TestCase
25
25
  string = $cpp_command + ' ../cubecalc.cc -o cubecalc'
26
26
  FileUtils.makedirs('test/submission_results')
27
27
  Dir.chdir('test/submission_results'){assert_system string}
28
+ CodeRunner.setup_run_class('cubecalc', modlet: 'sleep')
29
+ end
30
+ def test_setup_run_class
31
+ assert(CodeRunner::Cubecalc::Sleep.ancestors.include?(CodeRunner::SYSTEM_MODULE), "CodeRunner::Cubecalc.ancestors.include? CodeRunner::SYS, ancestors: #{CodeRunner::Cubecalc.ancestors}")
32
+ assert(CodeRunner::Cubecalc::Sleep.rcp.user_defaults_location?, "CodeRunner::Cubecalc::Sleep.rcp.user_defaults_location? #{CodeRunner::Cubecalc::Sleep.rcp.user_defaults_location?}")
33
+ assert_equal(ENV['HOME'] + '/.coderunner/cubecalccrmod/defaults_files', CodeRunner::Cubecalc::Sleep.rcp.user_defaults_location)
28
34
  end
29
35
  def test_submission
30
36
  CodeRunner.submit(Y: 'test/submission_results', C: 'cubecalc', m: 'empty', X: Dir.pwd + '/test/submission_results/cubecalc')
@@ -235,6 +241,7 @@ class TestCodeRunner < Test::Unit::TestCase
235
241
  end
236
242
 
237
243
  def test_graphkit_multiplot
244
+ unless ENV['SHORT_TEST']
238
245
  Dir.chdir('test/results') do
239
246
 
240
247
  ######################
@@ -310,6 +317,7 @@ EOF
310
317
 
311
318
  end # Dir.chdir
312
319
 
320
+ end # unless
313
321
 
314
322
 
315
323
  end # def
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.10
4
+ version: 0.12.11
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-26 00:00:00.000000000 Z
12
+ date: 2013-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: graphkit