On Wed, Jan 14, 2009 at 7:14 PM, Toby Corkindale < toby.corkind...@strategicdata.com.au> wrote:
> Diego M. Vadell wrote: > >> Hi everybody, >> >> I'm making a nice little webapp in Catalyst: metheorology models run via >> crontab and catalyst shows the data and graphs that they produce. Im very >> happy how it's working so far. >> >> Now I have been asked if I could make a "Run the model now" button, that >> would run a script (the model) and show it's output in a popup window. >> The process may run for about 15 minutes, so I have to handle , somehow, >> the browser timing out because of lack of output. I thought about making the >> script output to a tmp file and using ajax to query that file. >> >> What is the best way to do that? Is there a nice, magical CPAN module >> out there? :) >> > > You don't really need one.. > > Simplest way to handle this would be for the web page to kick off the model > running in another process, and then immediately display a web page that > says "Please wait, model running.." > > That page then either uses javascript or a http-refresh mechanism to check > back every 30 seconds to see if the model is ready yet. > Seconded. This is a very easy way to accomplish this task. If you need further control (stopping jobs, viewing status % done, etc) I would build or use one of the many queue managers out there ( http://search.cpan.org/search?query=job+queue&mode=all ) outside of you app that updates your database and accepts commands via your app and database. Either way this really should be done outside of the webapp. -Wade
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/