Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don't worry, you can still create the pull request.
  • 8 commits
  • 3 files changed
  • 0 commit comments
  • 2 contributors
Showing with 18 additions and 1 deletion.
  1. +1 −1  docs/setup.rst
  2. +4 −0 settings.py
  3. +13 −0 worker/worker.py
View
2  docs/setup.rst
@@ -12,7 +12,7 @@ The "Hurry Up" Install Guide
#. Configure OpenStack to publish Notifications back into RabbitMQ (see below)
#. Restart the OpenStack services.
#. Run the Worker to start consuming messages. (see below)
-#. Run the web server (``python manage.py runserver``)
+#. Run the web server (``python manage.py runserver --insecure``)
#. Point your browser to ``http://127.0.0.1:8000`` (the default server location)
#. Click on stuff, see what happens. You can't hurt anything, it's all read-only.
View
4 settings.py
@@ -167,3 +167,7 @@
},
}
}
+
+# Force use of the pickle serializer as a workaound for django-1.6. See:
+# https://docs.djangoproject.com/en/dev/releases/1.6/#default-session-serialization-switched-to-json
+SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'
View
13 worker/worker.py
@@ -19,6 +19,7 @@
import datetime
import sys
import time
+import anyjson
import kombu
import kombu.mixins
@@ -38,6 +39,7 @@
from stacktach import message_service
from stacktach import stacklog
from stacktach import views
+from kombu.serialization import BytesIO, register
stacklog.set_default_logger_name('worker')
@@ -61,6 +63,13 @@ def __init__(self, name, connection, deployment, durable, queue_arguments,
self.topics = topics
self.exchange = exchange
+ register('bufferjson', self.loads, anyjson.dumps,
+ content_type='application/json',
+ content_encoding='binary')
+
+ def loads(s):
+ return anyjson.loads(BytesIO(s))
+
def _create_exchange(self, name, type, exclusive=False, auto_delete=False):
return message_service.create_exchange(name, exchange_type=type,
exclusive=exclusive,
@@ -135,6 +144,10 @@ def on_nova(self, body, message):
(e, json.loads(str(message.body))))
raise
+ def on_decode_error(self, message, exc):
+ _get_child_logger().exception("Decode Error: %s" % exc)
+ # do NOT call message.ack(), otherwise the message will be lost
+
def continue_running():
return True

No commit comments for this range

Something went wrong with that request. Please try again.