[Backgroundrb-devel] scheduling worker methods in rails

hemant kumar gethemant at gmail.com
Thu Apr 3 06:30:15 EDT 2008



On Wed, 2008-04-02 at 23:06 +0200, sQware.de wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> i'm trying desperately to schedule some worker methods within rails 2.0.2. The
> problem is, both methods don't even get called by BackgrounDRb.
> 
> my background.yml:
> 
> > ---
> > :backgroundrb:
> >   :port: 11006
> >   :ip: 0.0.0.0
> > ---
> > :schedules:
> >   :server_worker:
> >     :update:
> >       :trigger_args: 1 * * * * * *
> >   :monitoring_worker:
> >     :check_services:
> >       :trigger_args: */10 * * * * * *
> 
> Both Worker gets automatically started if BackgroundRb starts. I want the
> server_worker to start an update-method every minute, the monitoring_worker to
> check every 10 seconds if the server is still running.
> Between two calls both worker are stopped (or sleeping), the creation and the
> different tasks are shorter than the interval (if that matters)
> 
> At another point i'm trying to schedule a Task via a MiddelMan.new_worker within
> rails:
> 
> > MiddleMan.new_worker(:worker => :account_worker, :job_key => id, :data => id,\
> :schedule => { :calculate => { :trigger_args => "*/5 * * * * * *", :data => id \ }})
> 
> With this call, the method don't even get executed (tested with logger.info as
> first line to see if a message gets written in the log-file).
> 
> > def calculate(id = nil)
> >   logger.info("#{Time.now}: calculate")
> > end
> 
> The creation of a worker instance works fine, only the scheduled Part dont gets
> executed.
> So my assumption is, that the trigger_args are wrong, but i checked everything a
> thousend times and maybe i dont see the wood for the trees (maybe I have to
> sleep a litte bit more ;) )
> 
> 
> Even the backgroundrb_11006_debug.log don't say anything i can use to find the
> error:
> > 00000012{
> > :       type:start_worker:
> > schedule{:calculate{:trigger_args"*/5 * * * * * *:      data"6:
> >                                                                job_key@ ;
> >                                                                          @
> > {:data=>"6", :worker=>:account_worker, :type=>:start_worker, :job_key=>"6",\
> :schedule=>{:calculate=>{:data=>"6", :trigger_args=>"*/5 * * * * * *"}}}
> 
> Everything happens on Ubuntu Linux 7.10
> > ak at ak-laptop:~$ uname -r
> > 2.6.22-14-generic
> with BackgroundRb 1.0.3,
> 
> rails:
> > ak at ak-laptop:~$ rails -v
> > Rails 2.0.2
> 
> and Ruby:
> > ak at ak-laptop:~$ ruby -v
> > ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
> 
> I hope someone can point me to the source of my Problems.
> 
> Thanks
> 
> Andi
> 

If you don't mind, I will be only be able to look in this in detail when
I reach home.  Your configuration looks alright.

Also, are you telling us that, even plain scheduled worker scheduled
through config file are not being scheduled?




More information about the Backgroundrb-devel mailing list