search for: railsbase

Displaying 20 results from an estimated 39 matches for "railsbase".

2007 Apr 27
0
Backgroundrb running under cygwin - having issue with Railsbase workers
...cess environment. We deploy to a linux environment but develop locally in Windows. I''m aware that a number of people have reported the ability to run .2.x of backgroundrb inside cygwin, and for the most part, I''ve been able to do the same. My initial test worker runs fine as a non-RailsBase worker. Once I switch it to load rails as part of the worker, I run into a problem with fork, namely: Resource temporarily unavailable - fork(2) - (Errno::EAGAIN). My debug log statements within Middleman show that backgroundrb_results and backgroundrb_logger get loaded fine, but any rails worker d...
2007 Jan 11
4
Load balancing
Hi, Can somebody point me in the right direction about what approach would be best to load-balance between two or more physical servers running backgroundrb while using BackgrounDRb::Worker::RailsBase with mongrel? Thanks, Robert Bjarnason
2006 Nov 20
4
Production RAILS_ENV / DB Selection
Hey all, I''m having some issues moving a project that incorporates Backgroundrb onto a staging server... For some reason (surely of my own doing), my RailsBase workers are insisting on using trying to access my development DB instead of my "production" DB. When I try to load a model object from within a worker, I get the following: 20061120-21:54:28 (26296) #<DRb::DRbUnknown:0x40691130> 20061120-21:54:28 (26296) /var/www/gorchie/release...
2007 Feb 07
2
ncluding backgroundrb issue
..."fileB"... - /lib/fileB.rb with main header: load ''backgroundrb/worker.rb'' load ''backgroundrb/ worker_rails.rb'' class FileB < BackgrounDRb::Worker::RailsBase ........................................................................ and on line #72: FileB .register when I restart my lighttpd web server , at the first loading of the controller it rise the next error: You have a nil object when you didn''t expect it!...
2007 Apr 06
2
Best way to start a worker
...nds 10, sleeps for a minute, sends 10 until done - very straightforward. My question is, what would be the best way to run this? I have assumed a cron like scheduled worker with a named key, but I don?t know. My worker looks like this: class EmailProcessorWorker < BackgrounDRb::Worker::RailsBase def do_work(args) queue = EmailQueue.new queue.process_queue end end EmailProcessorWorker.register I do all the work in a Rails Model, since I can unit test it outside of backgroundrb. Does anyone have a backgroundrb_schedules.yml file I could use as an example, and should...
2007 Feb 22
1
failed to find slave socket - (RuntimeError)
...oducts_worker,:job_key => :products) sleep(5) end I''m using ":job_key", so if a worker hasn''t already ended its work after five seconds, it''s not duplicated. The code inside the worker is something like: class ResearchesWorker < BackgrounDRb::Worker::RailsBase def do_work(args) completed = RunningResearch.find(:all,:conditions => ["endtime < ?",Time.now]) for complete in completed complete.complete end self.delete end end ResearchesWorker.register After 4 or 5 minutes of working, the worker stops to respond and i''...
2007 Jun 25
3
one more "uninitialized constant" problem
Hi everyone, I''m new to backgroundrb, and I''m trying to get started with a simple example, yet with no success. This is the code that I have in RAILS_ROOT/lib/workers/testing_worker.rb class TestingWorker < BackgrounDRb::Worker::RailsBase 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.info(''TestingWorker do work'') results[:do_work_time] = Time.now_to_s results[:done_with_do_work] || = true end end...
2007 Nov 14
1
couple of questions
I''m using the latest backgroundrb. Do I need to setup a worker in order to use it with Rails? I remember using "Worker::RailsBase" before. Also, how do I access the logger from within the worker? Thanks a lot! -- Lalo
2007 Apr 23
0
Using mapped database connections
...20070423-10:30:00 (29673) development database is not configured - (ActiveRecord::AdapterNotSpecified) In my database.yml file I have the production database setup as production: development to map the production database back to the development one. Unfortunately BackgrounDRb::Worker::RailsBase doesn''t know how to handle these types of database references. I also had a quick play with loading up irb and then requiring the config/boot.rb and config/ environment.rb files. Once I had done this I could access all my Rails models as I would expect. So I was wondering why the R...
2007 Jan 23
1
Getting results from a dead worker. example?
...to retrieve results from deceased workers (from the documentation it seems that it is possible to do this). I pasted my simple test below. If anyone could point out what i should be doing differently i''d be very grateful. My test worker: class TestWorker < BackgrounDRb::Worker::RailsBase def do_work(args) results[:done_with_do_work] = true self.delete end end TestWorker.register My rake task: task :tester => :environment do k=MiddleMan.new_worker( :class => :test_worker ) sleep 1 # the worker will die during this pause # next line gives a nil obj...
2007 Jan 27
1
Memory leaks in backgroundrb
...75 Gem::Version 73 XSD::QName It''s easy to see that loads of threads and slaves are present in the process. It also has references to 691 workers! In case there might be some problems with my worker here''s its full code: class DrillReminderWorker < BackgrounDRb::Worker::RailsBase def do_work(args) logger.info "DrillReminderSender started" t = Time.now.gmtime tsec = t.sec + t.min*60 + t.hour*60*60 logger.info "utc seconds: #{tsec}" User.find_all_to_send_drill_reminder(tsec).each do |u| Notification.deliver_drill_reminder(u)...
2007 Apr 04
2
unit tests?
Ezra et al: I have this problem: http://rubyforge.org/pipermail/backgroundrb-devel/2006-December/000578.html Any progress on it? Or are unit tests simply impossible for now? -- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!
2007 Jan 22
1
Strange behavior
Ok two things that bug me 1) http://backgroundrb.devjavu.com/projects/backgroundrb/ticket/48 i thought i''ll just post ticket link - but well - it''s strange 2) when i switch base class from RailsBase to Base i can''t access MiddleMan - i get error NameError: uninitialized constant MiddleMan from (drbunix:///tmp/backgroundrbunix_localhost_2999) (drbunix:///tmp/backgroundrb.8388/first_worker_30fe4904c2222fa80e54b58d587d7 bb0_0_0.446368947706132) /home/swistak/rails+backgrou...
2006 Dec 08
2
trouble using ActiveRecord classes
...dies. My worker class is below, I''ve interspersed log messages throughout to try to determine where it is dying. ===== publish_worker.rb ======== require ''publication'' # loads my Publication < ActiveRecord::Base model class PublishWorker < BackgrounDRb::Worker::RailsBase attr_accessor :publication_id def do_work(args) logger.debug("PublishWorker args: #{args.inspect}") @publication_id = args[:publication_id] logger.debug("Publication id: #{@publication_id}") end_date = args[:end_date] || Time.now.utc logger.debug(&quot...
2007 Jan 15
2
Backgroundrb keeps spawning processes
Hi! I''ve just a created a really simple rails scheduled worker for backgroundrb to start playing with : class SessionCleanerWorker < BackgrounDRb::Worker::RailsBase def do_work(args) logger.info "SessionCleaner> started" CGI::Session::ActiveRecordStore::Session.destroy_all( [''updated_at <?'', 120.minutes.ago] ) LoginToken.destroy_expired logger.info "SessionCleaner> done" end end SessionClea...
2007 Oct 29
1
BackgrounDRb, Schedule and Clean Up
...y process. I have noticed however that the sockets in /tmp/backgroundrb.#{pid} seem to exist until the entire backgroundrb server is stoped. Should these clear up on their own without a stop or am I doing something wrong? At current for testing I have... class NACWorker < BackgrounDRb::Worker::RailsBase def do_work(args) logger.info("Work Started") sleep 0.5 logger.info("Work Done") delete end end NACWorker.register Is delete the corrrect way to end the worker, I''ve had a look through RubyDoc and can''t find anything more suitable? Of cours...
2007 Sep 24
3
Trouble using backgroundrb
...------------- # 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. You also get logger and results method inside of this class # by default. class Passwd::GetPasswdsWorker < BackgrounDRb::Worker::RailsBase attr_reader :progress def do_work(args) @progress = 0 @progressinterval = 100/System.count System.find_all.each do |sys| getAndParsePasswdFile(sys.name) @progress += @progressinterval end end def getAndParsePasswdFile(sys) output = %x[some command-line-magic...
2006 Feb 07
14
Production Server That Just Works?
...e never hit upon the right combination. (I take full responsiblity, it''s not their fault) I''ve set up several Linux servers and Windows Servers, so I''m not a neophyte. But I need a solution that doesn''t require me being a Savant either. I''m waiting for Railsbase aka railsapphosting.com, but that doesn''t seem to be happening. I use Locomotive on the Mac and it''s incredible!!! but I''m afraid this isn''t a production enviroment. The production Server doesn''t need to support clustering or fail-over, just an easy t...
2007 Feb 14
1
Scheduling in backgroundrb not working
...: 2000 :rails_env: development my_scheduler: :class: :mailman_worker :job_key: :foo_name :worker_method: :send_emails_to_people :trigger_args: 0 */1 * * * * * ------------------------------------------my mailman_worker.rb -------- class MailmanWorker < BackgrounDRb::Worker::RailsBase def do_work(args) # This method is called in it''s own new thread when you # call new worker. args is set to :args # Replace this with your code # logger.info(''I am in do work'') end def send_emails_to_people @d_evals = User.find(:all,:condi...
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.