Пример #1
0
def processOutputFunc(outputFile):
    if USE_REDIS:
        import random
        import redis
        import re
        import sys
        r = redis.StrictRedis(host=experiment_common.SRC_HOST, port=6379)
        r.incr("clients")
        turnCount = 0
        outfile = open(outputFile, 'r')
        for line in outfile:
            match = re.match("(\d+)\s+(\d+)", line)
            if match:
                prevEndTime = int(match.group(1))
                endTime = int(match.group(2))
                txnNum = random.randint(0, sys.maxint)
                txnKey = "txn-" + repr(txnNum)
                mapping = dict()
                mapping['prev-end-time'] = prevEndTime
                mapping['end-time'] = endTime
                r.hmset(txnKey, mapping)
                r.lpush("txns", txnKey)
                turnCount += 1
        if turnCount >= 50:
            r.incr("activeplayers")
    else:
        experiment_common.copyToSrcHost(outputFile, OUTPUT_DEST)
Пример #2
0
def processOutputFunc(outputFile):
    if USE_REDIS:
        import random
        import redis
        import re
        import sys
        r = redis.StrictRedis(host=experiment_common.SRC_HOST, port=6379)
        r.incr("clients")
        outfile = open(outputFile, 'r')
        for line in outfile:
            match = re.match(
                "^\d+\s+([\d\.]+)\s+([\d\.]+)\s+\d+\s+(\d+)\s+(\d+)", line)
            if match:
                startTime = int(float(match.group(1)) * 1000)
                endTime = int(float(match.group(2)) * 1000)
                committed = int(match.group(3))
                txnType = int(match.group(4))
                txnNum = random.randint(0, sys.maxint)
                txnKey = "txn-" + repr(txnNum)
                mapping = dict()
                mapping['start-time'] = startTime
                mapping['end-time'] = endTime
                mapping['committed'] = committed
                mapping['type'] = txnType
                r.hmset(txnKey, mapping)
                r.lpush("txns", txnKey)
    else:
        experiment_common.copyToSrcHost(outputFile, OUTPUT_DEST)
Пример #3
0
def processOutputFunc(outputFile):
    if USE_REDIS:
        experiment_common.putDataInRedis(outputFile)
    else:
        experiment_common.copyToSrcHost(outputFile, OUTPUT_DEST)