diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2011-05-25 15:42:24 -0700 |
|---|---|---|
| committer | termie <github@anarkystic.com> | 2011-05-25 15:42:24 -0700 |
| commit | e1a47584cc63136280cf3ca9ef02da3efc1dff7f (patch) | |
| tree | 67ba29e84716661d5e6515568568677f6acebcd4 | |
| parent | b44c1fe9561ee8754137d2700bab295f20a4032b (diff) | |
| download | nova-e1a47584cc63136280cf3ca9ef02da3efc1dff7f.tar.gz nova-e1a47584cc63136280cf3ca9ef02da3efc1dff7f.tar.xz nova-e1a47584cc63136280cf3ca9ef02da3efc1dff7f.zip | |
pep8 and comment fixes
| -rw-r--r-- | nova/rpc.py | 25 | ||||
| -rw-r--r-- | nova/service.py | 1 |
2 files changed, 16 insertions, 10 deletions
diff --git a/nova/rpc.py b/nova/rpc.py index 62590ca92..db5aec826 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -92,12 +92,16 @@ class Connection(carrot_connection.BrokerConnection): pass return cls.instance() + class Pool(pools.Pool): + """Class that implements a Pool of Connections""" + def create(self): return Connection.instance(new=True) ConnectionPool = Pool(max_size=20) + class Consumer(messaging.Consumer): """Consumer base class. @@ -171,6 +175,16 @@ class AdapterConsumer(Consumer): self.register_callback(self.process_data) def process_data(self, message_data, message): + """Consumer callback that parses the message for validity and + fires off a thread to call the proxy object method. + + Message data should be a dictionary with two keys: + method: string representing the method to call + args: dictionary of arg: value + + Example: {'method': 'echo', 'args': {'value': 42}} + + """ LOG.debug(_('received %s') % message_data) msg_id = message_data.pop('_msg_id', None) @@ -191,14 +205,8 @@ class AdapterConsumer(Consumer): @exception.wrap_exception def _process_data(self, msg_id, ctxt, method, args): - """Magically looks for a method on the proxy object and calls it. - - Message data should be a dictionary with two keys: - method: string representing the method to call - args: dictionary of arg: value - - Example: {'method': 'echo', 'args': {'value': 42}} - + """Thread that maigcally looks for a method on the proxy + object and calls it. """ node_func = getattr(self.proxy, str(method)) @@ -285,7 +293,6 @@ class ConsumerSet(object): except Exception as e: LOG.error(_("Received exception %s " % str(e) + \ "while processing consumer")) - fuck self.reconnect() # Break to outer loop break diff --git a/nova/service.py b/nova/service.py index 7761cfef5..c51c9b066 100644 --- a/nova/service.py +++ b/nova/service.py @@ -91,7 +91,6 @@ class Service(object): if 'nova-compute' == self.binary: self.manager.update_available_resource(ctxt) - if self.report_interval: conn = rpc.Connection.instance(new=True) |
