Last active
May 18, 2016 19:10
-
-
Save rmuslimov/8975bc3a47c98b2a4658de3202c5b2d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# coding: utf-8 | |
""" | |
============================================================= | |
airborne.core.accounts.management.commands.get_all_rate_codes | |
============================================================= | |
""" | |
from django.core.management import BaseCommand | |
from eventlet.greenpool import GreenPool | |
from funcy import flatten | |
from airborne.core.accounts.models import BCDCompanyProfile as BCP | |
from hyatt.conf import get_setting | |
class Command(BaseCommand): | |
def handle(self, *args, **kwargs): | |
parsed = GreenPool(100).imap( | |
lambda objid: ( | |
get_setting(objid, 'rate_codes:client_preferred')), | |
BCP.objects.filter( | |
is_folder=False).values_list('id', flat=True).all()) | |
print set(flatten(filter(None, parsed))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool, that couldnt be simpler. When you have a spare moment can you run this for me against production db/memcached? Any downsides to running it live or should we pull a backup and do it locally?