class JobDispatch::Status

Attributes

socket[R]

Public Class Methods

new(connect_address) click to toggle source
# File lib/job_dispatch/status.rb, line 9
def initialize(connect_address)
  @connect_address = connect_address
end

Public Instance Methods

connect() click to toggle source
# File lib/job_dispatch/status.rb, line 13
def connect
  if @socket.nil?
    @socket = JobDispatch.context.socket(ZMQ::REQ)
    @socket.connect(@connect_address)
  end
end
disconnect() click to toggle source
# File lib/job_dispatch/status.rb, line 20
def disconnect
  @socket.close
  @socket = nil
end
fetch() click to toggle source
# File lib/job_dispatch/status.rb, line 25
def fetch
  @socket.send(JSON.dump({command:'status'}))
  json = @socket.recv
  @status = JSON.parse(json).with_indifferent_access
  @time = Time.now
end
print() click to toggle source