Hi John,
On Jan 11, 2008 4:52 AM, John O'Shea <joshea at nooked.com> wrote:
> hemant,
> Thanks for the pointer, works well on HEAD. For the benefit of
> others, the all_worker_info method returns an array of hashes (one for
> each worker) containing the following keys
> :worker (value is name)
> :job_key (value is an empty string if no job key assigned)
> :status (value seems to be hardcoded to 'running')
Hmm, the API has become a bit confusing. But I will try to clear it up
and I will be putting this up in READE too.
As you probably know, BackgrounDRb offers ability to store result
hashes from workers, so as even when a worker is died and no longer
running, you can query the results computed by it. This is immensely
useful.
MiddleMan.ask_status() method returns the result set for this
particular worker. Result set will be available even after a worker is
no longer running. Similarly, MiddleMan.query_all_workers is for
getting all available result sets in one go.
BackgrounDRb 1.0.1 offers ability to detect running workers and stuff
and worker_info methods are solely for that purpose.
For example:
MiddleMan.worker_info(:worker => :foo_worker)
Will return :status = :running if 'foo_worker' is running and will
return :status = :stopped if not running. I do not think apart from
these two values any other state can be possible for a worker and
hence its hardcoded.
Similarly MiddleMan.all_worker_info returns information about all
currently running workers.
--
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.
http://gnufied.org