def _apply_pillow_actions_to_pillows(pillow_actions, pillows_by_group): def is_relevant(pillow_actions, pillow_config): # the default is to include if nothing specified relevant = True # the order of these checks is important since the actions are resolved in the order they are passed in for action in pillow_actions: if pillow_config.section in action.include_groups: assert pillow_config.section not in action.exclude_groups relevant = True if pillow_config.section in action.exclude_groups: relevant = False if pillow_config.class_name in action.include_pillows: assert pillow_config.class_name not in action.exclude_pillows relevant = True if pillow_config.class_name in action.exclude_pillows: relevant = False return relevant # this sucks, but not sure there's a better way to make it available to fabric from manage import init_hq_python_path init_hq_python_path() from pillowtop.utils import get_pillow_configs_from_settings_dict return filter( lambda p_conf: is_relevant(pillow_actions, p_conf), set(get_pillow_configs_from_settings_dict(pillows_by_group)) )
def _get_pillow_configs_from_settings_dict(pillows_by_group): # this sucks, but not sure there's a better way to make it available to fabric from manage import init_hq_python_path init_hq_python_path() from pillowtop.utils import get_pillow_configs_from_settings_dict return get_pillow_configs_from_settings_dict(pillows_by_group)
import os import django from django.core.checks import run_checks from django.core.exceptions import AppRegistryNotReady from celery import Celery from manage import init_hq_python_path, run_patches init_hq_python_path() run_patches() os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') app = Celery() app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() django.setup() try: run_checks() except AppRegistryNotReady: pass
from __future__ import absolute_import, unicode_literals import os import django from django.core.checks import run_checks from django.core.exceptions import AppRegistryNotReady from celery import Celery from manage import init_hq_python_path, run_patches init_hq_python_path() run_patches() os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings') app = Celery() app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() django.setup() try: run_checks() except AppRegistryNotReady: pass