Module: Experiment::Factorial::DistributedFactorial

Defined in:
lib/experiment/factorial.rb

Overview

This module is a basis for the distributed implementation it is a WiP

Instance Method Summary collapse

Instance Method Details

#master_done!Object

Cleans up the master server after all work is done



213
214
215
216
217
218
219
220
221
222
223
# File 'lib/experiment/factorial.rb', line 213

def master_done!
  @done = true
  specification! true
  summarize_performance!
summarize_results! @results
cleanup!
#Notify.completed @experiment

#sleep 1
  #DRb.stop_service
end

#master_run!(cv) ⇒ Object

Strats up the master server



199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/experiment/factorial.rb', line 199

def master_run!(cv)
  @dir = "#{parent_dir}/#{@options.opts}"
Dir.mkdir @dir
  @cvs = cv || 1
  @results = {}
#Notify.started @experiment
  split_up_data
#write_dir!
exps = param_grid.product((1..@cvs).to_a)
@completed = Hash[*exps.map {|a| [a, false] }.flatten]
@started = @completed.dup
end

#master_sub_experiments(cv) ⇒ Object



181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/experiment/factorial.rb', line 181

def master_sub_experiments(cv)
  write_dir!
  param_grid.map do |paramset|
    if @options.opts == ""
      @options.opts = paramset.map {|k,v| "#{k}:#{v}"}.join(",")
    else
      @options.opts += "," + paramset.map {|k,v| "#{k}:#{v}"}.join(",")
    end
    child = self.class.new :master, @experiment, @options
    child.parent_dir = @dir
    child.master_run! cv
    child
  end
end