[erlang-questions] request a task scheduler

8 views
Skip to first unread message

info

unread,
Aug 31, 2009, 9:56:57 AM8/31/09
to erlang-questions
Hi all,

Excepted crone.erl do you know a task scheduler for erlang OTP application ?
I look for a task scheduler with a fine timing (seconds, minutes, ..., months, ...).

John

Robert Raschke

unread,
Aug 31, 2009, 10:50:34 AM8/31/09
to erlang-questions

What's wrong with crone? Seems to fit the bill, except for tasks run at very
large intervals. I guess the other thing missing from crone is scheduling
against UTC instead of local time. Otherwise it's pretty trivial to mould to
your needs.

If you need scheduling on a yearly basis, you should be able to take the
crone code and put a wrapper with coarse granularity around it very easily.

Robby

info

unread,
Aug 31, 2009, 11:13:26 AM8/31/09
to Robert Raschke, erlang-questions
Hi Robby,
It seems that we cannot schedule tasks every 30 seconds or 5 minutes. Am I wrong ?
John

Witold Baryluk

unread,
Aug 31, 2009, 11:24:27 AM8/31/09
to erlang-questions
Dnia 2009-08-31, pon o godzinie 17:13 +0200, info pisze:

> Hi Robby,
> It seems that we cannot schedule tasks every 30 seconds or 5 minutes. Am I wrong ?
> John

Yes, you can, kind of hack but should work

{daily, {every, {30, sec}}, {between, {0,0,pm}, {11,39,am}}}.

crone version available 2004 have lots of bugs and is quite slow
in calculating schedules which are very frequent (like 30 seconds).

You will probably need to tweak it somehow.

We have some more improved and optimized version of crone, but
unfortunately it isn't publicly available yet.


--
Witold Baryluk

signature.asc

Robert Raschke

unread,
Aug 31, 2009, 11:45:34 AM8/31/09
to info, erlang-questions

The {daily, {every, {5, sec}, {between, {12, 0, 0, am}, {11, 59, 59, pm}}}}
schedule works fine for me. (Disclaimer, I've changed the until_next_time()
function to use simple 24 hour days for myself, so I hope that schedule is
correct for the crone.erl you can get online.)

I don't use the surrounding invocation code provided by crone though. I just
use the until_next_time() to get me the amount of time to put into my
gen_server timeout return values. The one thing that is a bit awkward is
dealing with milli-seconds. The crone code only goes to second granularity.
So if your task is over in less than a second, be sure to not invoke it
again by accident. If I remember correctly there was some explicit
sleep(1000) in the crone invocation code itself.

Robby

Reply all
Reply to author
Forward
0 new messages