Module: Experiment::Distributed::Slave
- Defined in:
- lib/experiment/distributed/slave.rb
Overview
this module is included into base when running as worker
Instance Attribute Summary collapse
-
#master ⇒ Object
master server DRb object.
Instance Method Summary collapse
-
#run!(not_used_arg) ⇒ Object
Main function.
- #test_data ⇒ Object
Instance Attribute Details
#master ⇒ Object
master server DRb object
6 7 8 |
# File 'lib/experiment/distributed/slave.rb', line 6 def master @master end |
Instance Method Details
#run!(not_used_arg) ⇒ Object
Main function. Will continously request work from the server, execute it and send back results, then loops to the beggining.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/experiment/distributed/slave.rb', line 10 def run!(not_used_arg) while work = @master.get_work puts work.inspect Experiment::Config.set work[:options] @current_cv = work[:cv] @dir = work[:dir] @data = work[:input] #@data = work[:input] File.open(@dir + "/raw-#{@current_cv}.txt", "w") do |output| @ouptut_file = output run_the_experiment end result = analyze_result!(@dir + "/raw-#{@current_cv}.txt", @dir + "/analyzed-#{@current_cv}.txt") write_performance! @master.submit_result @current_cv, result, @abm.first end end |
#test_data ⇒ Object
30 31 32 |
# File 'lib/experiment/distributed/slave.rb', line 30 def test_data @data end |