[Backgroundrb-devel] Query All Worker

Orion Delwaterman orion at mh2o.com
Mon Jan 21 11:03:20 EST 2008


Whoops mixup in my code here, I fixed it but I am still getting the same
issue where either register_result does not properly log the result or
query_all_workers() is not returning the result:

CODE:

class OriontestWorker < BackgrounDRb::MetaWorker
  set_worker_name :oriontest_worker
#  set_no_auto_load true
  
  def create(args = nil)
    # this method is called, when worker is loaded for the first time
    register_status(rand(200))
    res = RAILS_ENV
    log res
    register_result(res)
  end
  
  def get_methods
    self.methods.sort
  end
  
  def test_results
    res = rand(200)
    log res
    register_result(res)
    res
  end
  
  def get_msg_writer
    self.msg_writer.inspect
  end
  
end

IRB:

[orion at OrionFoot hydra]$ ruby script/console
Loading development environment.
>> MiddleMan.query_all_workers
=> {:log_worker=>nil, :oriontest_worker=>nil}
>> MiddleMan.send_request :worker => :oriontest_worker, :worker_method
=> :test_results
=> {:data=>73, :client_signature=>12, :type=>:response}
>> MiddleMan.query_all_workers
=> {:log_worker=>nil, :oriontest_worker=>nil}
>>

-----Original Message-----
From: Orion Delwaterman 
Sent: Monday, January 21, 2008 10:12 AM
To: 'hemant'
Cc: backgroundrb-devel at rubyforge.org
Subject: RE: [Backgroundrb-devel] Query All Worker

Maybe I am doing something wrong but query_all_workers() does not appear
to return any results from my workers.  Does the results object have to
be some kind of hash or is this just some weird bug?

Worker:

class OriontestWorker < BackgrounDRb::MetaWorker
  set_worker_name :oriontest_worker
#  set_no_auto_load true
  
  def create(args = nil)
    # this method is called, when worker is loaded for the first time
  end
  
  def get_random
    register_status(rand(200))
    register_result(RAILS_ENV)
    true
  end
  
end

IRB testing:
Loading development environment.
>> MiddleMan.query_all_workers
=> {:log_worker=>nil, :oriontest_worker=>nil}

-----Original Message-----
From: hemant [mailto:gethemant at gmail.com] 
Sent: Saturday, January 19, 2008 6:58 AM
To: Orion Delwaterman
Cc: backgroundrb-devel at rubyforge.org
Subject: Re: [Backgroundrb-devel] Query All Worker

On Jan 19, 2008 4:42 AM, Orion Delwaterman <orion at mh2o.com> wrote:
>
>
>
>
> What does the method query_all_workers() do?  There is no
documentation on
> what this method returns (1.0.1 version).

It returns status/result objects for all the available workers.


More information about the Backgroundrb-devel mailing list