How can I manage a long running process from a Rails app?

I'm building an app to learn Rails, and I'm not sure how to go about this.

I have a form, where the user enters some data. The data is validated, and a server side process should start ( the process may take from 5 minutes to 2 hours ). I'd like to be able to know the state of the process at all times and to be able to kill it. The thing I'm not sure how to do is starting the process. I know about system, backticks and all the ways to execute external commands from Ruby code ... the thing is, if I do this from a controller, will the server still process requests from other users? Also, should this be started from the controller? One of the things that I'll need to do is display the output of the process inside a page ( as it executes ).

How should I start & manage ( kill/restart ) a long running process in Rails? How would I do it in such a way that each user can start his own process?


I think you should have a look at delayed_job. It should do exactly what you are after.

Look into using background job plugin: It has good features and community support.

Need Your Help

Search data in table using ajax in MVC

c# jquery ajax

I want to display data in a table based on the search criteria in a textbox. I have implemented it without using Ajax but do not know how to call controller method using jquery and update table data.

How to access element and elementId from within didInsertElement

coffeescript ember.js

Using Ember.CollectionView I want to access and manipulate the DOM element which is being inserted by each child view. The issue I have is that I don’t know how to get a reference to the element from

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.