[Backgroundrb-devel] scheduling worker methods in rails

sQware.de sqware.de at gmail.com
Wed Apr 2 17:06:45 EDT 2008


-----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

P.S. excuse my poor english, i hope you understand my needs ;)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH8/VlW5GYaw3DxvwRAneLAKDLWc1dv8S9OMwwNF1li71sHEOMvgCfTCce
QmdphYGdVX28T0bAA1Qbxbc=
=C2Cb
-----END PGP SIGNATURE-----


More information about the Backgroundrb-devel mailing list