Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Timers, scheduling and Ruby

Reply
Thread Tools

Timers, scheduling and Ruby

 
 
Damphyr
Guest
Posts: n/a
 
      11-30-2006
Ok, since the original post migh just appear in a month's time, lets
rephrase the question:

I'm building a set of tools for build and test management (yes, yes, it
will do DamagaControl's work and yes, yes it will be released...and yes,
this is code that is used in real-life projects - it's all so close to
public alpha status).
Now, I can leave scheduling to cron (or at/schtasks), but it would be
nice to provide an interface so that scheduling can be set in the
application via some administration console.
Behind the scenes cron manipulation is too flaky for my tastes (and for
windows I would need a separate implementation).
So, is there a library that will give me timers, a nice way to configure
them and a nice event driven interface?
Cheers,
V.-
--
http://www.braveworld.net/riva

 
Reply With Quote
 
 
 
 
M. Edward (Ed) Borasky
Guest
Posts: n/a
 
      11-30-2006
Damphyr wrote:
> Ok, since the original post migh just appear in a month's time, lets
> rephrase the question:

You've discovered a chronosynclastic infundibulum, apparently.
>
> I'm building a set of tools for build and test management (yes, yes,
> it will do DamagaControl's work and yes, yes it will be released...and
> yes, this is code that is used in real-life projects - it's all so
> close to public alpha status).
> Now, I can leave scheduling to cron (or at/schtasks), but it would be
> nice to provide an interface so that scheduling can be set in the
> application via some administration console.
> Behind the scenes cron manipulation is too flaky for my tastes (and
> for windows I would need a separate implementation).
> So, is there a library that will give me timers, a nice way to
> configure them and a nice event driven interface?
> Cheers,
> V.-

Event Machine?

--
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given rabbits fire.


 
Reply With Quote
 
 
 
 
James Edward Gray II
Guest
Posts: n/a
 
      11-30-2006
On Nov 30, 2006, at 7:51 AM, Damphyr wrote:

> Behind the scenes cron manipulation is too flaky for my tastes (and
> for windows I would need a separate implementation).
> So, is there a library that will give me timers, a nice way to
> configure them and a nice event driven interface?


I've wanted this myself. I wonder if we could get it down to Ruby
Quiz size...

James Edward Gray II

 
Reply With Quote
 
Damphyr
Guest
Posts: n/a
 
      11-30-2006
M. Edward (Ed) Borasky wrote:

>> So, is there a library that will give me timers, a nice way to
>> configure them and a nice event driven interface?
>> Cheers,
>> V.-

> Event Machine?

I'm not sure about this. EventMachine seems geared towards networking.
I just want a class that will tick away on it's own thread and fire
events at designated time points.
My requirements include firing at intervals (every thirty minutes, every
two days), once (in thirty minutes, on 1/1/2007 at 0:00 etc.) and I
would like to have named events if possible.
Getting the events should be as simple as observing the timer.
So will anybody save me the work or do I have to code the beast?
Cheers,
V.-

--
http://www.braveworld.net/riva

 
Reply With Quote
 
Rob Sanheim
Guest
Posts: n/a
 
      11-30-2006
On 11/30/06, Damphyr <> wrote:
> I'm not sure about this. EventMachine seems geared towards networking.
> I just want a class that will tick away on it's own thread and fire
> events at designated time points.
> My requirements include firing at intervals (every thirty minutes, every
> two days), once (in thirty minutes, on 1/1/2007 at 0:00 etc.) and I
> would like to have named events if possible.
> Getting the events should be as simple as observing the timer.
> So will anybody save me the work or do I have to code the beast?
> Cheers,
> V.-


I have nothing worthwhile to add, other then that I've also definitely
wanted something like this. rubyquiz?

- rob

 
Reply With Quote
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      11-30-2006
On Fri, 1 Dec 2006, James Edward Gray II wrote:

> On Nov 30, 2006, at 7:51 AM, Damphyr wrote:
>
>> Behind the scenes cron manipulation is too flaky for my tastes (and for
>> windows I would need a separate implementation).
>> So, is there a library that will give me timers, a nice way to configure
>> them and a nice event driven interface?

>
> I've wanted this myself. I wonder if we could get it down to Ruby Quiz
> size...


i'm working on a library for this now. any request?

-a
--
if you want others to be happy, practice compassion.
if you want to be happy, practice compassion. -- the dalai lama

 
Reply With Quote
 
James Edward Gray II
Guest
Posts: n/a
 
      11-30-2006
On Nov 30, 2006, at 11:47 AM, wrote:

> On Fri, 1 Dec 2006, James Edward Gray II wrote:
>
>> On Nov 30, 2006, at 7:51 AM, Damphyr wrote:
>>
>>> Behind the scenes cron manipulation is too flaky for my tastes
>>> (and for windows I would need a separate implementation).
>>> So, is there a library that will give me timers, a nice way to
>>> configure them and a nice event driven interface?

>>
>> I've wanted this myself. I wonder if we could get it down to Ruby
>> Quiz size...

>
> i'm working on a library for this now. any request?


Ara, you just plain rock.

My biggest request: a sane way (read: not-cron-like) to schedule
events.

James Edward Gray II

 
Reply With Quote
 
ara.t.howard@noaa.gov
Guest
Posts: n/a
 
      11-30-2006
On Fri, 1 Dec 2006, James Edward Gray II wrote:

> My biggest request: a sane way (read: not-cron-like) to schedule events.


how bout this as the time spec?

http://runt.rubyforge.org/

??

-a
--
if you want others to be happy, practice compassion.
if you want to be happy, practice compassion. -- the dalai lama

 
Reply With Quote
 
Damphyr
Guest
Posts: n/a
 
      11-30-2006
James Edward Gray II wrote:
>
> My biggest request: a sane way (read: not-cron-like) to schedule
> events.

How about stealing from schtasks
(http://www.microsoft.com/resources/d...spx?mfr=true)?
(ducks away and hides)
It doesn't have to be so convoluted.

Define the task like this

class ScheduledTask
attr_reader :name,:schedule,:schedule_params
end

Schedule is one of :minute, :hourly, :daily, :weekly, :monthly, :yearly

then according to schedule you have different options.
Universal options:
nce to generate the event only once. It's not there, then we get repeats.
:start_time to define when to start counting. If you leave it undefined
the timer starts immediately. If you define it, it should be in the future.
interval (after x minutes/hours/days/weeks/months/years an event will be
generated. if once is defined it runs once x /whatever/ after start_time)

An option valid for weekly and monthly can be :day, where you can
specify the day of the week (1-7) or month (1-31).

Would that be simple enough?
Cheers,
V.-
--
http://www.braveworld.net/riva

 
Reply With Quote
 
Francis Cianfrocca
Guest
Posts: n/a
 
      11-30-2006
On 11/30/06, Damphyr <> wrote:
> M. Edward (Ed) Borasky wrote:
>
> >> So, is there a library that will give me timers, a nice way to
> >> configure them and a nice event driven interface?
> >> Cheers,
> >> V.-

> > Event Machine?

> I'm not sure about this. EventMachine seems geared towards networking.
> I just want a class that will tick away on it's own thread and fire
> events at designated time points.
> My requirements include firing at intervals (every thirty minutes, every
> two days), once (in thirty minutes, on 1/1/2007 at 0:00 etc.) and I
> would like to have named events if possible.
> Getting the events should be as simple as observing the timer.
> So will anybody save me the work or do I have to code the beast?
> Cheers,
> V.-
>
> --
> http://www.braveworld.net/riva
>
>



Try this in EventMachine:

require 'rubygems'
require 'eventmachine'

EventMachine.run {
EventMachine.add_periodic_timer(60) {
# The code in this block gets executed every sixty seconds
}
EventMachine.add_periodic_timer(3600) {
# The code in this block gets executed once an hour
}
}


You can read the timer definitions out of a config file, configure
them dynamically on the fly, or build them with a GUI.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
example in ruby for implimenting scheduling by rufus-schedul Bishnu Das Ruby 1 03-24-2008 09:53 AM
GIL, threads and scheduling - performance cost adsheehan@eircom.net Python 3 08-29-2005 05:02 PM
passing messages between ruby thread and scheduling vincent Ruby 0 06-22-2005 03:57 AM
Task scheduling using Ruby? nkb Ruby 2 10-11-2004 09:26 AM
Scheduling program for piano tuner and PDA Steve Freides Computer Support 2 06-14-2004 09:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57