I''ve been using backgroundrb for... about an hour now. I must say, I''m impressed. But I''m a bit stumped on where to find the "official" documentation. There''s an API online at backgroundrb.rubyforge.org, but I don''t see the methods available for MiddleMan, etc. Right now, I''m trying to figure out how to get a list of all running workers. Poking through the source code, I see a function entitled "get_worker_by_class", but there is little to no documentation available. The documentation does refer to query_all_workers, but I can''t find it anywhere in the source code. I understand that cool technologies often race ahead of the documentation writers. But am I misunderstanding something? Perhaps I''m looking in the wrong place? Thanks, Norman Elton
On Tue, Jan 29, 2008 at 7:29 AM, Norman Elton <normelton at gmail.com> wrote:> I''ve been using backgroundrb for... about an hour now. I must say, I''m > impressed. > > But I''m a bit stumped on where to find the "official" documentation. > There''s an API online at backgroundrb.rubyforge.org, but I don''t see > the methods available for MiddleMan, etc. > > Right now, I''m trying to figure out how to get a list of all running > workers. Poking through the source code, I see a function entitled > "get_worker_by_class", but there is little to no documentation > available. The documentation does refer to query_all_workers, but I > can''t find it anywhere in the source code. > > I understand that cool technologies often race ahead of the > documentation writers. But am I misunderstanding something? Perhaps > I''m looking in the wrong place?I am quite aware of Documentation problem and I intend to fix it soon ( any help is more than welcome! ) What you are looking for is: MiddleMan.all_worker_info() -- 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
> > I am quite aware of Documentation problem and I intend to fix it soon > ( any help is more than welcome! ) > > What you are looking for is: MiddleMan.all_worker_info() >Thanks for pointing me there. I also realized that part of my problem was that I was not running the latest 1.0.1 code. Now that things appear to be upgraded, I''m moving along. It''s great to have an active mailing list to consult when I hit a roadblock. I''ve created a very simple worker, much like the FooWorker outlined in the documentation. The create() method registers a status, and I''m trying to use send_request() to run another method on the worker. When I try to do this via ./script/console, I''m getting the following error: # Logfile created on Tue Jan 29 05:10:16 -0500 2008 by / 00000008{ : run_dump: type:get_resulter_worker: data" 1234:worker_method: {:worker = > :nf_server_worker , :data=>"1234", :type=>:get_result, :worker_method=>:run_dump} You have a nil object when you didn''t expect it! The error occurred while evaluating nil.send_request /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ packet_master.rb:43:in `ask_worker'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/server/ master_worker.rb:130:in `process_request'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/server/ master_worker.rb:39:in `receive_data'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/lib/../framework/ packet/bin_parser.rb:29:in `call'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/lib/../framework/ packet/bin_parser.rb:29:in `extract'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/server/ master_worker.rb:33:in `receive_data'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:199:in `read_external_socket'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:191:in `handle_external_messages'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:160:in `start_reactor'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:156:in `each'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:156:in `start_reactor'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:147:in `loop'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ core.rb:147:in `start_reactor'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/framework/packet/ packet_master.rb:20:in `run'' /home/normelton/nfsensei/vendor/plugins/backgroundrb/server/ master_worker.rb:163:in `initialize'' ./script/backgroundrb:41:in `new'' ./script/backgroundrb:41 I''ve pasted my worker online: http://pastie.caboo.se/144892 Any thoughts? Thanks again for your help, Norman Elton
>> > > I am quite aware of Documentation problem and I intend to fix it soon > ( any help is more than welcome! ) > > What you are looking for is: MiddleMan.all_worker_info() >It appears that my problem came from configuring the worker not to start automatically. Removing that line causes everything to work fine. Sorry! Norman Elton
On Jan 29, 2008 11:34 AM, Norman Elton <normelton at gmail.com> wrote:> > I''ve pasted my worker online: > > http://pastie.caboo.se/144892 > > Any thoughts?The problem is you set the worker to auto_load but don''t start it in the console before trying to send a request. You either need to remove the "set_no_auto_load true" from the worker, or make the following call in the console before sending the request: MiddleMan.new_worker(:worker => :nf_server_worker) Regards, Ryan
On Jan 31, 2008 9:34 AM, Ryan Leavengood <leavengood at gmail.com> wrote:> > The problem is you set the worker to auto_load but don''t start it inRather you set it to NOT auto_load...the rest of my message is accurate :) Ryan