AJAX updates for execution progress status

I need to update multiple areas on my page within the same controller,
where statuses are updated as test scripts are being run and completed.
My js first renders a list of the available test cases to run, then I
have a loop running the execution of each script and doing a
page.replace_html, but nothing is rendered until everything has finished
executing.

I’m wondering how I can display the list first, then have the statuses
being updated on the page during the test script execution instead?

On Tue, Jul 8, 2008 at 7:49 PM, Michelle Li
[email protected] wrote:

I need to update multiple areas on my page within the same controller,
where statuses are updated as test scripts are being run and completed.
My js first renders a list of the available test cases to run, then I
have a loop running the execution of each script and doing a
page.replace_html, but nothing is rendered until everything has finished
executing.

I’m wondering how I can display the list first, then have the statuses
being updated on the page during the test script execution instead?

You want something along the lines of periodically call remote.

I did something vaguely like this and made a little screen cast
somewhere… lemmie look…

OK, found it:

And the tutorial:

Hope that helps

Mikel

Rails, RSpec and Life blog…

Thanks Mikel, I checked out your screencast and that looks really neat.

I installed the backgroundrb plugin along with the chronic and packet
gems but when I try starting the server using:

script/background start

I get the following error in my log file:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:266:in
load_missing_constant': uninitialized constant BackgrounDRb::Rails (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:453:in const_missing’
from
/home/mil1/QA/svn/QaEngine/trunk/lib/workers/execute_script_worker.rb:1
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in new_constants_in’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
require' from /home/mil1/QA/svn/QaEngine/trunk/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:37:in find_reloadable_worker’
from
/home/mil1/QA/svn/QaEngine/trunk/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:35:in
map' from /home/mil1/QA/svn/QaEngine/trunk/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:35:in find_reloadable_worker’
from
/home/mil1/QA/svn/QaEngine/trunk/vendor/plugins/backgroundrb/server/lib/master_proxy.rb:12:in
initialize' from script/backgroundrb:46:in new’
from script/backgroundrb:46

I can’t seem to figure it out and I’ve tried reinstalling the plugin a
few times. Would you have any idea what would be the problem?

Thanks,
Michelle

Mikel L. wrote:

On Tue, Jul 8, 2008 at 7:49 PM, Michelle Li
[email protected] wrote:

I need to update multiple areas on my page within the same controller,
where statuses are updated as test scripts are being run and completed.
My js first renders a list of the available test cases to run, then I
have a loop running the execution of each script and doing a
page.replace_html, but nothing is rendered until everything has finished
executing.

I’m wondering how I can display the list first, then have the statuses
being updated on the page during the test script execution instead?

You want something along the lines of periodically call remote.

I did something vaguely like this and made a little screen cast
somewhere… lemmie look…

OK, found it:

The Construction Blog - Tips on Choosing Local Construction Companies

And the tutorial:

The Construction Blog - Tips on Choosing Local Construction Companies

Hope that helps

Mikel


http://lindsaar.net/
Rails, RSpec and Life blog…

On Mon, Jul 14, 2008 at 3:19 PM, Michelle Li
[email protected] wrote:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant’: uninitialized constant BackgrounDRb::Rails
(NameError)
from

That screencast is cool, albeit a bit old(meaning your worker code is
wrong, in all probability).

You want to perhaps refer:

http://backgroundrb.rubyforge.org/

Also, there is a mailing list and IRC channel for BackgrounDRb, where
you can ask questions if in doubt.

(IRC, is not very active all the time).

On Mon, Jul 14, 2008 at 4:51 PM, Michelle Li
[email protected] wrote:

Yup I had followed the instructions on the rubyforge page just to set up
the BackgrounDRb without actually setting up any of my own workers. I
just try to start the server and I can’t get it running…

You are trying to inherit BackgrounDRb::Rails in your worker code(as
seen from exception), and that class no longer exists(it has been
removed like 6 months back) and hence I asked you to read the
documentation and try.

An empty worker looks like:

class BillingWorker < BackgrounDRb::MetaWorker
set_worker_name :billing_worker
def create(args = nil)
# method gets called, when new instance of worker is created.
end
end

Thanks for the help, I began running server and played around using
MiddleMan to create new workers in the client terminal. However, when I
try to use methods such as delete_worker() or send_request() I get
errors such as this:

NoMethodError: undefined method `delete_worker’ for
#BackgrounDRb::ClusterConnection:0xb7496648

In my background.yml file I only have the following specified so it
doesn’t seem like I’m using any clustering:


:backgroundrb:
:ip: 0.0.0.0
:port: 11008

Sorry for all the noob questions.

Thanks!

Hemant K. wrote:

On Mon, Jul 14, 2008 at 4:51 PM, Michelle Li
[email protected] wrote:

Yup I had followed the instructions on the rubyforge page just to set up
the BackgrounDRb without actually setting up any of my own workers. I
just try to start the server and I can’t get it running…

You are trying to inherit BackgrounDRb::Rails in your worker code(as
seen from exception), and that class no longer exists(it has been
removed like 6 months back) and hence I asked you to read the
documentation and try.

An empty worker looks like:

class BillingWorker < BackgrounDRb::MetaWorker
set_worker_name :billing_worker
def create(args = nil)
# method gets called, when new instance of worker is created.
end
end

Yup I had followed the instructions on the rubyforge page just to set up
the BackgrounDRb without actually setting up any of my own workers. I
just try to start the server and I can’t get it running…

Hemant K. wrote:

On Mon, Jul 14, 2008 at 3:19 PM, Michelle Li
[email protected] wrote:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant’: uninitialized constant BackgrounDRb::Rails
(NameError)
from

That screencast is cool, albeit a bit old(meaning your worker code is
wrong, in all probability).

You want to perhaps refer:

http://backgroundrb.rubyforge.org/

Also, there is a mailing list and IRC channel for BackgrounDRb, where
you can ask questions if in doubt.

(IRC, is not very active all the time).