Skip to content

Instantly share code, notes, and snippets.

@rmuslimov
Last active May 18, 2016 19:10
Show Gist options
  • Save rmuslimov/8975bc3a47c98b2a4658de3202c5b2d5 to your computer and use it in GitHub Desktop.
Save rmuslimov/8975bc3a47c98b2a4658de3202c5b2d5 to your computer and use it in GitHub Desktop.
# 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)))
@meconlin
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment