merge errors and a datetime fix

This commit is contained in:
Sandy Walsh
2013-02-13 14:38:59 -06:00
committed by root
parent 8e51bf80af
commit 5f1a748123
2 changed files with 10 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import datetime
import json
import pprint
from django import db
from django import http
from django.shortcuts import render_to_response
from django import template
@@ -321,13 +322,16 @@ def aggregate_usage(raw):
def str_time_to_unix(when):
try:
when = datetime.datetime.strptime(when, "%Y-%m-%d %H:%M:%S")
except ValueError:
try:
when = datetime.datetime.strptime(when, "%Y-%m-%d %H:%M:%S.%f")
except ValueError:
# Old way of doing it
when = datetime.datetime.strptime(when, "%Y-%m-%dT%H:%M:%S.%f")
except Exception, e:
pass
try:
# Old way of doing it
when = datetime.datetime.strptime(when, "%Y-%m-%dT%H:%M:%S.%f")
except Exception, e:
print "BAD DATE: ", e
return dt.dt_to_decimal(when)

View File

@@ -152,7 +152,8 @@ def run(deployment_config):
LOG.debug("Processing on '%s'" % name)
with kombu.connection.BrokerConnection(**params) as conn:
try:
consumer = NovaConsumer(name, conn, deployment, durable)
consumer = NovaConsumer(name, conn, deployment, durable,
queue_arguments)
consumer.run()
except Exception as e:
LOG.exception("name=%s, exception=%s. Reconnecting in 5s" %