From aab0df74380ab3054004366aac55e87363d954b3 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 25 Mar 2019 17:45:07 +0100 Subject: [PATCH] Client compatible with older versin --- hugvey/client.py | 2 +- hugvey/communication.py | 4 ++-- www/js/hugvey_console.js | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hugvey/client.py b/hugvey/client.py index e49c9c1..f55a37c 100644 --- a/hugvey/client.py +++ b/hugvey/client.py @@ -276,7 +276,7 @@ class Hugvey(object): def __init__(self, id = None): self.id = self.getId() if id is None else id - logger.debug(f'Hugvey {self.id}') + logger.debug('Hugvey {}'.format(self.id)) def getId(self) -> int: """Get Hugvey ID from hostname""" diff --git a/hugvey/communication.py b/hugvey/communication.py index 890fab7..ecc98fb 100644 --- a/hugvey/communication.py +++ b/hugvey/communication.py @@ -12,7 +12,7 @@ def getTopic(hugvey_id): def zmqSend(socket, hugvey_id, msg): - log = mainLogger.getChild(f"{hugvey_id}").getChild("communication") + log = mainLogger.getChild("{}".format(hugvey_id)).getChild("communication") log.debug("SEND: {}".format(msg)) msgData = json.dumps(msg) topic = getTopic(hugvey_id) @@ -22,7 +22,7 @@ def zmqSend(socket, hugvey_id, msg): async def zmqReceive(socket): topic, msg = await socket.recv_multipart() hugvey_id = topic.decode()[2:] - mainLogger.getChild(f"{hugvey_id}").getChild("communication").debug( + mainLogger.getChild("{}".format(hugvey_id)).getChild("communication").debug( "Received 0mq messages for Hugvey #{} containing {}".format(hugvey_id, msg.decode()) ) return int(hugvey_id), json.loads(msg.decode()) diff --git a/www/js/hugvey_console.js b/www/js/hugvey_console.js index 33f6d9b..aa2267e 100644 --- a/www/js/hugvey_console.js +++ b/www/js/hugvey_console.js @@ -1503,6 +1503,7 @@ class Graph { } calculateDistancesFromStart() { + console.time('calculateDistancesFromStart'); let starts = this.messages.filter( m => m.hasOwnProperty('start') && m['start'] == true); if (starts.length < 1) { console.error("No start set"); @@ -1589,23 +1590,30 @@ class Graph { } let yPos = 0; + console.time('step1'); for(let startMsg of starts) { + console.time('start: '+startMsg['@id']); if(distances[startMsg['@id']] === null) { distances[startMsg['@id']] = [0, yPos]; } yPos = traverseMsg(startMsg['@id'], 1 , true, yPos); yPos += 1; + console.timeEnd('start: '+startMsg['@id']); } - + console.timeEnd('step1'); + console.time('step2'); // now we have the formal tree, lets try to polish the rest: for(let msgId in distances) { + console.time('polish: '+ msgId); if(distances[msgId] === null) { continue; } // let's see if there are parent nodes that are not in the distances array // traverse up and see whether we encounter anything new traverseMsg(msgId, distances[msgId][0] -1, false, distances[msgId][1]) + console.timeEnd('polish: '+ msgId); } + console.timeEnd('step2'); // let additionalsDepth = 0; //// now the secondary strands: @@ -1618,6 +1626,7 @@ class Graph { // traverseMsg(msgId, additionalsDepth+1, true); // // } + console.timeEnd("calculateDistancesFromStart"); return distances; } }