Sha256: a867036d3a4203e7309cc20219bf22e58358e2700dc06771f856b3e167fb8c0f

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

module Experiment
  module Distributed
    # this module is included into base when running as worker
    module Slave
      # master server DRb object
      attr_accessor :master

      # Main function. Will continously request work from the server,
      # execute it and send back results, then loops to the beggining.
      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
      
      
      def test_data
        @data
      end
      
    end # Master
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
experiment-0.3.3 lib/experiment/distributed/slave.rb