Adam,

This looks great. I was building a couple of applications that run periodic
tasks/services on top of quartzite, but I'll definitely play with this.
Much nicer scheduling syntax, and the lack of a single stateful scheduler
feels much more Clojurian (and cleaner, too).

Thanks!

Jason Lewis

Email          jasonlewi...@gmail.com

Twitter        @canweriotnow <http://twitter.com/canweriotnow>

About         http://about.me/jason.lewis


On Fri, Jan 18, 2013 at 12:14 PM, Paulo Suzart <paulosuz...@gmail.com>wrote:

> Hello Adam,
>
> I knew about https://github.com/overtone/at-at. Your lib is pretty
> straight forward and promising.
>
> Cheers
>
>
> On 17 January 2013 16:05, Adam Clements <adam.cleme...@gmail.com> wrote:
>
>> A URL would probably help: https://github.com/AdamClements/schejulure
>>
>>
>> On Thursday, January 17, 2013 5:56:40 PM UTC, Adam Clements wrote:
>>>
>>> So there are a few scheduling libraries around, I wanted one for
>>> cron-like job scheduling and my options were quite limited, there are
>>> things like clj-cronlike and quartzite but I found the syntax quite clunky
>>> and didn't like the central stateful scheduler idea. There are also things
>>> like at-at, but that's more for events recurring over seconds/minutes or
>>> one-shot events, so that was out too.
>>>
>>> In the end I wrote my own library. It's tiny (~60 lines) and does one
>>> task quite well. It's modelled after futures, and in fact returns a future,
>>> so use it in the same places/way you might use a future, but for recurring
>>> events.
>>>
>>> To schedule things, it's like a cron setup (so by default fires every
>>> minute of every hour of every day...) but you can pass a map of times when
>>> it should fire, so for example {:minute [0 15 30 45] :day :tue} will fire
>>> every 15 minutes on a tuesday where {:hour 9} will fire every minute from
>>> 9-10am every day. Beyond that you simply call schedule with pairs of
>>> schedule maps to functions which should fire.
>>>
>>> Example:
>>> => (def my-running-scheduler
>>>      (schedule {:hour 12 :minute [0 15 30 45]} my-function
>>>                {:hour (range 0 24 6) :minute 0 :day [:sat :sun]}
>>> batch-job))
>>>
>>> ...
>>> => (future-cancel my-running-scheduler)
>>>
>>> Simple as that.
>>>
>>> Like I say, this was to scratch my own itch, but if anyone else finds it
>>> useful, great. If it nearly does what you want but not quite... hey, it's
>>> only 60 lines, fork it/fix it. If anyone has suggestions for features,
>>> bugfixes or other libraries I should be contributing this code to instead,
>>> that would be useful knowledge too.
>>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>
>
>
> --
> Paulo Suzart
> @paulosuzart
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to