Skip to content

Commit

Permalink
replace logger.debug by logger.info
Browse files Browse the repository at this point in the history
  • Loading branch information
mzk-vct committed Mar 22, 2017
1 parent fbfcf60 commit afe03ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
14 changes: 7 additions & 7 deletions scripts/add_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ def spawnClient(clientName, port, signerSeed, host='0.0.0.0'):

async def checkReply(client, requestId):
_, status = client.getReply(requestId)
logger.debug("Number of received messages {}".format(len(client.inBox)))
logger.info("Number of received messages {}".format(len(client.inBox)))
groups = groupby(client.inBox, key=lambda x: x[0])
for key, group in groups:
logger.debug("Group {}".format(key['op']))
logger.info("Group {}".format(key['op']))
for msg in list(group):
logger.debug(" {}".format(msg))
logger.info(" {}".format(msg))
succeeded = status == "CONFIRMED"
return succeeded


async def doRequesting(client, wallet, op):
signedOp = wallet.signOp(op)
logger.debug("Client {} sending request {}".format(client, op))
logger.info("Client {} sending request {}".format(client, op))
request = client.submitReqs(signedOp)[0]
requestId = request.reqId
args = [client, requestId]
Expand All @@ -73,9 +73,9 @@ def checkIfConnectedToAll(client):
connectedNodes = client.nodestack.connecteds
connectedNodesNum = len(connectedNodes)
totalNodes = len(client.nodeReg)
logger.debug("Connected {} / {} nodes".format(connectedNodesNum, totalNodes))
logger.info("Connected {} / {} nodes".format(connectedNodesNum, totalNodes))
for node in connectedNodes:
logger.debug(" {}".format(node))
logger.info(" {}".format(node))

if connectedNodesNum == 0:
raise Exception("Not connected to any")
Expand All @@ -87,7 +87,7 @@ def checkIfConnectedToAll(client):

async def ensureConnectedToNodes(client):
wait = 5
logger.debug("waiting for {} seconds to check client connections to nodes...".format(wait))
logger.info("waiting for {} seconds to check client connections to nodes...".format(wait))
await eventuallyAll(lambda : checkIfConnectedToAll(client), retryWait=.5, totalTimeout=wait)


Expand Down
19 changes: 10 additions & 9 deletions scripts/load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
logger = getlogger()
config = getConfig()

TTL = 5.0
TTL = 60.0
CONNECTION_TTL = 30.0
RETRY_WAIT = 0.25


Expand Down Expand Up @@ -135,7 +136,7 @@ def submitNym(self):
verkey=signer.verkey)
wallet.addSponsoredIdentity(idy)
reqs = wallet.preparePending()
logger.debug("Client {} sending request {}".format(cli, reqs[0]))
logger.info("Client {} sending request {}".format(cli, reqs[0]))
sentAt = time.time()
cli.submitReqs(reqs[0])
corosArgs.append([cli, wallet, reqs[0], sentAt])
Expand All @@ -150,7 +151,7 @@ def submitSetAttr(self):
ledgerStore=LedgerStore.RAW)
wallet.addAttribute(attrib)
reqs = wallet.preparePending()
logger.debug("Client {} sending request {}".format(cli, reqs[0]))
logger.info("Client {} sending request {}".format(cli, reqs[0]))
sentAt = time.time()
cli.submitReqs(reqs[0])
corosArgs.append([cli, wallet, reqs[0], sentAt])
Expand Down Expand Up @@ -236,7 +237,7 @@ async def checkReplyAndLogStat(client, wallet, request, sentAt, writeResultsRow,
ackNodes=",".join(ackNodes),
nackNodes=",".join(nackNodes.keys()),
replyNodes=",".join(replyNodes.keys()))
logger.debug("COUNTER {}".format(row))
logger.info("COUNTER {}".format(row))
stats.append((latency, hasConsensus, queryTime))
writeResultsRow(row._asdict())

Expand All @@ -245,7 +246,7 @@ def checkIfConnectedToAll(client):
connectedNodes = client.nodestack.connecteds
connectedNodesNum = len(connectedNodes)
totalNodes = len(client.nodeReg)
logger.debug("Connected {} / {} nodes".
logger.info("Connected {} / {} nodes".
format(connectedNodesNum, totalNodes))

if connectedNodesNum == 0:
Expand Down Expand Up @@ -287,7 +288,7 @@ def printCurrentTestResults(stats, testStartedAt):
failNum = totalNum - successNum
throughput = successNum / secSinceTestStart
errRate = failNum / secSinceTestStart
logger.debug(
logger.info(
"""
================================
Test time: {}
Expand All @@ -310,7 +311,7 @@ def main(args):
"perf_results_{x.numberOfClients}_" \
"{x.numberOfRequests}_{0}.csv".format(int(time.time()), x=args)
resultFilePath = os.path.join(args.resultsPath, resultsFileName)
logger.debug("Results file: {}".format(resultFilePath))
logger.info("Results file: {}".format(resultFilePath))

def writeResultsRow(row):
if not os.path.exists(resultFilePath):
Expand Down Expand Up @@ -344,7 +345,7 @@ def buildCoros(coroFunc, corosArgs):
looper.add(cli)
connectionCoros.append(functools.partial(checkIfConnectedToAll, cli))
looper.run(eventuallyAll(*connectionCoros,
totalTimeout=TTL,
totalTimeout=CONNECTION_TTL,
retryWait=RETRY_WAIT))

testStartedAt = time.time()
Expand All @@ -369,7 +370,7 @@ def buildCoros(coroFunc, corosArgs):
totalTimeout=len(coros)*TTL,
retryWait=RETRY_WAIT))
printCurrentTestResults(stats, testStartedAt)
logger.debug("Sent {} {} requests".format(len(coros), requestType))
logger.info("Sent {} {} requests".format(len(coros), requestType))


if __name__ == '__main__':
Expand Down

0 comments on commit afe03ab

Please sign in to comment.