view master/wecu/reducer.py @ 57:ac1a20e627a9

from lukasz git repo 2020-05-26 (see ~/src/wecu), then editted, sac not quite working yet
author Henry S. Thompson <ht@markup.co.uk>
date Wed, 27 May 2020 20:54:34 +0000
parents
children
line wrap: on
line source

#!/usr/bin/python

import sys

request_counter = 0
response_counter = 0

for line in sys.stdin:
    line = line.strip().split('\t')
    if line[0] == 'request_counter':
        request_counter += int(line[1])
    elif line[0] == 'response_counter':
        response_counter += int(line[1])
    else:
        print(line[0])
        print('error')
        sys.exit(1)

print(request_counter)
print(response_counter)