Forum: Ruby on Rails Long report

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Pedro C. (Guest)
on 2007-04-24 15:33
Hi all!

I have a rails app that has the ability to export data to excel. The
problem is that the report is very bug, so I need a way to reduce the
waiting time of my clients.

My thought was, lunch some threads... but... is it safe in rails?

Thanks
Pedro C.
Wai T. (Guest)
on 2007-04-24 18:33
Pedro C. wrote:
> Hi all!
>
> I have a rails app that has the ability to export data to excel. The
> problem is that the report is very bug, so I need a way to reduce the
> waiting time of my clients.
>
> My thought was, lunch some threads... but... is it safe in rails?
>
> Thanks
> Pedro C.

Nope.  It is unsafe in rails.  You should look into backgroundrb
instead.  It is very simple, you just need to create the proper worker
tasks and start the worker tasks using Middleman.  You may want to start
the worker in background.

key = MiddleMan.new_worker(:class => :excel_worker)
worker = MiddleMan.worker(key)
worker.work_thread(:method => 'export_data', :args => params)

Note that backgroundrb will have to be running first.
Pedro C. (Guest)
on 2007-04-24 19:37
Thanks!

And that would be multi tasking right?



Wai T. wrote:
> Pedro C. wrote:
>> Hi all!
>>
>> I have a rails app that has the ability to export data to excel. The
>> problem is that the report is very bug, so I need a way to reduce the
>> waiting time of my clients.
>>
>> My thought was, lunch some threads... but... is it safe in rails?
>>
>> Thanks
>> Pedro C.
>
> Nope.  It is unsafe in rails.  You should look into backgroundrb
> instead.  It is very simple, you just need to create the proper worker
> tasks and start the worker tasks using Middleman.  You may want to start
> the worker in background.
>
> key = MiddleMan.new_worker(:class => :excel_worker)
> worker = MiddleMan.worker(key)
> worker.work_thread(:method => 'export_data', :args => params)
>
> Note that backgroundrb will have to be running first.
Zack C. (Guest)
on 2007-04-24 21:31
(Received via mailing list)
> I have a rails app that has the ability to export data to excel. The
> problem is that the report is very bug, so I need a way to reduce the
> waiting time of my clients.
>
> My thought was, lunch some threads... but... is it safe in rails?
>

Pedro,

Backgroundrb (http://backgroundrb.rubyforge.org/) was designed to do
exactly this.  Check it out.

--
Zack C.
http://depixelate.com
Philip H. (Guest)
on 2007-04-25 04:15
(Received via mailing list)
> I have a rails app that has the ability to export data to excel. The
> problem is that the report is very bug, so I need a way to reduce the
> waiting time of my clients.
>
> My thought was, lunch some threads... but... is it safe in rails?

You might look into backgrounddrb... you could pass off the generating
of
the report to it and then have it update a flag in the database that the
report is ready or send an email to the user with the url to download
it...

-philip
Robert W. (Guest)
on 2007-04-25 05:23
(Received via mailing list)
The answer in RoR for long processes is BackgrounDRb

http://backgroundrb.rubyforge.org/

Sorry I don't have more details.  I haven't yet worked with this
myself.  Maybe someone else can fill in the gaps in my knowledge.

What I'm interested in would be that when you send the task to
BackgrounDRb process and you request-response cycle ends,  how do you
then provided feedback to the using that the process is complete?  Is
it possible to use AJAX to poll the long process for it's status, or
does the BackgroundDRb provide feedback in some form of callback
mechanism?

I'm guessing the answers to these questions become obvious when
working with BackgrounDRb, but I just don't have those answers for you
at this time.

On Apr 24, 7:33 am, Pedro C. <removed_email_address@domain.invalid>
Richard C. (Guest)
on 2007-04-25 13:45
(Received via mailing list)
On 4/24/07, Pedro C. <removed_email_address@domain.invalid> wrote:
>
> Thanks!
>
> And that would be multi tasking right?

Well not strictly true, there's no requirement for BackgroundRb to be
running on the
same machine as Rails. Which is actually a strong advantage.

Though I am not sure if there is some platform sensitivity with Rails
+ BackgroundRb
on windows. I thought it was mentioned in the HOWTO on the rubyonrails
site.

You might want to check.
This topic is locked and can not be replied to.