Class: Jkr::Trial
- Inherits:
-
Object
- Object
- Jkr::Trial
- Defined in:
- lib/jkr/trial.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
7 8 9 |
# File 'lib/jkr/trial.rb', line 7 def params @params end |
Class Method Details
.make_trials(resultset_dir, plan) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/jkr/trial.rb', line 9 def self.make_trials(resultset_dir, plan) var_combs = [{}] plan.vars.each do |key, vals| var_combs = vals.map {|val| var_combs.map do |var_comb| var_comb.dup.merge(key => val) end }.flatten end var_combs.map do |var_comb| result_dir = Utils.reserve_next_dir(resultset_dir) Trial.new(result_dir, plan, plan.params.merge(var_comb)) end end |
.run(env, plan) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/jkr/trial.rb', line 25 def self.run(env, plan) plan_suffix = File.basename(plan.file_path, ".plan") resultset_dir = Utils.reserve_next_dir(env.jkr_result_dir, plan_suffix) trials = self.make_trials(resultset_dir, plan) FileUtils.copy_file(plan.file_path, File.join(resultset_dir, File.basename(plan.file_path))) params = plan.params.merge(plan.vars) plan.freeze plan.prep.call(plan) trials.each do |trial| trial.run end plan.cleanup.call(plan) end |
Instance Method Details
#run ⇒ Object
48 49 50 51 52 |
# File 'lib/jkr/trial.rb', line 48 def run() Jkr::TrialUtils.define_routine_utils(@result_dir, @plan, @params) @plan.routine.call(@plan, @params) Jkr::TrialUtils.undef_routine_utils(@plan) end |