Timers, scheduling and Ruby

it sure could. i'm of the opinion though, that users should be allowed
to
shoot themselves in the foot - if you want to schedule 40,000 events per
second then fine, maybe your quantum computer can actually handle it!
:wink:

Me too... as long as they're not also shooting the users and the systems
admin in the foot too :wink:

···

--
Posted via http://www.ruby-forum.com/\.

>
> >> rather, i think one must
> >>
> >> 1) constrain even runner to check only every n seconds, ala cron
> >>
> >
> > You're still going to have the missed events problem with the runner
> > regardless of the time granularity. If you only check every ten
seconds
> but
> > notifications take twenty, then a whole set of notifications are
missed.
>
> nah. you'd raise an error if events were scheduled at finer than
'n'. in
> cron it's simply not possible - same thing. alternatively you can merge
> into
> minute buckets.
>
> > Sounds like (regardless of using cron style runner or Runt "next time"
> > conventions) missed notifications need to be handled in a predictable
> > manner.
>
> > 1) just drop them
> > 2) send out an extra notification immediately
> > 3) queue up the missed notifications for the next time
>
> agreed. i'd add:
>
> 4) call user handler - specification possible at event creation
>
> there is some uber cron thingy on macs that handles this i think...
> anyone?

I believe you're referring to launchd.
http://developer.apple.com/macosx/launchd.html *The correct title of this
article is launchd. The initial letter is shown capitalized due to
technical
restrictions<
Wikipedia:Naming conventions (technical restrictions) - Wikipedia
>
.*

*"launchd* is a unified, open
source<http://en.wikipedia.org/wiki/Open_source&gt; service
management<
http://en.wikipedia.org/wiki/Operating_System_service_management&gt;
framework <http://en.wikipedia.org/wiki/Framework&gt; for starting, stopping
and managing daemons<
http://en.wikipedia.org/wiki/Daemon_(computer_software)&gt;,
programs <http://en.wikipedia.org/wiki/Computer_program&gt; and
scripts<http://en.wikipedia.org/wiki/Shell_script&gt;\.
It was introduced with Mac OS X
v10.4<http://en.wikipedia.org/wiki/Mac_OS_X_v10.4&gt;
/Darwin <http://en.wikipedia.org/wiki/Darwin_(operating_system)&gt; v8.0,
and is licensed under the Apache
License<http://en.wikipedia.org/wiki/Apache_License&gt;\.
Dave Zarzycki <http://en.wikipedia.org/wiki/Dave_Zarzycki&gt; is credited
with
designing and maintaining launchd.

The launchd daemon<
http://en.wikipedia.org/wiki/Daemon_(computer_software)&gt;is
essentially a replacement for
init <http://en.wikipedia.org/wiki/Init&gt;,
rc<http://en.wikipedia.org/wiki/Unix_security&gt;,
the init.d <View source for Init.d - Wikipedia
>and
rc.d <Permission error - Wikipedia; scripts,
SystemStarter <http://en.wikipedia.org/wiki/SystemStarter&gt; (Mac OS X),
inetd<http://en.wikipedia.org/wiki/Inetd&gt;and
xinetd <http://en.wikipedia.org/wiki/Xinetd&gt;,
atd<View source for Atd - Wikipedia,
crond <http://en.wikipedia.org/wiki/Crond&gt; and
watchdogd<Permission error - Wikipedia
>.
Apple has stated that it intends to eliminate all of the aformentioned
services in favor of launchd. As of OS X v10.4 Apple has moved most of the
processes handled by the previously mentioned daemons to launchd. By
consolidating all the launch services into one program, launchd
significantly shortens boot time on slow computers."[1]
[1] launchd - Wikipedia

Sorry everyone, I had no idea this paste would turn out so hideous.

···

On 12/1/06, Michael Guterl <mguterl@gmail.com> wrote:

On 12/1/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
> On Sat, 2 Dec 2006, Tim Pease wrote:

   2) have the event interalize the time iteration itself so it can start

> >> threads whenever it needs
> >>
> >
> > Will this cause a slow thread death with lots and lots of events? The
> > ruby thread scheduler might eat up all your processor trying to
> > schedule 1000+ threads?
>
> it sure could. i'm of the opinion though, that users should be allowed
to
> shoot themselves in the foot - if you want to schedule 40,000 events per
> second then fine, maybe your quantum computer can actually handle
it! :wink:
>
> a warning or hard/soft limits might be a good compromise.
>
> > At the last ruby group meeting, Nathan Witmer showed me a nice little
> > "thread per notification" system he put together. It sounds very
useful
> for
> > this project of yours.
>
> link?
>
> -a
> --
> if you want others to be happy, practice compassion.
> if you want to be happy, practice compassion. -- the dalai lama
>

heh. no problem. you were right too.

-a

···

On Sat, 2 Dec 2006, Michael Guterl wrote:

[1] launchd - Wikipedia

Sorry everyone, I had no idea this paste would turn out so hideous.

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

There is a ruby gem called moment that is a timer/scheduler for jobs. It even has cron compatible syntax or simple trigger stlyes.

gem install moment

Cheers-
-- Ezra Zygmuntowicz-- Lead Rails Evangelist
-- ez@engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)