Re: Periodic tasks

2009-11-04 Thread sross
(.schedule sched "* * * * *" #(println "Hello, World!")) "dca735307ae35bb7649a8a680124bec35ff926b54d06" user=> (.start sched) On Oct 30, 4:05 am, Stefan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need   > to run a simple functio

Re: Periodic tasks

2009-11-03 Thread MarkSwanson
> I'd love to hear success stories from people using nailgun to actually > run frequent scripted tasks out of cron, as opposed to for > development. It would make clojure more palatable for my work > environment. Nailgun has been a boon to me. I don't believe Nailgun has a problem with dynamic cl

Re: Periodic tasks

2009-11-01 Thread John Harrop
On Sun, Nov 1, 2009 at 7:39 PM, Jonathan Smith wrote: > > Maybe I'm confused, but can't you just do a regular java thread for > this? > > (defn periodicly [fun time] > "starts a thread that calls function every time ms" > (let [thread (new Thread (fn [] (loop [] (fun) (Thread/sleep time) > (recur

Re: Periodic tasks

2009-11-01 Thread Jonathan Smith
fan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need   > to run a simple function every couple of minutes. And make sure that   > if it throws an exception that it won't kill the periodic task. > > I come from a Spring world where XML, Timer

Re: Periodic tasks

2009-11-01 Thread John Harrop
On Sun, Nov 1, 2009 at 3:20 PM, Emeka wrote: > John, > > Is like I am missing something? This thread mentioned making periodic > tasks, there was a java example to it. However, what you posted I am yet to > figure out how to make a periodic tasks possible. > Agents can perf

Re: Periodic tasks

2009-11-01 Thread Emeka
John, Is like I am missing something? This thread mentioned making periodic tasks, there was a java example to it. However, what you posted I am yet to figure out how to make a periodic tasks possible. Regards, Emeka On Sat, Oct 31, 2009 at 6:27 PM, John Harrop wrote: > On Sat, Oct 31, 2

Re: Periodic tasks

2009-10-31 Thread John Harrop
On Sat, Oct 31, 2009 at 12:36 PM, Luke VanderHart wrote: > Why not just run an agent that does something, then calls sleep for N > seconds, then calls the next thing? > > Granted, it will eat up a thread in your agent thread pool, but if > you've only got one of these in the app it shouldn't be a

Re: Periodic tasks

2009-10-31 Thread cody koeninger
On Oct 31, 11:42 am, Richard Newman wrote: > VimClojure relies on Nailgun, with a bunch of people on this list   > using it with Clojure every day. My recollection from list and IRC was that (aside from random nailgun issues + the project not being updated in 4 years) there was an issue with d

Re: Periodic tasks

2009-10-31 Thread Richard Newman
> > Overhead from starting and stopping the JVM every couple of minutes > would probably be unacceptable. My understanding is that solutions > like Nailgun don't work correctly with Clojure either. VimClojure relies on Nailgun, with a bunch of people on this list using it with Clojure every da

Re: Periodic tasks

2009-10-31 Thread Luke VanderHart
t a daemon thread manually. -Luke On Oct 30, 12:05 am, Stefan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need   > to run a simple function every couple of minutes. And make sure that   > if it throws an exception that it won't kill the periodic

Re: Periodic tasks

2009-10-31 Thread cody koeninger
On Oct 31, 5:22 am, alxtoth wrote: > Why not use the OS task scheduler? On un*x there is good old cron or > at. On windoze there is similar task scheduler. > Overhead from starting and stopping the JVM every couple of minutes would probably be unacceptable. My understanding is that solutions

Re: Periodic tasks

2009-10-31 Thread alxtoth
iles , and rotate those files sometimes. I am sure there are more fancy solutions than cron, and some that don't require megabytes of XML as the usual Java stuff -Alex On Oct 30, 6:05 am, Stefan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need  

Re: Periodic tasks

2009-10-30 Thread AndrewC.
On 30 Oct, 16:18, Albert Cardona wrote: > How about: > > (import '(java.util.concurrent Executors TimeUnit)) .. > Admittedly very java-ish. Personally, I think Java-ish is the way to go here. John's actor lib is pretty nifty, but it is relying on implementation details of the threading o

Re: Periodic tasks

2009-10-30 Thread Albert Cardona
How about: (import '(java.util.concurrent Executors TimeUnit)) (let [s (Executors/newSingleThreadScheduledExecutor)] (.scheduleAtFixedRate s #(try (println "I did it again") (catch Exception e (.printStackTrace e))) (long 0) (long 1) TimeUnit/SECONDS)) Adm

Re: Periodic tasks

2009-10-30 Thread John Harrop
On Fri, Oct 30, 2009 at 12:05 AM, Stefan Arentz wrote: > What is a good and simple way to run periodic tasks in Clojure? I need > to run a simple function every couple of minutes. And make sure that > if it throws an exception that it won't kill the periodic task. > > I come

Periodic tasks

2009-10-30 Thread Stefan Arentz
What is a good and simple way to run periodic tasks in Clojure? I need to run a simple function every couple of minutes. And make sure that if it throws an exception that it won't kill the periodic task. I come from a Spring world where XML, Timers, Jobs and Quartz rule the world,