Sha256: 38edaa04f33b75a2838fbcecff768f1a22fc132dee2a9678f69e7b2de57a3cc6

Contents?: true

Size: 854 Bytes

Versions: 46

Compression:

Stored size: 854 Bytes

Contents

class HostState
  def initialize
    @running_workers = {}
  end

  def file_started worker_id, filename
    if @running_workers.has_key? worker_id
      puts "WARNING: worker #{worker_id} started running a new file, but a 'finish' message has not been received for file #{@running_workers[:filename]}"
    end

    @running_workers[worker_id] = filename
  end

  def file_finished worker_id, filename
    if !@running_workers.has_key? worker_id || @running_workers[:worker_id] != filename
      puts "WARNING: worker #{worker_id} finished running a file, but a 'start' message for that file was not received. File: #{filename}"
    end

    @running_workers.delete(worker_id)
  end

  def total_running_workers
    @running_workers.size
  end

  def each_running_file
    @running_workers.each_value do |filename|
      yield filename
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
gorgon-0.11.0 lib/gorgon/host_state.rb
gorgon-0.10.5 lib/gorgon/host_state.rb
gorgon-0.10.4 lib/gorgon/host_state.rb
gorgon-0.10.3 lib/gorgon/host_state.rb
gorgon-0.10.2 lib/gorgon/host_state.rb
gorgon-0.10.1 lib/gorgon/host_state.rb
gorgon-0.10.0 lib/gorgon/host_state.rb
gorgon-0.9.0 lib/gorgon/host_state.rb
gorgon-0.8.4 lib/gorgon/host_state.rb
gorgon-0.8.3 lib/gorgon/host_state.rb
gorgon-0.8.2 lib/gorgon/host_state.rb
gorgon-0.8.1 lib/gorgon/host_state.rb
gorgon-0.8.0 lib/gorgon/host_state.rb
gorgon-0.7.1 lib/gorgon/host_state.rb
gorgon-0.7.0 lib/gorgon/host_state.rb
gorgon-0.7.0.rc4 lib/gorgon/host_state.rb
gorgon-0.7.0.rc3 lib/gorgon/host_state.rb
gorgon-0.7.0.rc2 lib/gorgon/host_state.rb
gorgon-0.7.0.rc1 lib/gorgon/host_state.rb
gorgon-0.6.5 lib/gorgon/host_state.rb