5
from pycassa.cassandra.ttypes import NotFoundException
6
from collections import defaultdict
7
from daisy import config
9
creds = {'username': config.cassandra_username,
10
'password': config.cassandra_password}
11
pool = pycassa.ConnectionPool(config.cassandra_keyspace,
12
config.cassandra_hosts, timeout=600,
15
dayoops_cf = pycassa.ColumnFamily(pool, 'DayOOPS')
16
oops_cf = pycassa.ColumnFamily(pool, 'OOPS')
17
problem_type_cf = pycassa.ColumnFamily(pool, 'ProblemType')
21
if __name__ == '__main__':
22
if len(sys.argv) != 2:
23
print >>sys.stderr, "Usage: [date]"
30
buf = dayoops_cf.get(date, column_start=start, column_count=1000)
31
except NotFoundException:
33
start = buf.keys()[-1]
38
for oops_id in oopses:
40
data = oops_cf.get(str(oops_id), columns=['ProblemType'])
41
problem_type = data['ProblemType']
43
problem_type_cf.get(oops_id)
44
except NotFoundException:
45
problem_type_cf.insert(oops_id, {"ProblemType":problem_type})
46
except (NotFoundException, KeyError):
47
# Sometimes we didn't insert the full OOPS. I have no idea why.
48
#print 'could not find', uuid