simon.wilkinson at 434wireless.com
2007-Aug-01 13:34 UTC
[Backgroundrb-devel] stability of using scheduled workers
Hi, Going through the archive, and just keeping a general watch on this list seems to indicate that there are some issues using scheduling with backgroundrb. I need a worker that will perform some actions on an hourly interval. These actions will require access to several of the models in my application. I am currently using backgroundrb to handle processing of files, where I spawn a worker to handle each file, and then destroy them afterwards. This is working great, and I would like to use backgroundrb for this scheduled action, but I need it to be reliable. What is the general feeling among those that are using it for this type of application? Does it reliably continue to fire at the proper intervals? Thanks, Simon
Levent Ali
2007-Aug-02 08:16 UTC
[Backgroundrb-devel] stability of using scheduled workers
To be honest... My answer would be no... We have two scheduled workers that run hourly and are offset by thirty minutes... We cannot get the scheduler to go 24 hours without skipping a few schedules. That''s if we are lucky. Usually it runs for at most a day and then never schedules again. I think it may have something to do with the scheduler code that sleeps for 0.1. There''s a comment in the code near it. I''m thinking it may get into a rhythm where it misses the schedule point. We tried changing the schedule to prime numbers and other random points but the same thing eventually happened. What we do now instead is use standard linux cron and that calls a rake task that spawns a backgroundrb worker. Everything outside of the scheduler function works like a dream for us. Hope that helps.. Levent On 8/1/07, simon.wilkinson at 434wireless.com <simon.wilkinson at 434wireless.com> wrote:> Hi, > > Going through the archive, and just keeping a general watch on this list seems to indicate that there are some issues using scheduling with backgroundrb. I need a worker that will perform some actions on an hourly interval. These actions will require access to several of the models in my application. I am currently using backgroundrb to handle processing of files, where I spawn a worker to handle each file, and then destroy them afterwards. This is working great, and I would like to use backgroundrb for this scheduled action, but I need it to be reliable. > > What is the general feeling among those that are using it for this type of application? Does it reliably continue to fire at the proper intervals? > > Thanks, > > Simon > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >
Ben Reubenstein
2007-Aug-03 16:29 UTC
[Backgroundrb-devel] stability of using scheduled workers
Hello ~ I have found that a much better way to do scheduled tasks is to use script/runner with crontab or cron. You then get access to your entire rails environment very easily. So for example in crontab I have a task that runs every half-hour: 0,30 * * * * ruby /path/to/script/runner ''load "/path/to/your/script/my.rb"'' I do however use backgroundrb for user initiated tasks such as processing a file and sending updates to the browser. I have found this to be extremely reliable. Hope this helps, Ben On 8/1/07, simon.wilkinson at 434wireless.com <simon.wilkinson at 434wireless.com> wrote:> Hi, > > Going through the archive, and just keeping a general watch on this list seems to indicate that there are some issues using scheduling with backgroundrb. I need a worker that will perform some actions on an hourly interval. These actions will require access to several of the models in my application. I am currently using backgroundrb to handle processing of files, where I spawn a worker to handle each file, and then destroy them afterwards. This is working great, and I would like to use backgroundrb for this scheduled action, but I need it to be reliable. > > What is the general feeling among those that are using it for this type of application? Does it reliably continue to fire at the proper intervals? > > Thanks, > > Simon > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >-- Ben Reubenstein 303-947-0446 http://www.benr75.com
Hi,
I have tried this, and can''t seem to get it going. Is there anything
special that needs to be done to the script?
I also tried to just set up a test through one of the models, where it would
just print the current time to a file, just to see if that would work. It
also didn''t work.
Here is the line I had in my crontab:
* * * * * ruby /var/www/rails/434Wireless/script/runner
"Ping.test_cron"
And here is the function in my Ping model:
def self.test_cron
test = Time.now.to_s(:db)
system("echo #{test} >> /var/log/test.log")
end
So I just want the current time added to a file, and for it to trigger every
minute (useless I know, but I''m just testing things here :) ). When I
just
run ''ruby /var/www/rails/434Wireless/script/runner
"Ping.test_cron"'' from
the command line, everything works perfectly. Any ideas on what is
happening?
Thanks,
Simon
-----Original Message-----
From: benr75 at gmail.com [mailto:benr75 at gmail.com] On Behalf Of Ben
Reubenstein
Sent: 03 August 2007 12:29
To: simon.wilkinson at 434wireless.com
Cc: backgroundrb-devel at rubyforge.org
Subject: Re: [Backgroundrb-devel] stability of using scheduled workers
Hello ~
I have found that a much better way to do scheduled tasks is to use
script/runner with crontab or cron. You then get access to your
entire rails environment very easily. So for example in crontab I
have a task that runs every half-hour:
0,30 * * * * ruby /path/to/script/runner ''load
"/path/to/your/script/my.rb"''
I do however use backgroundrb for user initiated tasks such as
processing a file and sending updates to the browser. I have found
this to be extremely reliable.
Hope this helps,
Ben
On 8/1/07, simon.wilkinson at 434wireless.com
<simon.wilkinson at 434wireless.com> wrote:> Hi,
>
> Going through the archive, and just keeping a general watch on this list
seems to indicate that there are some issues using scheduling with
backgroundrb. I need a worker that will perform some actions on an hourly
interval. These actions will require access to several of the models in my
application. I am currently using backgroundrb to handle processing of
files, where I spawn a worker to handle each file, and then destroy them
afterwards. This is working great, and I would like to use backgroundrb for
this scheduled action, but I need it to be reliable.>
> What is the general feeling among those that are using it for this type of
application? Does it reliably continue to fire at the proper
intervals?>
> Thanks,
>
> Simon
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>
--
Ben Reubenstein
303-947-0446
http://www.benr75.com
Charles Brian Quinn
2007-Aug-16 17:03 UTC
[Backgroundrb-devel] stability of using scheduled workers
Use the full path to ruby: /usr/local/bin/ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron" On 8/16/07, Simon <simon.wilkinson at 434wireless.com> wrote:> Hi, > > I have tried this, and can''t seem to get it going. Is there anything > special that needs to be done to the script? > > I also tried to just set up a test through one of the models, where it would > just print the current time to a file, just to see if that would work. It > also didn''t work. > > Here is the line I had in my crontab: > * * * * * ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron" > > And here is the function in my Ping model: > def self.test_cron > test = Time.now.to_s(:db) > system("echo #{test} >> /var/log/test.log") > end > > So I just want the current time added to a file, and for it to trigger every > minute (useless I know, but I''m just testing things here :) ). When I just > run ''ruby /var/www/rails/434Wireless/script/runner "Ping.test_cron"'' from > the command line, everything works perfectly. Any ideas on what is > happening? > > Thanks, > > Simon > > -----Original Message----- > From: benr75 at gmail.com [mailto:benr75 at gmail.com] On Behalf Of Ben > Reubenstein > Sent: 03 August 2007 12:29 > To: simon.wilkinson at 434wireless.com > Cc: backgroundrb-devel at rubyforge.org > Subject: Re: [Backgroundrb-devel] stability of using scheduled workers > > Hello ~ > > I have found that a much better way to do scheduled tasks is to use > script/runner with crontab or cron. You then get access to your > entire rails environment very easily. So for example in crontab I > have a task that runs every half-hour: > > 0,30 * * * * ruby /path/to/script/runner ''load "/path/to/your/script/my.rb"'' > > I do however use backgroundrb for user initiated tasks such as > processing a file and sending updates to the browser. I have found > this to be extremely reliable. > > Hope this helps, > > Ben > > On 8/1/07, simon.wilkinson at 434wireless.com > <simon.wilkinson at 434wireless.com> wrote: > > Hi, > > > > Going through the archive, and just keeping a general watch on this list > seems to indicate that there are some issues using scheduling with > backgroundrb. I need a worker that will perform some actions on an hourly > interval. These actions will require access to several of the models in my > application. I am currently using backgroundrb to handle processing of > files, where I spawn a worker to handle each file, and then destroy them > afterwards. This is working great, and I would like to use backgroundrb for > this scheduled action, but I need it to be reliable. > > > > What is the general feeling among those that are using it for this type of > application? Does it reliably continue to fire at the proper intervals? > > > > Thanks, > > > > Simon > > _______________________________________________ > > Backgroundrb-devel mailing list > > Backgroundrb-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/backgroundrb-devel > > > > > -- > Ben Reubenstein > 303-947-0446 > http://www.benr75.com > > _______________________________________________ > Backgroundrb-devel mailing list > Backgroundrb-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/backgroundrb-devel >-- Charles Brian Quinn self-promotion: www.seebq.com highgroove studios: www.highgroove.com slingshot rails business hosting: www.slingshothosting.com main: 404.394.4935 fax: 678.826.0969 Ruby on Rails Bootcamp at the Big Nerd Ranch Intensive Ruby on Rails Training: http://www.bignerdranch.com/classes/ruby.shtml