New awx.main.utils directory, distributed task to invalidate settings

This commit is contained in:
AlanCoding
2016-12-02 14:36:04 -05:00
parent db21178b14
commit 7848198b9f
10 changed files with 50 additions and 71 deletions

View File

@@ -42,6 +42,8 @@ from django.utils.encoding import smart_str
from django.core.mail import send_mail
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.utils.log import configure_logging
# AWX
from awx.main.constants import CLOUD_PROVIDERS
@@ -83,6 +85,17 @@ def celery_startup(conf=None, **kwargs):
logger.error("Failed to rebuild schedule {}: {}".format(sch, e))
@task(queue='broadcast_all')
def clear_cache_keys(cache_keys):
set_of_keys = set([key for key in cache_keys])
logger.debug('cache delete_many(%r)', set_of_keys)
cache.delete_many(set_of_keys)
for setting_key in set_of_keys:
if setting_key.startswith('LOG_AGGREGATOR_'):
configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
break
@task(queue='default')
def send_notifications(notification_list, job_id=None):
if not isinstance(notification_list, list):