rufus-scheduler 1.0.9 released
just released the “rufus-scheduler” 1.0.9 [gem].
It fixes a few bugs, mainly making jobs visible via get_job(job_id) even when they are right in the middle of execution.
It also introduces 4 new shorter aliases : “at”, “in”, “every” and “cron” (to “schedule_at”, “schedule_in”, “schedule_every” and “schedule” respectively) :
require 'rubygems'
require 'rufus/scheduler' # gem 'rufus-scheduler'
scheduler = Rufus::Scheduler.start_new
scheduler.in("3d") do
regenerate_monthly_report()
end
#
# will call the regenerate_monthly_report method
# in 3 days from now
scheduler.every "10m10s" do
# every 10 minutes and 10 seconds
check_score(favourite_team)
end
scheduler.cron "0 22 * * 1-5" do
log.info "activating security system..."
activate_security_system()
end
scheduler.at "Sun Oct 07 14:24:01 +0900 2009" do
init_self_destruction_sequence()
end
Changelog :
- bug #21262 : brought back (proxy) duration_to_f to Rufus::Scheduler
- todo #21251 : added ‘at’, ‘cron’, ‘in’ and ‘every’ shortcut methods
- todo #21203 : keeping track of At and EveryJob until last trigger is over
- todo #20823 : now raising exception in case of bad ‘at’ parameter
- todo #21194 : added trigger_thread to Job class
- todo #21193 : spinned CronLine out to rufus/cronline.rb
- bug #20893 : sometimes unschedule(every_job) not working when job was active (performing). Fixed.
Links :
http://github.com/jmettraux/rufus-scheduler
http://rubyforge.org/projects/rufus/
http://rufus.rubyforge.org/rufus-scheduler/files/README_txt.html
http://groups.google.com/group/rufus-ruby
Thanks to Sean Liu, Adam and Rael for their help.
thank you for the duration_to_f fix ;) I know that was a private method and taskr sort of hacked it to be public, but thanks for the quick turnaround!
Adam Greene
July 20, 2008 at 5:49 am
Hi Adam, thanks a lot. I wish you all the best for your http://sweetspot.dm endeavour.
Cheers,
John Mettraux
July 20, 2008 at 6:03 am
I’m trying to integrate rufus-scheduler into Rails and I’m running into an annoyance that you have to keep track of the scheduler object across different Rails calls. Is there a correct way to do this?
I would really like something like Rufus::Scheduler.all_schedulers which will return all the schedulers in the system so I don’t have to worry about persistence from within Rails itself.
Xianhang Zhang
October 19, 2008 at 2:55 pm
Hello Xianhang,
you’ll find my answer at
http://groups.google.com/group/rufus-ruby/browse_thread/thread/d9f353844accaedf
Cheers,
John Mettraux
October 19, 2008 at 11:30 pm
Hi John. I’ve been meaning to have a look at scheduler for a little while now and have finally been given a job which suits scheduler down to the ground. However i installed the gem, copied/pasted the example code and found that the examples didn’t work. I’m developing on WinXP and wonder whether there are any known issues with the gem Windows systems?
The code is:
require ‘rubygems’
require ‘rufus/scheduler’
scheduler = Rufus::Scheduler.start_new
scheduler.every “10s” do
print( “This should be output every ten seconds” )
end
It sits for 10 seconds and the terminates. Any ideas
Jim
November 10, 2008 at 1:56 pm
Hi Jim,
my answer is at :
http://groups.google.com/group/rufus-ruby/browse_frm/thread/e319c4f7d4a86671
(It’s easier to have a conversation on the mailing list)
Best regards,
John
John Mettraux
November 10, 2008 at 2:13 pm
I have a web application in rails for online appointment scheduling.I need to send notification for every appointment before some predefined time interval. Please suggest how to implement this logic using scheduling.
smita
May 8, 2009 at 11:42 am
Hi Smita, you’ll find the mailing list for rufus-scheduler at
http://groups.google.com/group/rufus-ruby
You can submit your question there.
Best regards,
John Mettraux
May 8, 2009 at 11:57 am