In [1]:
import os 
import json

In [17]:
hostmap = {
    u'minecraft.willz.org:3264': 'antigua',
    u'73.223.113.112:3264': 'curacao', 
    u'hyperion.cs.umd.edu:3264': 'hyperion', 
    u'nevis.cs.umd.edu:3264': 'nevis',
    u'lagoon.cs.umd.edu:3264': 'lagoon',
}


def load_data(path="."):
    for local in os.listdir(path):
        # Ignore hidden directories and files 
        if local.startswith("."): continue 
        if not os.path.isdir(local): continue
        
        # Find the path to the results file 
        results = os.path.join(local, "results.jsonl")
    
        # Read results and parse json lines
        with open(results, 'r') as f:
            for line in f:
                data = json.loads(line)
                data[u'localhost'] = local 
                
                for key in data[u'syncs'].keys():
                    data[u'syncs'][hostmap[key]] = data[u'syncs'].pop(key)
                
                yield data

In [18]:
data = next(load_data())

In [19]:
data


Out[19]:
{u'bandit': {u'counts': [0, 0, 0, 0],
  u'strategy': u'uniform selection',
  u'values': [0, 0, 0, 0]},
 u'duration': 0,
 u'finished': u'0001-01-01T00:00:00Z',
 u'localhost': 'antigua',
 u'nkeys': 0,
 u'reads': 0,
 u'started': u'0001-01-01T00:00:00Z',
 u'store': u'linearizable',
 u'syncs': {'curacao': {u'Misses': 24,
   u'Pulls': 0,
   u'Pushes': 0,
   u'Syncs': 0,
   u'Versions': 0},
  'hyperion': {u'Misses': 20,
   u'Pulls': 0,
   u'Pushes': 0,
   u'Syncs': 0,
   u'Versions': 0},
  'lagoon': {u'Misses': 25,
   u'Pulls': 0,
   u'Pushes': 0,
   u'Syncs': 0,
   u'Versions': 0},
  'nevis': {u'Misses': 21,
   u'Pulls': 0,
   u'Pushes': 0,
   u'Syncs': 0,
   u'Versions': 0}},
 u'throughput': 0,
 u'timestamp': u'2017-06-30T15:19:18.114400725-04:00',
 u'writes': 0}