Merge lp:~soren/nova/rpc-threadpool into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen on 2011-02-15
Status: Merged
Approved by: Soren Hansen on 2011-02-16
Approved revision: 675
Merged at revision: 683
Proposed branch: lp:~soren/nova/rpc-threadpool
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 37 lines (+8/-1)
1 file modified
nova/rpc.py (+8/-1)
To merge this branch: bzr merge lp:~soren/nova/rpc-threadpool
Reviewer Review Type Date Requested Status
Devin Carlen (community) Approve on 2011-02-16
Jay Pipes (community) 2011-02-15 Approve on 2011-02-16
Review via email: mp+49896@code.launchpad.net

Commit Message

Use a threadpool for handling requests coming in through RPC.

Description of the Change

Is this really this simple?

To post a comment you must log in.
Soren Hansen (soren) wrote :

I mean.... it does what it says on the tin, but I wonder if there are any
side effects I haven't thought of..

Jay Pipes (jaypipes) wrote :

hmm, lgtm. maybe it really is this easy...

review: Approve
Devin Carlen (devcamcar) wrote :

suspiciously simple! :)

review: Approve
OpenStack Infra (hudson-openstack) wrote :
Download full text (36.3 KiB)

The attempt to merge lp:~soren/nova/rpc-threadpool into lp:nova failed. Below is the output from the failed tests.

Failure
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
SerializerTest
    test_basic ok
    test_defaults_to_json ok
    test_deserialize ok
    test_deserialize_empty_xml ok
    test_suffix_takes_precedence_over_accept_header ok
Test
    test_controller ok
    test_debug ok
    test_router ok
Failure
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
LocalizationTestCase
    test_multiple_positional_format_placeholders ok
Failure
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR
    runTest ERROR

======================================================================
ERROR: Failure: AttributeError (DEFINE_integer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/nose/loader.py", line 379, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/pymodules/python2.6/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(...

lp:~soren/nova/rpc-threadpool updated on 2011-02-16
674. By Soren Hansen on 2011-02-16

Spell flags correctly (i.e. not in upper case)

675. By Soren Hansen on 2011-02-16

Merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/rpc.py'
2--- nova/rpc.py 2011-02-11 11:27:50 +0000
3+++ nova/rpc.py 2011-02-16 19:40:49 +0000
4@@ -29,6 +29,7 @@
5
6 from carrot import connection as carrot_connection
7 from carrot import messaging
8+from eventlet import greenpool
9 from eventlet import greenthread
10
11 from nova import context
12@@ -42,6 +43,8 @@
13 FLAGS = flags.FLAGS
14 LOG = logging.getLogger('nova.rpc')
15
16+flags.DEFINE_integer('rpc_thread_pool_size', 1024, 'Size of RPC thread pool')
17+
18
19 class Connection(carrot_connection.BrokerConnection):
20 """Connection instance object"""
21@@ -155,11 +158,15 @@
22 def __init__(self, connection=None, topic="broadcast", proxy=None):
23 LOG.debug(_('Initing the Adapter Consumer for %s') % topic)
24 self.proxy = proxy
25+ self.pool = greenpool.GreenPool(FLAGS.rpc_thread_pool_size)
26 super(AdapterConsumer, self).__init__(connection=connection,
27 topic=topic)
28
29+ def receive(self, *args, **kwargs):
30+ self.pool.spawn_n(self._receive, *args, **kwargs)
31+
32 @exception.wrap_exception
33- def receive(self, message_data, message):
34+ def _receive(self, message_data, message):
35 """Magically looks for a method on the proxy object and calls it
36
37 Message data should be a dictionary with two keys: