search for: get_worker

Displaying 18 results from an estimated 18 matches for "get_worker".

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 retrieve the status of them using the job key: >> >> To create the worker, I do: >> >> @worker = MiddleMan.new_worker(:worker => :bar_worker, >> :worker_meth...
2006 Sep 08
1
Access worker outside of Rails?
Hi all, Wondering if it''s possible to access a worker from outside of Rails -- I''ve tried simply including: require RAILS_ROOT + ''/vendor/plugins/backgroundrb/backgroundrb.rb'' BackgrounDRb.MiddleMan.get_worker(key) but, I get an error that the ''get_worker'' method is undefined. Any ideas? Thanks a lot, W -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20060908/2d4dc172/attachment.html
2006 Aug 16
7
Forward of moderated message
...MiddleMan.new_worker(:class => :ping_worker, > :args => {:baz => > ''hello!'', :qux => ''another arg!''}) > end > > def task_progress > if request.xhr? > progress_percent = MiddleMan.get_worker(session > [:job_key]).progress > render :update do |page| > page.call(''progressPercent'', ''progressbar'', progress_percent) > page.redirect_to( :action => ''done'') if progress_percent >= > 100 > end...
2006 Jul 05
5
''m having trouble with BackgrounDrb
...et anything useful back out of it. I set up a simple test worker that just does class TestWorker < BackgrounDRb::Rails attr_reader :pupil def do_work(args) @progress=0 @pupil=Pupil.find(3) sleep rand*10 @progress=100 end when I try to access this via @pupil=MiddleMan.get_worker(session[:job_key]).pupil once progress hits 100% [I can access progress fine, BTW] and use this in a view, I get an error referring to @pupil as #<DRb::DRbUnknown:0xb78228a0> rather than an instance of Pupil. Am I expecting too much of Drb? I really thought that it would be able to give...
2006 Jul 07
1
uninitialized constant MiddleMan
...39; /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:131:in `const_missing'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/ active_support/dependencies.rb:133:in `const_missing'' #{RAILS_ROOT}/app/models/client_dispatch.rb:3:in `get_worker'' #{RAILS_ROOT}/app/models/event.rb:93:in `save_all_from_url!'' #{RAILS_ROOT}/app/controllers/events_controller.rb:16:in `create'' /usr/local/bin/mongrel_rails:1 This error occured while loading the following files: middle_man.rb Supposedly I dont have middle_man.rb...
2006 Jul 18
0
Two backgroundrb questions
...er now that I''ve looked at it I don''t see any sign of throttling > in backgroundrb. It looks like there is a 1:1 relationship between > workers and threads. Perhaps zed misunderstood what I was looking > for... > > Also I don''t see how: > > MiddleMan.get_worker(session[:job_key]).progress > > or > > MiddleMan.get_worker(session[:job_key]).results > > described in the documentation work. Where in the worker are you > controlling the value of progress or results? Nothing in the > definition of Backgroundrb::Rails seems to support th...
2007 Dec 21
7
Using my models
I''m working on upgrading my app to the latest version of backgroundrb. Everything went find until I tried to execute my tasks. Here is my simple worker for testing: class MscWorker < BackgrounDRb::MetaWorker set_worker_name :msc_worker def create(args = nil) # this method is called, when worker is loaded for the first time end # Send a message to everyone def
2006 Jul 19
1
A couple of problems
...sed from my controller. class MyWorker < BackgrounDRb::Rails class MyResult attr_reader :result def initialize(result) @result = result end end def do_work() end def results MyResult.new(100) end end -- my_controller.rb -- def results results = MiddleMan.get_worker(session[:job_key]).results p results.result #=> undefined method `result'' for #<DRb::DRbUnknown:0x26d15a4> end I got around this by defining the class within the results method and returning like that. Really just wondering if this is by design or a bug? 2. When trying to p...
2007 Sep 24
3
Trouble using backgroundrb
...r inventory tool" end def createReport Passwdentry.delete_all User.delete_all session[:job_key] = MiddleMan.new_worker(:class => "passwd:get_passwds_worker", :args => "") end def get_progress if request.xhr? progress_percent = MiddleMan.get_worker(session[:job_key]).progress render :update do |page| page.call(''progressPercent'', ''progressbar'', progress_percent) page.redirect_to( :action => ''done'') if progress_percent >= 100 end else redirect_to :...
2006 Apr 04
4
Threads vs. Processes and Rails
Hey all, I need to launce a rather lengthy process from a small Rails application. It''s the sort of thing (sending out an email newsletter) that would need to be launched from a browser window, but the browser doesn''t need to stick around to see it through. I played around with Thread.new, but I think, based on limited testing, that the threads need to complete before the view
2006 Oct 04
0
do_work and long running rails tasks?
...) @rows << new_rows.collect { |s| s.id } end self.kill rescue Exception => e @logger.error "Exception: #{e}" @percent = 100 self.kill end -- snip --- --- controller.rb -- def syslog_progress if request.xhr? worker = MiddleMan.get_worker(session[:host_info]) if worker progress_percent = worker.progress render :update do |page| page.call(''progressPercent'', ''progressbar'', progress_percent) @rows = Sysloglog.find( worker.rows) rescue [] page....
2006 Oct 18
0
Please help with 2 (related?) problems
...; ''parser'', :action => ''get_progress''}, :frequency => 1) %> And in the parser controller, I have (basically verbatim from the example): def get_progress if request.xhr? progress_percent = MiddleMan.get_worker(session[:job_key]).progress render :update do |page| page.call(''progressPercent'', ''progressbar'', progress_percent) page.redirect_to( :action => ''done'') if progress_percent >= 100 end else redirect_to...
2006 Jul 24
0
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
...39;edit_songs'' end In my view, within the form parameters I have: <%= periodically_call_remote(:url => {:action => ''get_progress''}, :frequency => 1) %> which calls the below method: def get_progress if request.xhr? progress_percent = MiddleMan.get_worker(session[:job_key]).progress render :update do |page| page.call(''progressPercent'', ''progressbar'', progress_percent) page.redirect_to ( :action => ''done'') if progress_percent >= 100 end else redirect_t...
2006 Nov 04
1
BackgrounDRb Call for help
...done} Now that we use the slave gem to manage external workers there is a slight interface change to the middleman. It works the same exact way to start workers with new_worker. But when you want to get a handle on your worker to call methods you need to use MiddleMan.worker (key).method . get_worker or MiddleMan[key] get you a handle on the slave process so you can call shutdown on it and get its PID and all that. But worker(key) gets you the handle on your actual worker object. So thats my notes for you for right now. Please feel free to write in with any questions. The main thing t...
2006 May 15
10
BackgrounDRb background task runner and Application Wide Context Store
...later. def background_task session[:job_key] = MiddleMan.new_worker(:class => :foo_worker, :args => {:baz => ''hello!'', :qux => ''another arg!}) end def task_progress if request.xhr? progress = MiddleMan.get_worker(session[:job_key]).progress render :update do |page| page.replace_html(''progress'', "<h3>#{progress}% done</h3>" + "<img src=''/images/progress.gif'' width=''# {prog...
2006 Oct 17
6
Session access interfers with other model access
Sorry to be such a bother but I''m not getting this. I have two models: Emrec and Session (I''m using AR for session mgmt.) In my worker I can access the Emrec model and delete a record, AS LONG AS I don''t try to access the Session model. With the Session model access commented out as below, the Emrec record gets deleted. If I uncomment those lines, the Emrec
2006 Jul 24
4
Mongrel + BackgrounDRb + File Column = Upload Progress Bar?
...39;edit_songs'' end In my view, within the form parameters I have: <%= periodically_call_remote(:url => {:action => ''get_progress''}, :frequency => 1) %> which calls the below method: def get_progress if request.xhr? progress_percent = MiddleMan.get_worker(session[:job_key]).progress render :update do |page| page.call(''progressPercent'', ''progressbar'', progress_percent) page.redirect_to( :action => ''done'') if progress_percent >= 100 end else redirect_to...
2006 Oct 12
6
BackgrounDRb newbie stuck at first base. Fresh pair of eyes needed
Can''t believe I can''t see the problem here, but after a few hours bashing my head on a brick wall, going to risk looking stupid by seeing if anyone can point out my idiocy (that''s the worst thing about coding on your own). Trying to get BackgrounDRb to take over the scraping task which is currently being done in a Rails controller. That''s not the problem at