search for: register_status

Displaying 20 results from an estimated 28 matches for "register_status".

2009 Jan 06
1
ask_status/register_status deprecated???
Hi, I''ve been using bdrb for a while and just recently found the need to use the ask_status/register_status functionality of my worker. This is the error I get whenever the register_status method is encountered: ...lib/workers/session_worker.rb:10:in `create'': undefined method `register_status'' for #<SessionWorker:0xb6e7d52c> (NoMethodError) from /home/rut216/dev/illinic...
2008 May 09
1
register_status for excess thread_pool?
...; to allow processing multiple reports simultaneously and queue up any requests that exceed the thread pool (pool_size = 10 currently). def process_pdf(user) thread_pool.defer(user) do |user| makepdf(user) end end My question is: I use a mutex to handle synchronizing the register_status. This works fine: def makepdf(user) txt = user.to_s + " started" save_status(user, :progress, txt) do_report(user) txt = user.to_s + " ended" save_status(user, :progress, txt) end def save_status(user_id,key,data) @status_mutex.syn...
2007 Dec 19
6
thread_pooling sleeping
...f check_job @status = MiddleMan.ask_status(:worker => :foo_worker)[current_user.id] end My worker is something like: class FooWorker < BackgrounDRb::MetaWorker set_worker_name :foo_worker def create(args=nil) @mutex = Mutex.new @mutex.synchronize do @statuses = {} register_status(@statuses) end end def do_task(some_user_id) thread_pool.defer(some_user_id) do |user_id| user = User.find user_id save_status user_id, :progress, "Starting Task" user.do_some_database_stuff save_status user_id, :progress, "Task Stage 2"...
2008 Jan 18
8
Query All Worker
What does the method query_all_workers() do? There is no documentation on what this method returns (1.0.1 version). Orion -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20080118/9f9b8112/attachment.html
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
2008 Jun 10
4
adding results from threads to a collection and returning it
Forgive me if this has been addressed somewhere, but I have searched and can''t come up with anything. I am basically trying to distribute several web page scraping tasks among different threads, and have the results from each added to an Array which is ultimately returned by the backgroundrb worker. Here is an example of what I''m trying to do in a worker method: pages =
2007 Dec 13
1
Possible Bug & Question
...one worker and report individual correlations through a results hash, like so: def CorrelatorWorker < BackgrounDRb::MetaWorker set_worker_name :correlator_worker def create(arg) @results = Hash.new end def correlate(user_id) # This stuff takes awhile... @results[user_id] = progress register_status(@results) end end So in my code I can say MiddleMan.ask_status(:worker=>:correlator_worker)[user_id] to find the progress of correlations for a single user. But the previous version of BackgrounDRb did have one big advantage in that each worker was a separate thread. In this version, when I st...
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...FooWorker < MetaWorker set_worker_name :foo_worker attr_accessor :count def worker_init puts "Starting Foo Worker" add_periodic_timer(4) { increment_status} end def process_request p_data p p_data end def increment_status @count ||= 0 @count += 1 register_status(@count) end end First, I intend to wrap MetaWorker within a namespace(read module), so pardon me there. So, when backgroundrb starts it reads all the workers in WORKER_ROOT(which should be RAILS_ROOT/lib/workers) directory and worker_init is called in child process of each worker. You can use w...
2007 Nov 14
7
BackgrounDRb version 1.0RC1 available now
...would ask bdrb to execute method ''add_values'' in ''foo_worker'' with arguments ''10+10'' and return the result. MiddleMan.send_request(:worker => :foo_worker, :method => :add_values,:data => "10+10") You can also use register_status as described in following snippet to register status of your worker with master, which can be directly queried from rails. register_status(some_status_data) From rails, you can query status object using following code: MiddleMan.ask_status(:worker => :foo_worker) Above co...
2008 Mar 19
2
problem with worker status
...rounDRb::MetaWorker set_worker_name :upload_worker set_no_auto_load(true) def create(args = nil ) file = args[:file] sample_id = args[:sample_id] @user_id = args[:user_id] @submission_time = Time.now percent_complete = 0 total_count = get_total_count(file) register_status(:percent_complete => percent_complete, :total => total_count) <<< some long running task >>> exit end end Now when I fire up the backroundrb server and a rails console and ask for a new worker like this: >> jk = MiddleMan.new_worker(:worker => :upload_worke...
2008 Jan 22
9
Cannot connect when spawning new workers on demand
Hi! I''m using the latest&greatest backgroundrb with rails 2.0.2 on ubuntu dapper. I''ve made an app that lets you run a query on several servers at once, which are selected at runtime. Therefore, for each server that is selected, I spawn a new worker and assign its work. After everything is completed, the workers are deleted. I often get this error:
2007 Dec 20
1
mocking a few things in the test helper
When using the provided bdrb_test_helper, I was getting some undefined methods (register_status, thread_pool, etc) in unit tests. The README says to go ahead and stub out methods that need it, and send the patch to the list, so here it is (attached). Also, the MetaWorker initialize method was written as "initializes", causing the @logger never to be set, causing undefined method err...
2007 Dec 22
0
[Fwd: Re: what happened to get_worker?]
Thank you. I got it working using the register_status . hemant kumar wrote: > On Fri, 2007-12-21 at 09:51 -1000, Kevin W. English wrote: > >> Hello, I recently upgraded to the new backgroundrb. I noticed that the >> "get_worker" method is gone. I am trying to create multiple instances of >> the same worker and r...
2007 Dec 17
11
BackgrounDRb release 1.0 available now
...cessing a thread (so as your worker can receive further request from rails ) and have a instance variable ( protected by mutex ) which is updated on progress and can be send to rails. - With new backgroundrb, progress bar would be: process your damn request and just use register_status() to register status of your worker. Just because you are doing some processing won''t mean that your worker will block. It can still receive requests from rails. - Now, you can schedule multiple methods with their own triggers. | :schedules: | :foo_worker: |...
2007 Dec 18
1
where does process status get stored?
I''m just curious where does the process status get stored? Is it in the backgroundrb process, or some external storage? The reason I''m asking is because I have been doing stress testing by creating thousands of workers (with uniq job_key), each does register_status and exit after it''s done. I have been monitoring the memory usage of the backgroundrb server. At first the memory usage increases to a certain extent and then seems to stop increasing, although it seems that I still can access the status of all workers. Which makes me wonder if there is s...
2007 Dec 28
9
lost connection 2.0
I lost my "connection lost" error.. but now I''ve got a "Mysql::Error: MySQL server has gone away" error.. It comes from: /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/connection_adapters/abstract_adapter.rb:128:in ''log''. I''m not sure if Rails / BackgroundRb uses it .. but i''ve got the mysql (2.7) gem
2008 Jan 11
18
getting started
...ace 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 the right direction at all. Should I be using ask_work with register_status? Perhaps send_request (though I don''t want the http request t...
2008 May 05
2
Deploying to a staging server using Capistrano: how to start up BackgrounDRb?
...33333 :lazy_load: true # do not load models eagerly :debug_log: false # disable log workers and other logging My worker: class ThumbnailGeneratorWorker < BackgrounDRb::MetaWorker set_worker_name :thumbnail_generator_worker set_no_auto_load(true) def create(args = nil) register_status(:percent_complete => 0) args.each_with_index do |uploader_id, index| @uploader = Uploader.find(uploader_id) @uploader.generate_thumbnails percent_complete = ((index + 1) * 100) / args.length logger.info "Thumbnail generation is #{percent_complete}% complet...
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
2008 Apr 14
6
Good news: BackgrounDRb now works on Windows
...ed hard to not but you can''t be sure without testing. Since I haven''t figured out how to run automated tests I have created some ad hoc tests of my own. These cases work: - ad hoc scheduling by calling a method on the worker - passing parameters to the worker - cron scheduling - register_status and ask_status - making a synchronous call and getting a result back kind of works, except I get the whole hash back with the result in the :data key instead of just getting the result alone. In other words I get a hash like this: {:type=>:response, :client_signature=>25, :result=>true,...