Improve logging for proxy publish
Added message type logging during proxy publishing. Change-Id: Iddbfab0e4dd6e9f5b6d1c3ea5c86029700a2d66d
This commit is contained in:
@@ -152,7 +152,6 @@ class WorkerTaskExecutor(executor.TaskExecutorBase):
|
||||
|
||||
def _publish_request(self, request, topic):
|
||||
"""Publish request to a given topic."""
|
||||
LOG.debug("Sending request: %s" % request)
|
||||
try:
|
||||
self._proxy.publish(msg=request,
|
||||
routing_key=topic,
|
||||
|
@@ -68,7 +68,7 @@ class Message(object):
|
||||
"""Base class for all message types."""
|
||||
|
||||
def __str__(self):
|
||||
return str(self.to_dict())
|
||||
return "<%s> %s" % (self.TYPE, self.to_dict())
|
||||
|
||||
@abc.abstractmethod
|
||||
def to_dict(self):
|
||||
|
@@ -69,6 +69,7 @@ class Proxy(object):
|
||||
|
||||
def publish(self, msg, routing_key, **kwargs):
|
||||
"""Publish message to the named exchange with routing key."""
|
||||
LOG.debug("Sending %s", msg)
|
||||
if isinstance(routing_key, six.string_types):
|
||||
routing_keys = [routing_key]
|
||||
else:
|
||||
|
@@ -114,7 +114,6 @@ class Server(object):
|
||||
def _reply(self, reply_to, task_uuid, state=pr.FAILURE, **kwargs):
|
||||
"""Send reply to the `reply_to` queue."""
|
||||
response = pr.Response(state, **kwargs)
|
||||
LOG.debug("Sending reply: %s", response)
|
||||
try:
|
||||
self._proxy.publish(response, reply_to, correlation_id=task_uuid)
|
||||
except Exception:
|
||||
|
@@ -63,7 +63,8 @@ class TestProtocol(test.TestCase):
|
||||
|
||||
def test_str(self):
|
||||
request = self.request()
|
||||
self.assertEqual(str(request), str(request.to_dict()))
|
||||
self.assertEqual(str(request),
|
||||
"<REQUEST> %s" % self.request_to_dict())
|
||||
|
||||
def test_repr(self):
|
||||
expected = '%s:%s' % (self.task.name, self.task_action)
|
||||
|
Reference in New Issue
Block a user