Commit 9111aa13 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Change NodeManager.log() implementation, display one node per line with (or

without) it's UUID and bind address if available. Implement '__gt__' to sort
nodes per UUID by default.
Reduce log verbosity by displaying nodes only one time per manager update.


git-svn-id: https://svn.erp5.org/repos/neo/trunk@1323 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent cc2d5e26
......@@ -295,28 +295,21 @@ class NodeManager(object):
node.setState(state)
self.add(node)
logging.info('create node %s %s %s %s' % log_args)
self.log()
self.log()
def log(self):
logging.debug('Node manager : %d nodes' % len(self._node_set))
node_with_uuid = set(sorted(self._uuid_dict.values()))
node_without_uuid = self._node_set - node_with_uuid
for node in node_with_uuid | node_without_uuid:
if node.getUUID() is not None:
uuid = dump(node.getUUID())
else:
uuid = '-' * 32
args = (
uuid,
node.getType(),
node.getState()
)
logging.debug('nm: %s : %s/%s' % args)
for address, node in sorted(self._address_dict.items()):
args = (
address,
node.getType(),
node.getState()
)
logging.debug('nm: %s : %s/%s' % args)
for node in sorted(list(self._node_set)):
uuid = dump(node.getUUID()) or '-' * 32
address = node.getAddress() or ''
if address:
address = '%s:%d' % address
logging.debug(' * %32s | %17s | %22s | %s' % (
uuid, node.getType(), address, node.getState()))
def __gt__(self, node):
# sort per UUID if defined
if self._uuid is not None:
return self._uuid > node.uuid
return self._address > node._address
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment