This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils.importlib import import_module | |
class OneToOneModelFactory(object): | |
""" | |
creates related models :cls | |
which are subclasses of :subclass named :subclasses | |
convenient to define a bunch of related models programmatically | |
(eg. localize table columns in separate tables) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Item(models.Model): | |
... a bunch of very interesting fields ... | |
popularity = models.IntegerField() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boto.utils import parse_ts | |
from django.core.files.storage import get_storage_class | |
from storages.backends.s3boto import S3BotoStorage | |
""" | |
make sure you have this setting | |
AWS_PRELOAD_METADATA = True | |
and that you have python-dateutils==1.5 installed | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GhettoRouter(object): | |
def route_for_task(self, task, args=None, kwargs=None): | |
return {'queue': 'celery', | |
'exchange': 'celery', | |
'exchange_type': 'direct', | |
'routing_key': 'celery'} | |
CELERY_ROUTES = (GhettoRouter(), ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/srv/fashiolista/lib/python2.7/site-packages/raven/utils/serializer/manager.py", line 68, in transform | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 582, in __repr__ | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 446, in as_uri | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 435, in info | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 414, in _info | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 637, in transport | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/connection.py", line 395, in create_transport | |
File "/srv/fashiolista/lib/python2.7/site-packages/kombu/transport/redis.py", line 622, in __init__ | |
self.cycle = MultiChannelPoller() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2012-10-12 15:07:35,033: WARNING/MainProcess] builtin_function_or_method 1018 +30 | |
[2012-10-12 15:07:35,034: WARNING/MainProcess] dict 1924 +21 | |
[2012-10-12 15:07:35,034: WARNING/MainProcess] tuple 1415 +9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import objgraph | |
socks_refs = objgraph.by_type('Connection') | |
objgraph.show_backrefs(socks_refs, filename='sample-%r.png' % now, max_depth=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import objgraph | |
socks_refs = objgraph.by_type('Connection') | |
objgraph.show_backrefs(socks_refs, filename='sample-%r.png' % now, max_depth=10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def get_unique_timestamp(redis_connection, uniqueness_namespace): | |
while True: | |
t = time.time() | |
key = namespace % t | |
if redis_connection.setnx(key): | |
return key | |
time.sleep(0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/srv/fashiolista/lib/python2.7/site-packages/celery/worker/__init__.py", line 351, in start | |
component.start() | |
File "/srv/fashiolista/lib/python2.7/site-packages/celery/worker/consumer.py", line 393, in start | |
self.consume_messages() | |
File "/srv/fashiolista/lib/python2.7/site-packages/celery/worker/consumer.py", line 483, in consume_messages | |
handlermap[fileno](fileno, event) | |
File "/srv/fashiolista/lib/python2.7/site-packages/billiard/pool.py", line 1047, in maintain_pool | |
self._maintain_pool() | |
File "/srv/fashiolista/lib/python2.7/site-packages/billiard/pool.py", line 1042, in _maintain_pool |
OlderNewer