Long report


#1

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.


#2

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.


#3

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.


#4

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


#5

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


#6

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


#7

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.