diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-03-22 16:47:58 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-03-22 16:47:58 +0000 |
| commit | f48e798f0e10a657a52896b2237243c4b93e7f3c (patch) | |
| tree | 78a0c447372c928a550e0b51a935c4f7f61ef4f1 /openstack/common/rpc/proxy.py | |
| parent | eb2f2c757e01544ab6e67ffcc0a9dc741e69860f (diff) | |
| parent | 229b815fb72dccf998b18a0ad019cc61ccb888d8 (diff) | |
| download | oslo-f48e798f0e10a657a52896b2237243c4b93e7f3c.tar.gz oslo-f48e798f0e10a657a52896b2237243c4b93e7f3c.tar.xz oslo-f48e798f0e10a657a52896b2237243c4b93e7f3c.zip | |
Merge "Improves Logging for for rpc method timeouts"
Diffstat (limited to 'openstack/common/rpc/proxy.py')
| -rw-r--r-- | openstack/common/rpc/proxy.py | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/openstack/common/rpc/proxy.py b/openstack/common/rpc/proxy.py index fc09116..822248d 100644 --- a/openstack/common/rpc/proxy.py +++ b/openstack/common/rpc/proxy.py @@ -68,16 +68,21 @@ class RpcProxy(object): :param context: The request context :param msg: The message to send, including the method and args. :param topic: Override the topic for this message. + :param version: (Optional) Override the requested API version in this + message. :param timeout: (Optional) A timeout to use when waiting for the response. If no timeout is specified, a default timeout will be used that is usually sufficient. - :param version: (Optional) Override the requested API version in this - message. :returns: The return value from the remote method. """ self._set_version(msg, version) - return rpc.call(context, self._get_topic(topic), msg, timeout) + real_topic = self._get_topic(topic) + try: + return rpc.call(context, real_topic, msg, timeout) + except rpc.common.Timeout as exc: + raise rpc.common.Timeout( + exc.info, real_topic, msg.get('method')) def multicall(self, context, msg, topic=None, version=None, timeout=None): """rpc.multicall() a remote method. @@ -85,17 +90,22 @@ class RpcProxy(object): :param context: The request context :param msg: The message to send, including the method and args. :param topic: Override the topic for this message. + :param version: (Optional) Override the requested API version in this + message. :param timeout: (Optional) A timeout to use when waiting for the response. If no timeout is specified, a default timeout will be used that is usually sufficient. - :param version: (Optional) Override the requested API version in this - message. :returns: An iterator that lets you process each of the returned values from the remote method as they arrive. """ self._set_version(msg, version) - return rpc.multicall(context, self._get_topic(topic), msg, timeout) + real_topic = self._get_topic(topic) + try: + return rpc.multicall(context, real_topic, msg, timeout) + except rpc.common.Timeout as exc: + raise rpc.common.Timeout( + exc.info, real_topic, msg.get('method')) def cast(self, context, msg, topic=None, version=None): """rpc.cast() a remote method. |
