fixes from review comments

This commit is contained in:
Thomas Maddox 2013-04-29 16:09:27 -05:00
parent b7b712e22b
commit bc4a3f6942
3 changed files with 13 additions and 16 deletions

View File

@ -32,11 +32,9 @@ start = datetime.datetime(year=yesterday.year, month=yesterday.month, day=yester
end = start + datetime.timedelta(hours=length-1, minutes=59, seconds=59) end = start + datetime.timedelta(hours=length-1, minutes=59, seconds=59)
instance_map = {} # { uuid : [request_id, request_id, ...] } instance_map = {} # { uuid : [request_id, request_id, ...] }
metadata = {'raw_text': True, 'instances': instance_map} metadata = {'format': 'json', 'instances': instance_map}
report = [metadata] report = [metadata]
#report.append("Generating report for %s to %s" % (start, end))
dstart = dt.dt_to_decimal(start) dstart = dt.dt_to_decimal(start)
dend = dt.dt_to_decimal(end) dend = dt.dt_to_decimal(end)
@ -73,11 +71,11 @@ for uuid_dict in updates:
for req_dict in reqs: for req_dict in reqs:
req = req_dict['request_id'] req = req_dict['request_id']
raws = list(models.RawData.objects.filter(request_id=req)\ raws = list(models.RawData.objects.filter(request_id=req)
.exclude(event='compute.instance.exists')\ .exclude(event='compute.instance.exists')
.values("id", "when", "routing_key", "old_state", .values("id", "when", "routing_key", "old_state",
"state", "tenant", "event", "image_type", "state", "tenant", "event", "image_type",
"deployment")\ "deployment")
.order_by('when')) .order_by('when'))
_start = None _start = None
@ -176,7 +174,7 @@ for uuid_dict in updates:
queue, body = json.loads(err.json) queue, body = json.loads(err.json)
payload = body['payload'] payload = body['payload']
#Add error information to failed request report # Add error information to failed request report
failed_request['event_id'] = err.id failed_request['event_id'] = err.id
failed_request['tenant'] = err.tenant failed_request['tenant'] = err.tenant
failed_request['service'] = err.service failed_request['service'] = err.service

View File

@ -22,9 +22,9 @@ import argparse
import datetime import datetime
import json import json
import sys import sys
from os import environ import os
sys.path.append(environ.get('STACKTACH_INSTALL_DIR', '/stacktach')) sys.path.append(os.environ.get('STACKTACH_INSTALL_DIR', '/stacktach'))
from stacktach import datetime_to_decimal as dt from stacktach import datetime_to_decimal as dt
from stacktach import models from stacktach import models

View File

@ -3,11 +3,10 @@ import datetime
import json import json
import sys import sys
import time import time
from os import environ import os
import prettytable import prettytable
sys.path.append(environ.get('STACKTACH_INSTALL_DIR', '/stacktach')) sys.path.append(os.environ.get('STACKTACH_INSTALL_DIR', '/stacktach'))
from stacktach import datetime_to_decimal as dt from stacktach import datetime_to_decimal as dt
from stacktach import image_type from stacktach import image_type