integration with rails.

121 views
Skip to first unread message

Tim Uckun

unread,
Feb 15, 2009, 8:56:16 PM2/15/09
to rufus...@googlegroups.com
I saw this post today.

http://intridea.com/2009/2/13/dead-simple-task-scheduling-in-rails?blog=company

And it seems like a really simple and easy way to set up background job processing with rufus.

It's my understanding that the scheduler runs in it's own thread and that each one of the tasks has their thread too. Given that ruby does not have true multithreading I am wondering if this can ever block the rest of rails code?

If I schedule a task that takes a massively long time what happens?

Also what happens under mod_rails (passenger)?  Are all your tasks running on all the processes? 


John Mettraux

unread,
Feb 15, 2009, 9:10:30 PM2/15/09
to rufus...@googlegroups.com
On Mon, Feb 16, 2009 at 10:56 AM, Tim Uckun <timu...@gmail.com> wrote:
> I saw this post today.
>
> http://intridea.com/2009/2/13/dead-simple-task-scheduling-in-rails?blog=company
>
> And it seems like a really simple and easy way to set up background job
> processing with rufus.

Hi,

rufus-scheduler was never meant as a "background job processing
solution for rails", it's only a simple ruby gem for scheduling pieces
of code. It was originally developed for a workflow engine
(http://openwferu.rubyforge.org/)

> It's my understanding that the scheduler runs in it's own thread and that
> each one of the tasks has their thread too. Given that ruby does not have
> true multithreading I am wondering if this can ever block the rest of rails
> code?

Yes, the scheduler has his own thread. When a task gets triggered, it
executes in its own thread.

Yes, it can potentially block the rest of your rails code.

> If I schedule a task that takes a massively long time what happens?

When it gets triggered it will block the rest of your rails code probably.

It's your responsibility to make the task play nicely with other
threads or to completely offload that from the main application (then
you could simply use cron).

play with that gist : http://gist.github.com/64947 (run it as is and
then with the Thread.pass uncommented).

> Also what happens under mod_rails (passenger)? Are all your tasks running
> on all the processes?

No idea, I don't know anything about the threading / processing model
used by mod_rails.


Best regards,

--
John Mettraux - http://jmettraux.wordpress.com

Reply all
Reply to author
Forward
0 new messages