How do I know whether the job execution is successful or not?

36 views
Skip to first unread message

dongcan zhao

unread,
Apr 9, 2012, 10:45:23 PM4/9/12
to Rufus Ruby
rufus-scheduler is a good gem.But now I want to keep track of jobs by
logging in a file.I want to write the results(such as successful or
failed),but I don't know how to do.I learn this not so long , please
give me some suggestions. Thanks.

John Mettraux

unread,
Apr 10, 2012, 12:13:11 AM4/10/12
to rufus...@googlegroups.com

Hello,

you could do something like

---8<---
class MyBusiness

def self.do_it
# ... doing it
log('success')
rescue => exception
log('failure', exception)
end

def self.log(msg, exception=nil)
# ...
end
end

# ...

scheduler.every '10m' do
MyBusiness.do_it
end
--->8---

rufus-scheduler lets you choose any logging library you like.

Look at the "exception in jobs" section of the README too.


I hope this well help, best regards,

--
John Mettraux - http://lambda.io/processi

dongcan zhao

unread,
Apr 10, 2012, 3:40:04 AM4/10/12
to Rufus Ruby
It's OK now.Thank you for your kind help!
Reply all
Reply to author
Forward
0 new messages