search for: ask_work

Displaying 20 results from an estimated 30 matches for "ask_work".

2008 Mar 19
2
nil-error
Hi all, I''ve got the error below in my backgroundrb_debug.log. I''ve tried to reproduce the error in the development environment, but the only way I can get the same thing is by calling ask_work with a bogus worker name. Calling it with the production code causes no error. Here''s an example of what the code calls: MiddleMan.ask_work(:worker => :agronomy_worker, :worker_method => :transmit, :data => 414) I also tried playing with adding a job_key, but that didn''...
2008 Jan 03
1
Thread_pool bug?
...{err.class}: #{err}" end end end end I started one long import job no problem. Then, I started another one, and I expected that the thread_pool would queue it up and execute it when the thread became available. At least, that''s what this archive says. However, my call to ask_work blocked until the first call completed. My ask_work call: MiddleMan.ask_work(:worker => :import_contacts_worker, :worker_method => :import_contacts, :data => job_id) Shouldn''t the thread_pool have queued to request and import_contacts returned immediately? These import jobs ca...
2008 Jan 17
3
periodic scheduling
...scheduling option to use. I don''t want to schedule it to run every 10 seconds, since each call to main_work could take anything up to several minutes, and I don''t want the invocations piling up. The docs also seem to suggest that I could do things my old way by calling MiddleMan.ask_work() and letting it run forever, but it''s not clear whether I can pass in a job_key there. I''d love any suggestions here... Next, is there any way from inside a worker to see what its job_key is? With the old version I''ve been using the jobkey as a way to split up some of...
2008 Jan 03
7
Delete a busy worker
I thought I could delete a busy worker by calling MiddleMan.delete_worker, but doesn''t seem to end. I believe this was possible in 0.2, is it not in 1.0? thanks, Zach -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080103/0c701f29/attachment.html
2008 Jan 13
3
right usage of bdrb
...; BackgrounDRb::MetaWorker set_worker_name :syndication_worker def create(args = nil) # this method is called, when worker is loaded for the first time end def checksyndicate syndications = # all Syndication in this hour syndications.each do |syndication| MiddleMan.ask_work(:worker => import_worker, :worker_method => import, :data => syndication.id) end end - - - - - - - import_worker.rb - - - - - - - class ImportWorker < BackgrounDRb::MetaWorker set_worker_name :import_worker def create(args = nil) # this method is called, when worker...
2007 Dec 15
10
1) Error 2) sending request to a specific worker
Hello ! 1) I have this error logged by bdrb: undefined method `send_request'' for nil:NilClass framework/packet_master.rb:58:in `ask_worker'' backgroundrb/server/master_worker.rb:59:in `process_work'' backgroundrb/server/master_worker.rb:16:in `receive_data'' backgroundrb/framework/bin_parser.rb:29:in `call'' backgroundrb/framework/bin_parser.rb:29:in `extract'' backgroundrb/server/master_worke...
2008 Jan 03
1
Memory leak and long process problem
...e_from_vendor!(Company.find_firm_info_details_from_vendor(info[0])) # webservice call to vendor end rescue => err logger.error "MscWorker#update_company_from_vendor failed! #{ err.class}: #{err}" end end end Part of import_contacts will result in many ask_work calls to update_company_from_vendor while it is processing. Importing contacts is heavily db dependent, but not very code intensive. If I upload two files with > 1000 contacts each (two ask_work calls to import_contacts), things will progress along and then pause for 20-40 seconds. There is n...
2008 Mar 18
1
Polling is REALLY slow
I''m having some trouble with using brb for polling for work. Basically, what I want to do is update the state of a record and have brb notice and start a process. I do not want to call ask_work for each process because there may be several places where the object''s state is changed, and I only want to process once. Plus, I can schedule things better this way. My first thought was to create a worker that polled for records with the correct state, but it doesn''t work as...
2008 Feb 02
6
Suspended start of task not suspended
Hi I thought this should suspend the task by 1 minute, but it starts immediately: MiddleMan.ask_work( :worker => :bar_worker, :worker_method => :test_method, :trigger_args => { :start => (Time.now + 1.minute)}) Is the start argument not allowed in the new backgroundrb (mine is at rev HEAD (=314))? What can I do about this? I really need to suspend starting the task as I want the...
2007 Dec 21
7
Using my models
...worker is loaded for the first time end # Send a message to everyone def send_message_to_all(args = nil) Message.send_to_everyone(args[:sender], args[:subject], args[:body], false) rescue logger.error "MscWorker - #{err.class}: #{err}" end end Called like so: MiddleMan.ask_work(:worker => :msc_worker, :worker_method => :send_message_to_all, :data => { :sender => sender, :subject => subject, :body => body }) I get lots of errors starting with this: /Users/dave/projects/backgroundrb1.0_msc/vendor/plugins/backgroundrb/server/master_worker.rb:31:in `load...
2007 Dec 19
6
thread_pooling sleeping
I''m trying to run a single worker that could perform a periodic task for a given user. >From a controller, I imagine something like: def start_job MiddleMan.ask_work(:worker => :foo_worker, :worker_method => :perform_task, :data => { :user_id = current_user.id }) end def check_job @status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id] end My worker is something like: class FooWorker < BackgrounDRb::MetaWorker set_wo...
2008 May 28
1
nil.send_request = Incorrect worker name?
Hi, Would greatly appreciate some help with this. Is the following error caused by an incorrect worker name? You have a nil object when you didn''t expect it! The error occurred while evaluating nil.send_request /usr/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/packet_master.rb:44:in `ask_worker'' Here''s what I''m doing in my rails console. MiddleMan.new_worker(:worker => :foo_worker, :job_key => ''1'') worker = MiddleMan.worker(:worker => :foo_worker, :job_key => ''1'') worker.bar() Querying all workers shows t...
2008 Jan 03
0
Strange problem
...from_vendor!( Company.find_firm_info_details_from_vendor(info[0])) # webservice call to vendor end rescue => err logger.error "MscWorker#update_company_from_vendor failed! #{ err.class}: #{err}" end end end Part of import_contacts will result in many ask_work calls to update_company_from_vendor while it is processing. Importing contacts is heavily db dependent, but not very code intensive. If I upload two files with > 1000 contacts each (two ask_work calls to import_contacts), things will progress along and then pause for 20-40 seconds. There is n...
2007 Dec 28
2
Arity?
...rk => false, :records_processed => 0 } register_status(@results) end def do_work(args = nil) begin logger.debug("in worker") ... I get to the create method''s logger message, but not the first do_work logger call. Here''s the "ask_work" call: MiddleMan.new_worker(:worker => @worker_type, :job_key => :importer) MiddleMan.ask_work(:worker => @worker_type, :job_key => :importer, :worker_method => :do_work, :data => {...
2007 Dec 18
5
querying status of worker with job_key
Hi, Is it possible to start a worker with job_key and then ask_status of that specific worker with the job_key? MiddleMan.ask_work(:worker => :auth_worker, :job_key=>''1'', :worker_method => :auth) and then MiddleMan.ask_status(:worker => :auth_worker, :job_key=>''1'') >From my testing of the new backgroundrb, asking status using job key always return blank. Is it possible t...
2008 Jan 17
2
Inconsistent Model creation behavior
Hi, I have a relatively simple Worker: (I added the line numbers to the email, they are not in the worker) ##################################################################################### class ImagetestWorker < BackgrounDRb::MetaWorker set_worker_name :imagetest_worker def create(args = nil) end def save_image(args) @newbook = Book.new @newbook.comment =
2008 Jan 11
18
getting started
...on concern). most importantly, they need to know when it''s been completed. Here are my questions - since this only needs to take place every month or so, I don''t really feel like I need a long-running worker necessarily. From the docs, it seemed like I could call: MiddleMan.ask_work(:worker => :sales_processor, :worker_method => :do_work, :data => @upload.id) In the :do_work method, I''m calling register_status but am receiving nil when I call ask_status I guess I just feel like I''m shooting in the dark here - not sure if i''m going in...
2008 Feb 01
3
Job Queue
After some initial stumblings, I think I''ve got the hang of backgroundrb. It''s great! I''d been thinking for many many months how cool something like this would be! I''m trying to make a "job queue". That is, a pool of worker threads monitor a queue. When a job appears, one of the workers grabs it and executes the task. When complete, the worker
2007 Dec 06
10
Feedback on RC2
...ails models. The workers basically just call class methods in the models. (Truly using this as a scheduler.) Perhaps this has something to do with it? - Documentation and resources for the new version are sparse (obviously) and seem a little inaccurate. For example, I learned that the MiddleMan.ask_worker() method detailed in the docs is actually called as MiddleMan.ask_work (). If anyone has any thoughts on what might be going wrong with my scheduled tasks, that''d be great. Thanks! Andy -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.or...
2007 Dec 25
6
error: no marshal_dump is defined for class Thread
I get this error periodically in backgroundrb.log, but only on my production box (the one running ruby 1.8.5) - my dev box doesn''t get this error. As far as I can tell, everything is working ok, despite the error (I don''t really know how to determine if the jobs are getting threaded successfully, but they are running, that I am sure of). Here''s the dump: no