-----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") > endThe 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-genericwith BackgroundRb 1.0.3, rails:> ak at ak-laptop:~$ rails -v > Rails 2.0.2and 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-----
hemant kumar
2008-Apr-03 10:30 UTC
[Backgroundrb-devel] scheduling worker methods in rails
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?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hemant kumar schrieb:> Also, are you telling us that, even plain scheduled worker scheduled > through config file are not being scheduled?Right, with the background.rb-file cited above the schedules dont work. The Server- and the Monitoring- Workers get automatically started when i start backgroundrb. The create-methods are working without problems ... also if i call the update or check_services methods from within the according create-method everything works fine ... only the triggers dont fire ... I updated all gems (sudo gem update --system), doublechecked if all necessary dependencies are installed (chronic and packet) ... everything ok ... I also tested a completly new worker with following settings: backgroundrb.yml:> --- > :backgroundrb: > :port: 11006 > :ip: 0.0.0.0 > --- > :schedules: > :hello_worker: > :worker_method: say > :trigger_args: 0 * * * * * *hello_worker:> class HelloWorker < BackgrounDRb::MetaWorker > set_worker_name :hello_worker > def create(args = nil) > # this method is called, when worker is loaded for the first time > logger.info("#{Time.now}. worker started") > end > def say(args = "hello") > logger.info("#{args} again, its #{Time.now}") > end > endin backgroundrb_11006.log:> Thu Apr 03 18:19:35 +0200 2008. worker started > hello_worker started > Schedules for worker loadedthats all ... so i think, the trigger don''t gets fired. Do you have a clue, where i might have an error, or is there an error in trunk? Unfortunaly there is no error logged in any of the logfiles, so i can not hunt it ;) many thanks for helping Andi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFH9Q2xW5GYaw3DxvwRAiFvAJ0WALHwWy+sPClnSTHC5DIFfNE+HgCgkNDl 4gmpRcL392g2qQt7zh+osro=nfoE -----END PGP SIGNATURE-----