search for: fooworker

Displaying 19 results from an estimated 19 matches for "fooworker".

Did you mean: foo_worker
2006 Aug 01
2
making backgroundrb cron
...(but i dont think since i have at least two of my projects where i would need such a facility) and if so, how could the configuration be done? best would be something that can be changed and added by runtime while being preserved over various starts and stops... or something of rails magic: class FooWorker < BackgrounDRb::Rails repeat_every 24.hours start_at tomorrow.midnight def do_work @logger.info ''i will appear on midnight every day from now!'' end end but since thats magic, i dont really know how that would work, but its more the rails way than an entry in backg...
2008 Jan 22
1
Newbie question on Scheduling
I''ve scheduled cron jobs etc before, but I''m curious as to how to layout a worker properly. Here''s a basic example of what one of my workers looks like: class FooWorker < BackgrounDRb::MetaWorker set_worker_name :foo_worker def create(args = nil) logger.info("Starting test: #{Time.now.strftime("%T")}") run_test logger.info("Finished test: #{Time.now.strftime("%T")}") exit end def run_test logger.info("aaaa") sle...
2010 Jun 02
0
Multiple threads writing to the same Starling queue doesn't work?
Hi guys, I can''t find a clear answer to this: is it possible/correct to have several threads write to the same Starling queue at the "same time"? It doesn''t seem reliable according to my tests - but maybe I am doing something wrong. If I do: def test_starling FooWorker.asynch_foo_test(:my_id => ''foo'') temp = [] for i in 1..1000 temp << Thread.new(i) {|random_value| do_stuff(random_value)} end temp.each do |t| t.join end end def do_stuff(lvalue) starling = Starling.new(''localhost:22122'') starling...
2006 Dec 13
4
Unintended thread forked in autostart
Hello all, I''ve got the problem about the following simple application using autostart and repeat_every. A thread(?) is forked for processing task at first, but at sencond time two threads seem to be forked. My simple application code is... - In worker class class FooWorker < BackgrounDRb:Rails repeat_every 2.minutes first_run Time.now def do_work puts Time.now.to_s + "Start processing....." do_some_task() puts Time.now.to_s + "Finish processing" end - In background.yml autostart: 1: class: foo_worker arg:...
2007 Nov 02
10
pre-release version of backgroundrb available now from svn
...ntly, passing of ActiveRecord objects is not supported. Although, We can do that, but in most situations, passing ''id'' of object is enough i thought. Also, you may encounter some bugs when you are passing large objects around. I will try to explain meat of a sample worker: class 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_s...
2006 May 15
10
BackgrounDRb background task runner and Application Wide Context Store
...as an application wide context as well as background process runner that is shared across all users and all backends. Let''s look at how this system works in detail. Look at INSTALL for instructions on how to get everything set up and working. Lets look at a simple worker class. class FooWorker include DRbUndumped def initialize(options={}) @progress = 0 @results = [] @options = options start_working end def start_working # Work loop goes inside a new thread so it doesn''t block # rails while it works. A neat way to do progress bars in...
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
2007 Dec 19
6
thread_pooling sleeping
...thing 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_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.fin...
2006 Dec 08
3
Thread Pool Size?
Hi All, It might be lack of sleep, but I am struggling to accurately limit our pool size. It seems like I can specify it on the server with the -s command line option and also on the client via the YAML pool_size. Is that right? Which one wins? Our problem is that we are getting about 40 threads on each backgroundrb box and it''s flooring our db and each bgrb box. We want around 8.
2006 Jun 12
0
BackgrounDRb New Release
...ethod. This method will automatically get called in its own thread when you create a new worker from rails. So when you say: MiddleMan.new_worker :class => :foo_worker, :args => "Hello!" The "Hello" argument gets sent to your do_work method. class FooWorker < BackgrounDRb::Rails def do_work(args) # This method is called in it''s own new thread when you # call new worker. args is set to :args. @logger.debug Post.find(:all).to_yaml end end So you no longer have to deal with Threads yourself. And you get '...
2007 Dec 12
1
worker cleanup
I was using an older version of backgroundrb and today I started to play with the most recent release. First up, I''d like to say, thanks so much for this library and thanks for making it more stable. From the looks of things, I think it''s going to be easier to use now than it was several months ago when I first started using it. I''d like to make sure I''m using
2008 Jan 29
5
Authoritative Documentation
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
2006 Jul 04
8
writing to many_to_many table
I have three tables. users, posts, users_posts. This last one is to mark a post as read. How do I write to the users_post table? Here''s what I have: In model ''User_Post'' belongs_to :post belongs_to :user In post/view/show: <%= link_to "Mark As Read", :controller => ''post'', :action => ''post_read'', :user =>
2006 Oct 16
6
accessing session data in worker
Is there something special I need to do to access session data in a worker? I''m using an AR session store. I''ve been working with Ezra''s tutorial, modifying it a little here and there to figure it out. So I changed the progress bar to a simple count-down in the worker which sends back the count to display in the view. No big deal. But if I try to access session
2006 Jun 15
12
Multithreading and DB access in Rails
I just tried writing some controllers, etc. that would allow me to start and monitor background tasks running in new (Ruby) threads, with the idea that I''d eventually manage long-running indexing processes that way. I can kick off such threads OK (by using Thread.new in a routine called by a controller), but it seems like Rails gets huffy if those background tasks and the ordinary
2006 Jun 12
5
New release!
...sent to your do_work method. # Put your code that runs your task inside the do_work method # it will be run automatically in a thread. You have access to # all of your rails models if you set load_rails to true in the # config file. You also get @logger inside of this class by default. class FooWorker < BackgrounDRb::Rails def do_work(args) # This method is called in it''s own new thread when you # call new worker. args is set to :args. @logger.debug Post.find(:all).to_yaml end end So you no longer have to deal with THreads yourself. Just inherit fr...
2006 Nov 05
5
backgroundrb preview
Hi Ezra/skaar, Wow man, the exercise was worth it. The connection closed problem with socket as i mentioned in my earlier mails...completely disappeared, and now i can connect only once to the socket and keep reading..till end of its days. Literally impossible with older release of backgroundrb. This could also potentially solve the issues people were having with ActiveRecord. As i said
2006 Oct 23
8
can a worker commit suicide?
Can a worker kill themselves when they''re ''done''? Or do I have to do that either from the controller or the worker manager? Thanks, Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061023/11dd429c/attachment.html
2006 Jun 28
2
models @ data extraction
I''m building my first webapp... I have db tables "users" and "posts". Model for user is "has_many :posts". Model for post is "belongs_to :user" In a slightly modified scaffold I can list all the posts and which user wrote them (/post/list), but want to link the username to a list of posts by that user. How do I accomplish that? Sorry for the