coderunner 0.13.32 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/coderunner.gemspec +3 -3
- data/lib/coderunner.rb +3 -3
- data/lib/coderunner/class_methods.rb +1 -1
- data/lib/coderunner/instance_methods.rb +43 -43
- data/lib/coderunner/remote_code_runner.rb +15 -41
- data/lib/coderunner/run.rb +22 -18
- data/test/test_coderunner.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eee1c0c5559da6b53befae6f8cc6324408bc731d
|
4
|
+
data.tar.gz: eb3da6aaf1ca4be11a21f0b3c50b44cb19aba695
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8648f2cfbcf554a1d6edb11ce403b57dc1fbd65f6445b09c132d04983a0316ef81c7e09e3e15a001dfe4e547350ad1bcc5b0e1ee3b3eeb1aa8e3bdcbccac6ec
|
7
|
+
data.tar.gz: 10723843e323fb8dbcc06f963a490ee1dab8e95a635a668a8b00b9a00b6827fb4e418f5ca1d8f9ee2659317441f9fb9a8cc14b75c1cd7e25e100eb5d5dbceb9c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.14.0
|
data/coderunner.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: coderunner 0.
|
5
|
+
# stub: coderunner 0.14.0 ruby lib
|
6
6
|
# stub: ext/extconf.rb
|
7
7
|
|
8
8
|
Gem::Specification.new do |s|
|
9
9
|
s.name = "coderunner"
|
10
|
-
s.version = "0.
|
10
|
+
s.version = "0.14.0"
|
11
11
|
|
12
12
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
s.authors = ["Edmund Highcock"]
|
15
|
-
s.date = "2014-
|
15
|
+
s.date = "2014-02-04"
|
16
16
|
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."
|
17
17
|
s.email = "edmundhighcock@sourceforge.net"
|
18
18
|
s.executables = ["coderunner"]
|
data/lib/coderunner.rb
CHANGED
@@ -143,7 +143,7 @@ class CodeRunner
|
|
143
143
|
["--run-graph", "-g", GetoptLong::REQUIRED_ARGUMENT, %[Specify a run_graphkit to plot. A run_graphkit is one that is plotted for an individual run. The run graphkits available depend on the code module. The syntax is graphkit shorthand:\n -g '<graph_name>[ ; <graph_options> [ ; <conditions> [ ; <sort> ] ] ]'\n where conditions (i.e. filter) and sort will override the -f and -O flags respectively. The -g flag can be specified multiple times, which will plot multiple graphs on the same page.]],
|
144
144
|
["--graph", "-G", GetoptLong::REQUIRED_ARGUMENT, %[Specify a graphkit to plot. A graphkit combines data for every filtered run. The syntax is graphkit shorthand:\n -G '<axis1>[ : <axis2> [ : <axis3 [ : <axis4> ] ] ] [ ; <graph_options> [ ; <conditions> [ ; <sort> ] ] ]'\n where conditions (i.e. filter) and sort will override the -f and -O flags respectively. <axis1> etc are strings which can be evaluated by the runs. The -G flag can be specified multiple times, which will plot multiple graphs on the same page. For example\n -G 'width : 2*height ; {} ; depth == 2 ; width'\n will plot twice the height against the width for every run where the depth is equal to 2, and will order the data points by width.]],
|
145
145
|
["--heuristic-analysis", "-H", GetoptLong::NO_ARGUMENT, %[Should be specified whenever CodeRunner is being used to analyse simulations which did not originally submit (and which will therefore not have the usual CodeRunner meta data stored with them).] ],
|
146
|
-
["--use-
|
146
|
+
["--use-component", "-h", GetoptLong::OPTIONAL_ARGUMENT, %[Specify whether to use real or component runs]],
|
147
147
|
["--just", "-j", GetoptLong::REQUIRED_ARGUMENT, %[Specify individual run ids. For example -j 45,63,128 is shorthand for -f 'id==45 or id==63 or id==128']],
|
148
148
|
["--job_chain", "-J", GetoptLong::NO_ARGUMENT, %[Chain multiple simulations into one batch/submission job. Most useful for HPC systems.]],
|
149
149
|
["--skip-similar-jobs-off", "-k", GetoptLong::NO_ARGUMENT, %[Normally CodeRunner will not submit a run whose input parameters identical to a previous run (to avoid wasting computer time). Specifying the flag will override that behaviour and force submission of an identical run.]],
|
@@ -294,8 +294,8 @@ EOF
|
|
294
294
|
copts[:u]=true
|
295
295
|
when "--wall-mins"
|
296
296
|
copts[:W] = arg.to_i
|
297
|
-
when "--use-
|
298
|
-
copts[:h] = (arg and arg =~ /\S/) ? arg.to_sym : :
|
297
|
+
when "--use-component"
|
298
|
+
copts[:h] = (arg and arg =~ /\S/) ? arg.to_sym : :component
|
299
299
|
when "--terminal-size"
|
300
300
|
array = eval arg
|
301
301
|
ENV['ROWS'], ENV['COLS'] = array[0].to_s, array[1].to_s
|
@@ -69,7 +69,7 @@ class CodeRunner
|
|
69
69
|
|
70
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.
|
71
71
|
|
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, :
|
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_component, :no_run, :server, :version, :parameters] + SUBMIT_OPTIONS + FOLDER_DEFAULTS).inject({}){|hash, option| hash[option] = nil; hash}
|
73
73
|
|
74
74
|
# Options that apply across the CodeRunner class
|
75
75
|
|
@@ -100,7 +100,7 @@ class CodeRunner
|
|
100
100
|
# end
|
101
101
|
# end
|
102
102
|
|
103
|
-
DEFAULT_RUNNER_OPTIONS[:
|
103
|
+
DEFAULT_RUNNER_OPTIONS[:use_component] = :real
|
104
104
|
DEFAULT_RUNNER_OPTIONS[:script_folder] = SCRIPT_FOLDER #File.dirname(File.expand_path(__FILE__))
|
105
105
|
|
106
106
|
# These are properties of the run class that must be defined. For more details see CodeRunner::Run.
|
@@ -153,7 +153,7 @@ class CodeRunner
|
|
153
153
|
|
154
154
|
|
155
155
|
|
156
|
-
attr_accessor :run_list, :
|
156
|
+
attr_accessor :run_list, :component_run_list, :combined_run_list, :ids, :component_ids, :combined_ids, :current_status, :run_class, :requests, :current_request, :root_folder, :print_out_size, :cache, :modlet, :code, :executable, :defaults_file
|
157
157
|
attr_reader :max_id, :maxes, :cmaxes, :mins, :cmins, :start_id
|
158
158
|
|
159
159
|
# Instantiate a new runner. The root folder contains a set of simulations, each of which has a unique ID. There is a one-to-one correspondence between a runner and a root folder: no two runners should ever be given the same root folder in the same script (there are safeguards to prevent this causing much trouble, but it should still be avoided on philosophical grounds), and no runner should be given a folder which has more than one set of simulations within it (as these simulations will contain duplicate IDs).
|
@@ -190,8 +190,8 @@ class CodeRunner
|
|
190
190
|
@run_list = {}; @ids = []
|
191
191
|
set_max_id(0)
|
192
192
|
|
193
|
-
@
|
194
|
-
@
|
193
|
+
@component_run_list = {}; @component_ids = []
|
194
|
+
@component_id = -1
|
195
195
|
|
196
196
|
@combined_run_list = {}; @combined_ids = []
|
197
197
|
|
@@ -615,9 +615,9 @@ EOF
|
|
615
615
|
#
|
616
616
|
# Then the runs will be sorted according to first height, then (descending) weight, then colour. What actually happens is that the variable <tt>@ids</tt> is sorted, rather than <tt>@run_list</tt>. For this to work, height, weight and colour must be either variables or results or instance methods of the run class.
|
617
617
|
#
|
618
|
-
# Type can be either '' or '
|
618
|
+
# Type can be either '' or 'component', in which case the variable sorted will be either <tt>@ids</tt> or <tt>@component_ids</tt> respectively.
|
619
619
|
|
620
|
-
def sort_runs(type = @
|
620
|
+
def sort_runs(type = @use_component.to_s.sub(/real/, ''))
|
621
621
|
logf(:sort_runs)
|
622
622
|
log(:type, type)
|
623
623
|
#ep 'sort', @sort
|
@@ -714,11 +714,11 @@ EOF
|
|
714
714
|
|
715
715
|
# def filtered_run_list
|
716
716
|
# logf :filtered_run_list
|
717
|
-
# unless @
|
717
|
+
# unless @use_component == :component
|
718
718
|
# return @run_list.find_all{|id, run| filter(run)}
|
719
719
|
# else
|
720
|
-
# log 'using
|
721
|
-
# return @
|
720
|
+
# log 'using component'
|
721
|
+
# return @component_run_list.find_all{|id, run| filter(run)}
|
722
722
|
# end
|
723
723
|
# end
|
724
724
|
|
@@ -742,7 +742,7 @@ EOF
|
|
742
742
|
@run = run
|
743
743
|
# to_instance_variables(directory)
|
744
744
|
return true unless conditions
|
745
|
-
# p conditions, @run.id, @run.
|
745
|
+
# p conditions, @run.id, @run.is_component
|
746
746
|
conditions = conditions.dup
|
747
747
|
raise CRFatal.new("
|
748
748
|
-----------------------------
|
@@ -817,8 +817,8 @@ Conditions contain a single = sign: #{conditions}
|
|
817
817
|
|
818
818
|
@run_list={}
|
819
819
|
@ids=[]
|
820
|
-
@
|
821
|
-
@
|
820
|
+
@component_run_list = {}
|
821
|
+
@component_ids = []
|
822
822
|
@run_store =[]
|
823
823
|
# @multiple_processes_directories = []
|
824
824
|
set_max_id 0
|
@@ -877,9 +877,9 @@ Conditions contain a single = sign: #{conditions}
|
|
877
877
|
# raise CRFatal.new("Directory #{run.directory} not found")
|
878
878
|
# end
|
879
879
|
# end
|
880
|
-
# eputs @
|
881
|
-
#run.
|
882
|
-
run.
|
880
|
+
# eputs @use_component
|
881
|
+
#run.generate_component_runs #if @use_component.to_s =~ /component/i
|
882
|
+
run.component_runs.each{|r| add_component_run(r)} if run.component_runs
|
883
883
|
end
|
884
884
|
eputs if @write_status_dots
|
885
885
|
save_large_cache if fix_directories
|
@@ -899,8 +899,8 @@ Conditions contain a single = sign: #{conditions}
|
|
899
899
|
log("not using large cache")
|
900
900
|
@run_list={}
|
901
901
|
@ids=[]
|
902
|
-
@
|
903
|
-
@
|
902
|
+
@component_run_list = {}
|
903
|
+
@component_ids = []
|
904
904
|
@run_store =[]
|
905
905
|
# @multiple_processes_directories = []
|
906
906
|
set_max_id 0
|
@@ -921,7 +921,7 @@ Conditions contain a single = sign: #{conditions}
|
|
921
921
|
@recalc_all = false
|
922
922
|
# pp @run_list
|
923
923
|
save_large_cache
|
924
|
-
#@run_list.each{|id, run| run.
|
924
|
+
#@run_list.each{|id, run| run.generate_component_runs}
|
925
925
|
#trap(2, old_trap2)
|
926
926
|
#Process.kill(2, 0) if interrupted
|
927
927
|
return self
|
@@ -938,7 +938,7 @@ Conditions contain a single = sign: #{conditions}
|
|
938
938
|
instance_vars[:@run_list].values.each{|run| run.runner=nil}
|
939
939
|
#Kernel.puts server_dump(instance_vars)
|
940
940
|
instance_vars[:@cache]={}
|
941
|
-
instance_vars[:@
|
941
|
+
instance_vars[:@component_run_list].values.each{|run| run.runner = nil}
|
942
942
|
#ep 'marsh2'
|
943
943
|
#eputs instance_vars.pretty_inspect
|
944
944
|
#instance_vars.each do |var, val|
|
@@ -958,9 +958,9 @@ Conditions contain a single = sign: #{conditions}
|
|
958
958
|
# pp @run_list.values.map{|run| run.instance_variables.map{|var| [var, run.instance_variable_get(var).class]}}
|
959
959
|
|
960
960
|
generate_combined_ids
|
961
|
-
@combined_run_list.each{|id, run| run.runner = nil; run.
|
961
|
+
@combined_run_list.each{|id, run| run.runner = nil; run.component_runs.each{|pr| pr.runner=nil} if run.component_runs}
|
962
962
|
File.open(@root_folder + "/.CODE_RUNNER_TEMP_RUN_LIST_CACHE", 'w'){|file| file.puts Marshal.dump @run_list}
|
963
|
-
@combined_run_list.each{|id, run| run.runner = self; run.
|
963
|
+
@combined_run_list.each{|id, run| run.runner = self; run.component_runs.each{|pr| pr.runner=self} if run.component_runs}
|
964
964
|
end
|
965
965
|
|
966
966
|
# Self-explanatory! Call CodeRunner::Run#process_directory for every run whose status is not either :Complete or :Failed. (Note, for historical reasons traverse_directories is called rather than CodeRunner::Run#process_directory directly but the effect is nearly the same).
|
@@ -1029,7 +1029,7 @@ Conditions contain a single = sign: #{conditions}
|
|
1029
1029
|
def respond_to_requests
|
1030
1030
|
logf(:respond_to_requests)
|
1031
1031
|
logi(:@requests, @requests)
|
1032
|
-
log('@
|
1032
|
+
log('@component_run_list.class', @component_run_list.class)
|
1033
1033
|
while @requests[0]
|
1034
1034
|
old_requests = @requests.uniq
|
1035
1035
|
@requests = []
|
@@ -1038,8 +1038,8 @@ Conditions contain a single = sign: #{conditions}
|
|
1038
1038
|
if request == :traverse_directories # a special case
|
1039
1039
|
@ids = []
|
1040
1040
|
@run_list = {}
|
1041
|
-
@
|
1042
|
-
@
|
1041
|
+
@component_run_list = {}
|
1042
|
+
@component_ids = []
|
1043
1043
|
|
1044
1044
|
Dir.chdir(@root_folder){traverse_directories}
|
1045
1045
|
else
|
@@ -1446,7 +1446,7 @@ EOF
|
|
1446
1446
|
def similar_runs(exclude_variables=[], run=@run) #all runs for which variables are the same as 'run', with the exception of exclude_variables
|
1447
1447
|
logf(:similar_runs)
|
1448
1448
|
raise CRFatal.new("generate_combined_ids must be called before this function is called") unless (@combined_run_list.size > 0 and @combined_ids.size > 0) or @ids.size ==0
|
1449
|
-
command = (run.class.rcp.variables+run.class.rcp.run_info-exclude_variables - [:output_file, :error_file, :runner, :
|
1449
|
+
command = (run.class.rcp.variables+run.class.rcp.run_info-exclude_variables - [:output_file, :error_file, :runner, :component_runs]).inject("@combined_ids.find_all{|id| @combined_run_list[id].class == run.class}"){ |s,v|
|
1450
1450
|
s + %<.find_all{|id| @combined_run_list[id].#{v}.class == #{run.send(v).inspect}.class and @combined_run_list[id].#{v} == #{run.send(v).inspect}}>} #the second send call retrieves the type conversion
|
1451
1451
|
|
1452
1452
|
# log command
|
@@ -1528,8 +1528,8 @@ EOF
|
|
1528
1528
|
def dup
|
1529
1529
|
logf(:dup)
|
1530
1530
|
new_one = self.class.new(@code, @root_folder, modlet: @modlet, version: @version)
|
1531
|
-
new_one.ids = @ids.dup; new_one.
|
1532
|
-
new_one.run_list = @run_list.dup; new_one.
|
1531
|
+
new_one.ids = @ids.dup; new_one.component_ids = @component_ids.dup;
|
1532
|
+
new_one.run_list = @run_list.dup; new_one.component_run_list = @component_run_list.dup
|
1533
1533
|
new_one.run_class = @run_class
|
1534
1534
|
return new_one
|
1535
1535
|
end
|
@@ -1600,12 +1600,12 @@ EOF
|
|
1600
1600
|
# @recalc_all = old_recalc
|
1601
1601
|
# end
|
1602
1602
|
|
1603
|
-
def
|
1604
|
-
@
|
1605
|
-
@
|
1603
|
+
def add_component_run(run)
|
1604
|
+
@component_run_list[@component_id] = run
|
1605
|
+
@component_ids.push @component_id
|
1606
1606
|
#run.real_id = run.id
|
1607
|
-
run.id = @
|
1608
|
-
@
|
1607
|
+
run.id = @component_id
|
1608
|
+
@component_id += -1
|
1609
1609
|
end
|
1610
1610
|
|
1611
1611
|
def generate_combined_ids(kind= nil)
|
@@ -1613,28 +1613,28 @@ EOF
|
|
1613
1613
|
# case purpose
|
1614
1614
|
# when :print_out
|
1615
1615
|
# @combined_ids = []
|
1616
|
-
# @combined_ids += @
|
1616
|
+
# @combined_ids += @component_ids if @run_class.print_out_component_run_list
|
1617
1617
|
# @combined_ids += @ids if @run_class.print_out_real_run_list
|
1618
1618
|
# when :readout
|
1619
1619
|
# @combined_ids = []
|
1620
|
-
# @combined_ids += @
|
1620
|
+
# @combined_ids += @component_ids if @run_class.readout_component_run_list
|
1621
1621
|
# @combined_ids += @ids if @run_class.readout_real_run_list
|
1622
1622
|
# when :submitting
|
1623
1623
|
# @combined_ids = @ids
|
1624
|
-
kind ||= @
|
1624
|
+
kind ||= @use_component
|
1625
1625
|
case kind
|
1626
1626
|
when :real
|
1627
1627
|
@combined_ids = @ids
|
1628
|
-
when :
|
1629
|
-
@combined_ids = @
|
1628
|
+
when :component
|
1629
|
+
@combined_ids = @component_ids
|
1630
1630
|
when :both
|
1631
|
-
@combined_ids = @ids + @
|
1631
|
+
@combined_ids = @ids + @component_ids
|
1632
1632
|
else
|
1633
|
-
raise CRFatal.new("Bad use
|
1633
|
+
raise CRFatal.new("Bad use component variable: #{kind.inspect}")
|
1634
1634
|
end
|
1635
|
-
log('@
|
1636
|
-
#puts 'crlist', @
|
1637
|
-
@combined_run_list = @
|
1635
|
+
log('@component_run_list.class', @component_run_list.class)
|
1636
|
+
#puts 'crlist', @component_run_list.keys, @run_list.keys
|
1637
|
+
@combined_run_list = @component_run_list + @run_list
|
1638
1638
|
log(:kind, kind)
|
1639
1639
|
# log(:combined_ids, @combined_ids)
|
1640
1640
|
sort_runs(:combined)
|
@@ -24,11 +24,11 @@ class RemoteCodeRunner < CodeRunner
|
|
24
24
|
# end
|
25
25
|
# end
|
26
26
|
|
27
|
-
attr_accessor :combined_ids, :
|
27
|
+
attr_accessor :combined_ids, :component_ids, :ids, :combined_run_list, :component_run_list, :run_list, :remote_cache, :libraries
|
28
28
|
|
29
29
|
# include Log
|
30
30
|
# puts instance_methods; exit
|
31
|
-
# SHOULD_NOT_BE_CALLED = :
|
31
|
+
# SHOULD_NOT_BE_CALLED = :add_component
|
32
32
|
class << self
|
33
33
|
aliold :new
|
34
34
|
def new(host, folder, copts = {})
|
@@ -158,7 +158,7 @@ cd #@folder
|
|
158
158
|
export ROWS=#{Terminal.terminal_size[0]}
|
159
159
|
export COLS=#{Terminal.terminal_size[1]}
|
160
160
|
source /etc/bashrc /etc/profile > /dev/null 2> /dev/null
|
161
|
-
|
161
|
+
#{%w{ ~/.bashrc ~/.bash_login ~/.bash_profile ~/.profile}.map{|w| "source #{w} > /dev/null 2> /dev/null "}.join(" && ")}
|
162
162
|
if [ "$CODE_RUNNER_COMMAND" ]
|
163
163
|
then
|
164
164
|
$CODE_RUNNER_COMMAND runner_eval #{string.inspect} -Z #{@copts.inspect.inspect}
|
@@ -224,12 +224,6 @@ EOF
|
|
224
224
|
eputs data[0..100] if err.class == TypeError
|
225
225
|
raise err unless err.message =~ /undefined class/
|
226
226
|
self.class.repair_marshal_run_class_not_found_error(err)
|
227
|
-
#NB this means that all code_names have to contain only lowercase letters:
|
228
|
-
# code, modlet = err.message.scan(/CodeRunner\:\:([A-Z][a-z0-9]+)([A-Z][\w]+)?Run/)[0]
|
229
|
-
# ep code, modlet
|
230
|
-
# modlet.gsub!(/\B([A-Z])/, '_\1') if modlet
|
231
|
-
# modlet = modlet.downcase if modlet
|
232
|
-
# @run_class = CodeRunner.setup_run_class(code.downcase, modlet: modlet)
|
233
227
|
retry
|
234
228
|
end
|
235
229
|
|
@@ -241,43 +235,23 @@ EOF
|
|
241
235
|
|
242
236
|
end
|
243
237
|
def update
|
244
|
-
# ep '@server1', @server
|
245
|
-
|
246
238
|
instance_vars = retrieve_method(:marshalled_variables) #.sub(/\A\s*/, '')
|
247
|
-
#begin
|
248
|
-
#instance_vars = Marshal.load(data)
|
249
|
-
#rescue TypeError, ArgumentError => err
|
250
|
-
#eputs err
|
251
|
-
#eputs data [0..100] if err.class == TypeError
|
252
|
-
#raise err unless err.message =~ /undefined class/
|
253
|
-
#self.class.repair_marshal_run_class_not_found_error(err)
|
254
|
-
##NB this means that all code_names have to contain only lowercase letters:
|
255
|
-
## code, modlet = err.message.scan(/CodeRunner\:\:([A-Z][a-z0-9]+)([A-Z][\w]+)?Run/)[0]
|
256
|
-
## ep code, modlet
|
257
|
-
## modlet.gsub!(/\B([A-Z])/, '_\1') if modlet
|
258
|
-
## modlet = modlet.downcase if modlet
|
259
|
-
## @run_class = CodeRunner.setup_run_class(code.downcase, modlet: modlet)
|
260
|
-
#retry
|
261
|
-
#end
|
262
|
-
# ep @run_class.executable
|
263
239
|
instance_vars[:@run_list].values.each{|run| run.runner=self}
|
264
|
-
# class_vars.each do |var, val|
|
265
|
-
# # raise 'found it ' + var.to_s if val.class == CodeRunner
|
266
|
-
# next if [:@@global_binding, :@@server, :SCRIPT_FOLDER, :@@sys].include? var
|
267
|
-
# self.class.class_variable_set(var, val)
|
268
|
-
# end
|
269
240
|
instance_vars.each do |var, val|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
241
|
+
case var
|
242
|
+
when :@server, :@sys
|
243
|
+
next
|
244
|
+
when :@use_phantom
|
245
|
+
# For backwards compatbility with versions < 0.14
|
246
|
+
instance_variable_set(:@use_component, val)
|
247
|
+
when :@phantom_run_list
|
248
|
+
# For backwards compatbility with versions < 0.14
|
249
|
+
instance_variable_set(:@component_run_list, val)
|
250
|
+
else
|
251
|
+
instance_variable_set(var, val)
|
252
|
+
end
|
274
253
|
end
|
275
|
-
# @run_class.executable = instance_vars[:@executable]
|
276
|
-
|
277
|
-
# ep @run_class.executable
|
278
|
-
# ep '@sort', @sort
|
279
254
|
sort_runs
|
280
|
-
# ep '@server', @server
|
281
255
|
return self
|
282
256
|
end
|
283
257
|
end
|
data/lib/coderunner/run.rb
CHANGED
@@ -26,11 +26,11 @@ class Run
|
|
26
26
|
#
|
27
27
|
# @@readout_real_run_list = true
|
28
28
|
# @@print_out_real_run_list = true
|
29
|
-
# @@
|
30
|
-
# @@
|
29
|
+
# @@readout_component_run_list = false
|
30
|
+
# @@print_out_component_run_list = false
|
31
31
|
|
32
32
|
|
33
|
-
# class_accessor :readout_real_run_list, :print_out_real_run_list, :
|
33
|
+
# class_accessor :readout_real_run_list, :print_out_real_run_list, :readout_component_run_list, :print_out_component_run_list,
|
34
34
|
|
35
35
|
class_accessor :current_status, :runner
|
36
36
|
|
@@ -293,7 +293,7 @@ def process_directory
|
|
293
293
|
raise CRFatal.new("status must be one of #{PERMITTED_STATI.inspect}") unless PERMITTED_STATI.include? @status
|
294
294
|
@max = {}
|
295
295
|
write_results
|
296
|
-
|
296
|
+
generate_component_runs
|
297
297
|
save
|
298
298
|
return self
|
299
299
|
end
|
@@ -337,7 +337,7 @@ def results_file
|
|
337
337
|
# ID: #{@id}
|
338
338
|
|
339
339
|
# Results:
|
340
|
-
#{(rcp.results+rcp.run_info - [:
|
340
|
+
#{(rcp.results+rcp.run_info - [:component_runs]).inject({}){|hash, (var,type_co)| hash[var] = send(var); hash}.pretty_inspect}
|
341
341
|
|
342
342
|
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
343
343
|
EOF
|
@@ -360,16 +360,18 @@ end
|
|
360
360
|
# Cache the run object in the file <tt>.code_runner_run_data</tt>
|
361
361
|
|
362
362
|
def save
|
363
|
+
|
363
364
|
logf(:save)
|
364
365
|
raise CRFatal.new("Something has gone horribly wrong: runner.class is #{@runner.class} instead of CodeRunner") unless @runner.class.to_s == "CodeRunner"
|
365
366
|
runner, @runner = @runner, nil
|
366
367
|
@system_triers, old_triers = nil, @system_triers
|
367
|
-
@
|
368
|
-
#@
|
368
|
+
@component_runs.each{|run| run.runner = nil} if @component_runs
|
369
|
+
#@component_runs.each{|run| run.runner = nil} if @component_runs
|
369
370
|
# logi(self)
|
371
|
+
#pp self
|
370
372
|
Dir.chdir(@directory){File.open(".code_runner_run_data", 'w'){|file| file.puts Marshal.dump(self)}}
|
371
373
|
@runner = runner
|
372
|
-
@
|
374
|
+
@component_runs.each{|run| run.runner = runner} if @component_runs
|
373
375
|
@system_triers = old_triers
|
374
376
|
end
|
375
377
|
|
@@ -398,8 +400,10 @@ def self.load(dir, runner)
|
|
398
400
|
run.runner = runner
|
399
401
|
raise CRFatal.new("Something has gone horribly wrong: runner.class is #{run.runner.class} instead of CodeRunner") unless run.runner.class.to_s == "CodeRunner"
|
400
402
|
run.directory = dir
|
401
|
-
|
402
|
-
|
403
|
+
# For backwards compatibility with versions < 0.14
|
404
|
+
run.instance_variable_set(:@component_run_list, run.instance_variable_get(:@phantom_run_list)) if run.instance_variable_get(:@phantom_run_list)
|
405
|
+
run.component_runs.each{|r| runner.add_component_run(r)} if run.component_runs
|
406
|
+
#@component_runs = []
|
403
407
|
return run
|
404
408
|
end
|
405
409
|
|
@@ -689,7 +693,7 @@ def info_file
|
|
689
693
|
# #{@job_no ? "Job_No: #{@job_no}" : ""}
|
690
694
|
|
691
695
|
# Parameters:
|
692
|
-
#{(rcp.variables + rcp.run_info + [:version, :code, :modlet, :sys] - [:
|
696
|
+
#{(rcp.variables + rcp.run_info + [:version, :code, :modlet, :sys] - [:component_runs]).inject({}){|hash, var| hash[var] = send(var) unless (!send(var) and send(var) == nil); hash}.pretty_inspect}
|
693
697
|
|
694
698
|
|
695
699
|
# Actual Command:
|
@@ -804,7 +808,7 @@ to your code module.
|
|
804
808
|
|
805
809
|
@run_info = rcp.run_info || [] # Run info can optionally be defined in the code module.
|
806
810
|
# ep @run_info
|
807
|
-
@run_info = rcp.run_info + ([:preamble, :job_no, :running, :id, :status, :sys, :
|
811
|
+
@run_info = rcp.run_info + ([:preamble, :job_no, :running, :id, :status, :sys, :is_component, :naming_pars, :run_name, :resubmit_id, :real_id, :component_runs, :parameter_hash, :output_file, :error_file] + SUBMIT_OPTIONS) #.each{|v| RUN_INFO.push v} unless RUN_INFO.include? :job_no
|
808
812
|
@all = (rcp.variables + rcp.results + rcp.run_info) #.each{|v| ALL.push v}
|
809
813
|
# ep "GOT HERE"
|
810
814
|
(@all + [:directory, :run_name, :modlet, :relative_directory]).each{|var| send(:attr_accessor, var)}
|
@@ -841,13 +845,13 @@ def dup
|
|
841
845
|
return self.class.new(@runner).learn_from(self)
|
842
846
|
end
|
843
847
|
|
844
|
-
def
|
845
|
-
@
|
848
|
+
def create_component
|
849
|
+
@component_runs ||= []
|
846
850
|
new_run = dup
|
847
|
-
new_run.
|
851
|
+
new_run.is_component = true
|
848
852
|
new_run.real_id = @id
|
849
|
-
@runner.
|
850
|
-
@
|
853
|
+
@runner.add_component_run(new_run)
|
854
|
+
@component_runs.push new_run
|
851
855
|
new_run
|
852
856
|
end
|
853
857
|
|
@@ -890,7 +894,7 @@ def recheck
|
|
890
894
|
end
|
891
895
|
end
|
892
896
|
|
893
|
-
def
|
897
|
+
def generate_component_runs
|
894
898
|
end
|
895
899
|
|
896
900
|
def generate_combined_ids(type)
|
data/test/test_coderunner.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coderunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Highcock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphkit
|